INOS
cinoscontainer.h File Reference

CINOSContainer declaration file. More...

#include <inos.h>
#include <inos_lib.h>
#include <cinoseventlogger.h>
Include dependency graph for cinoscontainer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CINOSContainer< T >
 
class  CINOSContainerEntityRegister
 
class  CINCOConObject
 

Macros

#define ER_INOS_CONTAINER_OK   0x00000000
 
#define ER_INOS_CONTAINER_REJECTED   0x00000001
 
#define ER_INOS_CONTAINER_FAILED   0x00000002
 
#define ER_INOS_CONTAINER_TYPE_UNKNOWN   0x00000003
 
#define ER_INOS_CONTAINER_CHECK_FAILED   0x00000004
 
#define INOS_CONTAINER_CLASS(aClass, aType, aBase)
 
#define INOS_CONTAINER_CLASS_CHECK(aClass, aType, aBase)
 
#define INOS_CONTAINER_CLASS_MI(aClass, aBaseClass, aType, aBase)
 

Typedefs

typedef void *(* TCreateEntity) (const char *apName, const char *apParam)
 
typedef bool(* TCheckCheckTarget) (const char *apParam)
 

Functions

 IMPLEMENT_DYNAMIC_T (CINOSContainer, T)
 

Detailed Description

CINOSContainer declaration file.

Author
Ch. Hirzel
Remarks
project         : INFO-Link
language        : GNU C++
system          : INFO-PPC

Declaration of the CINOSContainer class that handles the base functionality of a container.

Macro Definition Documentation

◆ INOS_CONTAINER_CLASS

#define INOS_CONTAINER_CLASS (   aClass,
  aType,
  aBase 
)
Value:
void* Create##aClass(const char* apName, const char* apParam) \
{ return new aClass(apName, apParam);}; \
Definition cinoscontainer.h:220
Definition cinosmcmodule.h:1900

Used to register a container element class 'aClass'. Registering a class by this macro allows the creation of instances at runtime just by defining aType. E.g. new instances of aClass can be created at runtime by performing INCO calls.

Parameters
aClassThe class to instantiate
aTypeThe "name" of the class. This name must be passed when an instance of this class shall be created.
aBaseThe "base type" of this element class. The base type is used to make aClass part of a "family of classes". E.g. A concrete machine implementation, say "McRobotExample" specifies which "base classes" it allows to become modules of this machine. Therefore, the McRobotExample machine may define the string "McExBase". Then, a request to create an instance of a submodule for that machine, will only allow the creation of classes which's aBase matches "McExBase". Commonly used generic values are "StBase" and "McBase".

◆ INOS_CONTAINER_CLASS_CHECK

#define INOS_CONTAINER_CLASS_CHECK (   aClass,
  aType,
  aBase 
)
Value:
void* Create##aClass(const char* apName, const char* apParam) \
{ return new aClass(apName, apParam);}; \
static CINOSContainerEntityRegister l_##aClass##Create(Create##aClass, aType, aBase, &aClass::CheckTarget);

◆ INOS_CONTAINER_CLASS_MI

#define INOS_CONTAINER_CLASS_MI (   aClass,
  aBaseClass,
  aType,
  aBase 
)
Value:
template <typename T> \
void* Create##aClass(const char* apName, const char* apParam) \
/* cast to T* (not just void*) is important, if T* is not the first base class from which aClass derives. See http://stackoverflow.com/questions/2379427/multiple-inheritance-unexpected-result-after-cast-from-void-to-2nd-base-class */ \
{ return static_cast<T*>(new aClass(apName, apParam));}; \

Like INOS_CONTAINER_CLASS (see above), but for types using multiple inheritance. E.g. if aClass derives from more than one base class, it must be registered by this macro instead of INOS_CONTAINER_CLASS. Otherwise, the behavior when creating an object will be undefined and will usually result in a trap. Note that this macro can be used even if aClass doesn't use multiple inheritance.

Parameters
aBaseClassThe base class used by the container. E.g. CINOSMcRobot, CINOSMcModule, CINOSTaskEx, etc.