Pyrogenesis  trunk
Macros
Component.h File Reference
#include "simulation2/system/CmpPtr.h"
#include "simulation2/system/Components.h"
#include "simulation2/system/ComponentManager.h"
#include "simulation2/system/IComponent.h"
#include "simulation2/system/ParamNode.h"
#include "simulation2/system/SimContext.h"
#include "simulation2/serialization/ISerializer.h"
#include "simulation2/serialization/IDeserializer.h"
Include dependency graph for Component.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define REGISTER_COMPONENT_TYPE(cname)
 
#define DEFAULT_COMPONENT_ALLOCATOR(cname)
 
#define DEFAULT_MOCK_COMPONENT()
 

Macro Definition Documentation

◆ DEFAULT_COMPONENT_ALLOCATOR

#define DEFAULT_COMPONENT_ALLOCATOR (   cname)
Value:
static IComponent* Allocate(const ScriptInterface&, JS::HandleValue) { return new CCmp##cname(); } \
static void Deallocate(IComponent* cmp) { delete static_cast<CCmp##cname*> (cmp); } \
int GetComponentTypeId() const override \
{ \
return CID_##cname; \
}
Definition: IComponent.h:32
std::shared_ptr< u8 > Allocate(size_t size)
Definition: shared_ptr.cpp:55
Abstraction around a SpiderMonkey JS::Realm.
Definition: ScriptInterface.h:71

◆ DEFAULT_MOCK_COMPONENT

#define DEFAULT_MOCK_COMPONENT ( )
Value:
int GetComponentTypeId() const override \
{ \
return -1; \
} \
void Init(const CParamNode& UNUSED(paramNode)) override \
{ \
} \
void Deinit() override \
{ \
} \
void Serialize(ISerializer& UNUSED(serialize)) override \
{ \
} \
void Deserialize(const CParamNode& UNUSED(paramNode), IDeserializer& UNUSED(deserialize)) override \
{ \
} \
An entity initialisation parameter node.
Definition: ParamNode.h:150
#define UNUSED(param)
mark a function parameter as unused and avoid the corresponding compiler warning. ...
Definition: code_annotation.h:38
Serialization interface; see serialization overview.
Definition: ISerializer.h:120
Definition: SerializeTemplates.h:63
bool Init(const CmdLineArgs &args, int flags)
Returns true if successful, false if mods changed and restart_engine was called.
Definition: GameSetup.cpp:525
Deserialization interface; see serialization overview.
Definition: IDeserializer.h:34

◆ REGISTER_COMPONENT_TYPE

#define REGISTER_COMPONENT_TYPE (   cname)
Value:
void RegisterComponentType_##cname(CComponentManager& mgr) \
{ \
IComponent::RegisterComponentType(mgr, CCmp##cname::GetInterfaceId(), CID_##cname, CCmp##cname::Allocate, CCmp##cname::Deallocate, #cname, CCmp##cname::GetSchema()); \
CCmp##cname::ClassInit(mgr); \
}
static void RegisterComponentType(CComponentManager &mgr, EInterfaceId iid, EComponentTypeId cid, AllocFunc alloc, DeallocFunc dealloc, const char *name, const std::string &schema)
Definition: IComponent.cpp:36
Definition: ComponentManager.h:39
std::shared_ptr< u8 > Allocate(size_t size)
Definition: shared_ptr.cpp:55