GL Studio SCECpp Runtime Library
gls_pointer_array.h
Go to the documentation of this file.
1 #ifndef _GLS_POINTER_ARRAY_H
2 #define _GLS_POINTER_ARRAY_H
3 
4 /*! \file gls_pointer_array.h
5 
6 \brief This header defines GlsPointerArray which encapsulates an array of pointers
7  in the GL Studio DO-178B Runtime Library.
8 
9 \par Copyright Information
10 Copyright (C) 1999-2012 The DiSTI Corporation<br>
11 Orlando, FL USA<br>
12 All rights reserved.<br>
13 
14  This file is copyrighted software and contains proprietary trade secrets of
15 DiSTI, and embodies substantial creative efforts as well as confidential
16 information, ideas, and expressions.
17 
18  Permission to use, and copy this software and its documentation for any
19 purpose is hereby granted per the Distribution Agreement and/or the Licensing
20 Agreement signed with DiSTI. This permission is granted provided that:
21  1. The above copyright notice appears in all copies.
22  2. That both the copyright notice and this permission notice appear in
23  the supporting documentation.
24  3. That the names DiSTI and GL Studio not be used in advertising or
25  publicity pertaining to distribution of the software without specific,
26  written prior permission of DiSTI.
27 
28  Permission to modify the software is granted, but not the right to
29 distribute the source code whether modified, or non-modified. Modifying the
30 software might invalidate the DO-178B certification package.
31 
32  Permission to distribute binaries produced by compiling source code, or
33 modified source code is granted, provided you:
34  1. Provide your name and address as the primary contact for the support
35  of your modified version.
36  2. Retain our contact information in regard to use of the base software.
37 
38  DiSTI does not provide warranty for this software or guarantee that it
39 satisfies any specification or requirement unless otherwise stated in a
40 specific contractual arrangement between the customer and DiSTI.
41 
42 */
43 
44 #include "gls_include.h"
45 #include "gls_types.h"
46 #include "gls_class_invariant.h"
47 
48 /** Abstracts an array of pointers
49  * \invariant _pointers array is GLS_NULL if _count == 0, else non GLS_NULL if _count > 0
50  */
52 {
53 public:
55 
56  /** Constructor
57  * \param size number of pointers this array will hold
58  * \pre none
59  * \post array constructed and initialized to GLS_NULL
60  */
61  GlsPointerArray( const GlsUInt32 size );
62 
63  /** Destructor - shall never be called
64  * \pre none
65  * \post none
66  */
67  virtual ~GlsPointerArray();
68 
69  /** Get the number of pointers in the array
70  * \return number of pointers in the array
71  * \pre none
72  * \post none
73  */
74  GlsUInt32 GetSize( void ) const;
75 
76  /** Get a pointer in the array
77  * \param index index of desired pointer
78  * \return ref to pointer at given index
79  * \pre index < GetSize()
80  */
81  void* GetPointer( const GlsUInt32 index );
82 
83  /** Get a const pointer in the array
84  * \param index index of desired pointer
85  * \return ref to pointer at given index
86  * \pre index < GetSize()
87  */
88  const void* GetPointer( const GlsUInt32 index ) const;
89 
90  /** Set a pointer in the array
91  * \param index index of pointer to set
92  * \param src new value for pointer
93  * \pre index < GetSize()
94  * \post pointer at given index is set to src
95  */
96  void SetPointer( const GlsUInt32 index, void* const src );
97 
98 protected:
99  void** const _pointers; /**< array of pointers else GLS_NULL if count == 0 */
100  const GlsUInt32 _count; /**< number of pointers in pointers array */
101 
102 private:
103  // Disable implicit generated Members
104  GlsPointerArray& operator=( const GlsPointerArray &rhs );
105  GlsPointerArray( const GlsPointerArray &src );
106 };
107 
108 #endif // _GLS_POINTER_ARRAY_H
GlsUInt32 GetSize(void) const
This header defines a GLS_DEBUG only macro for facilitating evaluating class invariants in the GL Stu...
const GlsUInt32 _count
Definition: gls_pointer_array.h:100
Definition: gls_pointer_array.h:51
unsigned int GlsUInt32
Definition: gls_types.h:73
GlsPointerArray(const GlsUInt32 size)
This header defines any preprocessor defines needed to configure the GL Studio DO-178B Runtime Librar...
#define GLS_CLASS_INVARIANT_DECLARATION(ClassName)
Definition: gls_class_invariant.h:80
virtual ~GlsPointerArray()
void SetPointer(const GlsUInt32 index, void *const src)
void * GetPointer(const GlsUInt32 index)
This header defines the basic types used by the GL Studio DO-178B Runtime Library.
void **const _pointers
Definition: gls_pointer_array.h:99