F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
ObjBase.hpp
Go to the documentation of this file.
1 
13 #ifndef FW_OBJ_BASE_HPP
14 #define FW_OBJ_BASE_HPP
15 
16 #include <FpConfig.hpp>
17 
18 namespace Fw {
19 
20 #if FW_OBJECT_REGISTRATION == 1
21  class ObjRegistry;
22 #endif
23 
31 
32  class ObjBase {
33  public:
34 #if FW_OBJECT_NAMES == 1
35 
41  const char* getObjName();
42 
49  void setObjName(const char* name);
50 #if FW_OBJECT_TO_STRING == 1
51 
61  virtual void toString(char* str, NATIVE_INT_TYPE size);
62 #endif // FW_OBJECT_TO_STRING
63 #endif // FW_OBJECT_NAMES
64 
65 #if FW_OBJECT_REGISTRATION == 1
66 
76  static void setObjRegistry(ObjRegistry* reg);
77 #endif
78 
79  protected:
80 
81 #if FW_OBJECT_NAMES == 1
82  char m_objName[FW_OBJ_NAME_MAX_SIZE];
83 #endif
84 
91  ObjBase(const char* name);
92 
97  virtual ~ObjBase();
98 
104  void init();
105  private:
106 #if FW_OBJECT_REGISTRATION == 1
107  static ObjRegistry* s_objRegistry;
108 #endif
109  }; // ObjBase
110 
111 #if FW_OBJECT_REGISTRATION == 1
117  class ObjRegistry {
118  public:
119 
129  virtual void regObject(ObjBase* obj)=0;
130 
135  virtual ~ObjRegistry();
136  }; // ObjRegistry
137 #endif // FW_OBJECT_REGISTRATION
138 }
139 #endif // FW_OBJ_BASE_HPP
PlatformIntType NATIVE_INT_TYPE
Definition: BasicTypes.h:51
#define FW_OBJ_NAME_MAX_SIZE
Size of object name (if object names enabled). AC Limits to 80, truncation occurs above 80.
Definition: FpConfig.h:184
C++-compatible configuration header for fprime configuration.
Brief class description.
Definition: ObjBase.hpp:32
void init()
Object initializer.
Definition: ObjBase.cpp:27
virtual ~ObjBase()
Destructor.
Definition: ObjBase.cpp:35
ObjBase(const char *name)
ObjBase constructor.
Definition: ObjBase.cpp:22