Emergency 2017 Dokumentation  v3.0.1
qsf::Prototype Class Reference

Prototype class. More...

#include <Prototype.h>

Public Member Functions

virtual ~Prototype ()
 Destructor. More...
 
uint64 getId () const
 Return the unique prototype identifier. More...
 
BasePrototypeManagergetPrototypeManager () const
 Return the prototype manager this prototype is in. More...
 
ComponentManagergetComponentManager () const
 Return the component manager that's responsible for this component instance. More...
 
void reserveComponents (size_t numberOfComponents)
 Reserve components. More...
 
template<typename T >
T * createComponent (bool startup=true)
 Create an instance of a component of a certain type. More...
 
ComponentcreateComponentById (const StringHash &id, bool startup=true)
 Create an instance of a component by using its unique identifier. More...
 
ComponentcreateComponentByCampClass (const camp::Class &campClass, bool startup=true)
 Create an instance of a component by using a given CAMP reflection class. More...
 
template<typename T >
T * createComponentWithValues (const std::string &values, bool startup=true)
 Create an instance of a component of a certain type and set component property values at once. More...
 
ComponentcreateComponentByIdWithValues (const StringHash &id, const std::string &values, bool startup=true)
 Create an instance of a component by using its unique identifier and set component property values at once. More...
 
ComponentcreateComponentByCampClassWithValues (const camp::Class &campClass, const std::string &values, bool startup=true)
 Create an instance of a component by using a given CAMP reflection class and set component property values at once. More...
 
bool destroyComponent (Component &component)
 Destroy a component instance. More...
 
template<typename T >
bool destroyComponent ()
 Destroy a component instance of a certain type. More...
 
bool destroyComponentById (const StringHash &id)
 Destroy a component instance by using its unique identifier. More...
 
bool destroyComponentByCampClass (const camp::Class &campClass)
 Destroy a component instance by using a given CAMP reflection class. More...
 
void destroyAllComponents ()
 Destroy all components within this prototype. More...
 
template<typename T >
T * getComponent () const
 Return a component instance of a certain type. More...
 
template<typename T >
T & getComponentSafe () const
 Return a component instance of a certain type. More...
 
ComponentgetComponentById (const StringHash &id) const
 Return a component instance pointer by using its unique identifier. More...
 
ComponentgetComponentByCampClass (const camp::Class &campClass) const
 Return a component instance by using a given CAMP reflection class. More...
 
template<typename T >
T * getOrCreateComponent (bool startup=true)
 Return a component instance of a certain type, creates an component instance in case it does not exist. More...
 
ComponentgetOrCreateComponentById (const StringHash &id, bool startup=true)
 Return a component instance by using its unique identifier, creates an component instance in case it does not exist. More...
 
ComponentgetOrCreateComponentByCampClass (const camp::Class &campClass, bool startup=true)
 Return a component instance by using a given CAMP reflection class, creates an component instance in case it does not exist. More...
 
template<typename T >
T & getOrCreateComponentSafe (bool startup=true)
 Return a component instance of a certain type, creates a component instance in case it does not exist. More...
 
ComponentcloneComponent (const Component &sourceComponent, bool startup=true, bool copyOverrideState=false)
 Clone a component from a another one. More...
 
ComponentgetConflictingRegisteredComponent (uint32 componentId) const
 Check whether a component or a conflicting component is registered already, including base classes (except "qsf::Component") More...
 
const std::vector< Component * > & getComponents () const
 Return the component list. More...
 
void setComponentPropertiesToDefaultValues ()
 Set all CAMP reflection system properties of all components to their default values. More...
 
PrototypegetBasePrototype () const
 Return the base prototype this prototype inherits default values for its properties from. More...
 
bool isEntity () const
 Return whether or not this is an entity. More...
 
bool getIgnorePropertyChanges () const
 
void setIgnorePropertyChanges (bool ignorePropertyChanges)
 
void serializeStructure (BinarySerializer &serializer)
 Serialize or deserialize the prototype's list of components (but not their content) using a binary serializer. More...
 
void serializeContent (BinarySerializer &serializer)
 Serialize or deserialize the prototype's components using a binary serializer. More...
 
void cloneComponentsFrom (const Prototype &originalPrototype, bool copyOverrideState)
 Clone all components of another prototype. More...
 
uint8 getComponentChangesCount () const
 
- Public Member Functions inherited from qsf::Object
virtual ~Object ()
 Destructor. More...
 
const camp::Class & getCampClass () const
 Return the CAMP class. More...
 
int getPropertyIndexById (const StringHash &propertyId) const
 Return the CAMP property index by using the unique class property ID. More...
 
uint32 getPropertyIdByIndex (int index) const
 Return the unique class property ID with the given index. More...
 
std::string getPropertyNameById (const StringHash &propertyId) const
 Return the CAMP property name by using the unique class property ID. More...
 
const camp::Property * getCampPropertyById (const StringHash &propertyId) const
 Return the CAMP property by using the unique class property ID. More...
 
void setPropertyValuesByString (const std::string &values)
 Set CAMP reflection property values by using a given string. More...
 
void setPropertiesToDefaultValues ()
 Set all CAMP reflection system properties to their default values. More...
 
void serializeToBoostPTree (boost::property_tree::ptree &pTree, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
void serializeToBoostPTree (boost::property_tree::ptree &pTree, const camp::Class &campClass, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
bool deserializeFromBoostPTree (const boost::property_tree::ptree &pTree, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL)
 
bool deserializeFromBoostPTree (const boost::property_tree::ptree &pTree, const camp::Class &campClass, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL)
 
void serializeToBinarySerializer (BinarySerializer &serializer, SerializationMode mode=MODE_MINIMAL, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
void deserializeFromBinarySerializer (BinarySerializer &serializer, SerializationMode mode=MODE_MINIMAL, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL, bool setOverrideState=true)
 
virtual camp::Value getPropertyDefaultValue (const StringHash &propertyId) const
 
virtual PropertyOverrideState getPropertyOverrideState (const StringHash &propertyId) const
 
virtual bool setPropertyOverrideState (const StringHash &propertyId, PropertyOverrideState overrideState)
 
virtual void onPreDeserialize ()
 Called right before the object is deserialized using any of the above methods. Default implementation is empty. More...
 
virtual void onPostDeserialize ()
 Called right after the object was deserialized using any of the above methods. Default implementation is empty. More...
 
virtual ScriptgetAssociatedScript () const
 Return the script instance associated with this object instance. More...
 

Protected Types

enum  Flags { ENTITY = 1<<0, SERIALIZABLE = 1<<1, IGNORE_PROPERTY_CHANGES = 1<<2 }
 Prototype flags. More...
 
typedef BitFlagSet< uint8, FlagsFlagSet
 
typedef std::vector< Component * > ComponentList
 
typedef std::unordered_map< uint32, Component * > ComponentMap
 

Protected Member Functions

 Prototype (uint64 id, BasePrototypeManager &manager)
 Constructor. More...
 
void registerComponent (Component &component)
 Register the given component. More...
 
void onComponentPropertyChange (Component &component, uint32 propertyId)
 Called in case a component property value was changed. More...
 
void onComponentTransformChange (TransformComponent &transformComponent, const Transform &transform, uint8 flags)
 React to component transform changes. More...
 
- Protected Member Functions inherited from qsf::Object
 Object ()
 Default constructor. More...
 
- Protected Member Functions inherited from qsf::WeakPtrTarget
 WeakPtrTarget ()
 Default constructor. More...
 
 WeakPtrTarget (const WeakPtrTarget &other)
 Copy constructor. More...
 
 WeakPtrTarget (WeakPtrTarget &&)=delete
 Delete the move constructor, as WeakPtrTarget would need a proper move constructor-implementation that ensures that its pointer gets updated in the WeakPtrBase as well. More...
 
 ~WeakPtrTarget ()
 Destructor. More...
 
void invalidateAllWeakPtr ()
 Invalidate all weak pointers to this object. More...
 
void operator= (const WeakPtrTarget &other)
 Copy operator. More...
 

Protected Attributes

uint64 mId
 The unique prototype identifier inside the associated manager. More...
 
BasePrototypeManagermManager
 The manager this prototype is registered in. More...
 
ComponentList mComponentList
 Component list. More...
 
ComponentMap mComponentMap
 Component map with unique component identifier as key and pointer to the component as value. More...
 
ComponentList mListenerComponents
 List of components that can be listeners to component property changes (see "onComponentPropertyChange") More...
 
FlagSet mFlags
 Internal flags, see "qsf::Prototype::Flags". More...
 
uint8 mComponentChangesCount
 An "counter" which is used to "track" if any changes to the component list (add/remove) where done. More...
 

Friends

class Component
 
class TransformComponent
 
class PrototypeManager
 
class BasePrototypeManager
 
class Layer
 

Additional Inherited Members

- Public Types inherited from qsf::Object
enum  PropertyOverrideState { PROPERTY_INVALID, PROPERTY_DEFAULT, PROPERTY_OVERRIDE, PROPERTY_REMOVED }
 
enum  SerializationMethod { SERIALIZE_FLAT, SERIALIZE_COMPLETE, SERIALIZE_DIFFERENTIAL, SERIALIZE_IGNORE_UNKNOWN }
 
enum  SerializationMode { MODE_MINIMAL, MODE_COMPATIBLE }
 

Detailed Description

Prototype class.

Remarks
The following example shows how to get the instance of a certain component:
// qsf::Prototype* prototype ...
qsf::MetadataComponent* qsfMetadataComponent = prototype->getComponent<qsf::MetadataComponent>();
Beside this template method, one can also write:
// qsf::Prototype* prototype ...
qsf::MetadataComponent* qsfMetadataComponent = static_cast<qsf::MetadataComponent*>(prototype->getComponentById("qsf::MetadataComponent"))
In this case, the unique component identifier is automatically generated by using the "qsf::StringHash"-class for compile-time string hashing. This means that usually there should be no performance drawback in using human readable identifiers instead of the hash result directly as in
// qsf::Prototype* prototype ...
qsf::MetadataComponent* qsfMetadataComponent = static_cast<qsf::MetadataComponent*>(prototype->getComponentById(483975945))
// qsf::Prototype* prototype ...
qsf::MetadataComponent* qsfMetadataComponent = static_cast<qsf::MetadataComponent*>(prototype->getComponentById(483975945))

In case the component is derived from another component, it's also possible to get the component by using the base component ID within the request. "qsf::Component" is excluded from this. For example, "qsf::MeshComponent" also registers itself under "qsf::RendererComponent". As a result, when there's e.g. an "qsf::MeshComponent" component instance, it's not possible to add another renderer component like "qsf::ParticlesComponent".

Note
  • A prototype is just a collection of components
  • "Prefabs" are formed by linking prototypes together
  • A prefab can be identical to a prototype, or consist of multiple prototypes linked together in order to form a more complex structure
  • The order of the component instances inside the prototype does not matter
  • There can only be one instance of each component class at one and the same time
  • The prototype is resonsible for creating and destroying it's component instances, no one else
  • For performance reasons, during runtime components should only be addressed by using the unique component class identifiers
  • This class is using the prototype design pattern as described within the book "Gamma, Erich; Helm, Richard; Johnson, Ralph; Vlissides, John (1994). Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley. ISBN 0-201-63361-2."
Todo:
  • TODO(co) Is the current implementation sufficient, or do we need something more sophisticated like the system described within the article "Managing Decoupling Part 4 The ID Lookup Table" from Niklas Frykholm? ( http://bitsquid.blogspot.de/2011/09/managing-decoupling-part-4-id-lookup.html )
  • TODO(co) We could also add a "system" per "component" taking care of efficient memory management of component instances. This way we could reduce frequent new/delete when creating/destroying component instances.

Definition at line 100 of file Prototype.h.

Member Typedef Documentation

typedef std::vector<Component*> qsf::Prototype::ComponentList
protected

Definition at line 652 of file Prototype.h.

typedef std::unordered_map<uint32, Component*> qsf::Prototype::ComponentMap
protected

Definition at line 653 of file Prototype.h.

Definition at line 650 of file Prototype.h.

Member Enumeration Documentation

enum qsf::Prototype::Flags
protected

Prototype flags.

Enumerator
ENTITY 

This flag indicates that the prototype is in fact an entity.

SERIALIZABLE 

This flag indicates that the prototype is serializable; does not make conceptional sense for prototypes and therefore the flag getter and setter are defined in the entity class.

IGNORE_PROPERTY_CHANGES 

If set, component property changes are not passed to the components, but simply ignored.

Definition at line 644 of file Prototype.h.

Constructor & Destructor Documentation

virtual qsf::Prototype::~Prototype ( )
virtual

Destructor.

Note
  • Do never destroy a prototype manually, use "qsf::PrototypeManager::destroyPrototypeById()" instead
qsf::Prototype::Prototype ( uint64  id,
BasePrototypeManager manager 
)
inlineprotected

Constructor.

Parameters
[in]idThe unique prototype identifier
[in]managerThe manager this prototype is in
Note
  • Use "qsf::PrototypeManager::createPrototypeById()" to create a prototype instance

Definition at line 126 of file Prototype-inl.h.

Member Function Documentation

Component* qsf::Prototype::cloneComponent ( const Component sourceComponent,
bool  startup = true,
bool  copyOverrideState = false 
)

Clone a component from a another one.

Parameters
[in]sourceComponentThe original component that will be cloned
[in]startupStartup the created component instance?
[in]copyOverrideStateIf "true", the component properties' override flags will be copied as well
Returns
The created component, or a null pointer on error
void qsf::Prototype::cloneComponentsFrom ( const Prototype originalPrototype,
bool  copyOverrideState 
)

Clone all components of another prototype.

Parameters
[in]originalPrototypeThe prototype instance that will be cloned
[in]copyOverrideStateIf "true", the component properties' override flags will be copied as well
Note
  • Existing components in this prototype will be deleted first
  • For every component in the original prototype, a cloned component will be created in this prototype
  • The newly created components will not be started (via startup() method)
template<typename T >
T * qsf::Prototype::createComponent ( bool  startup = true)

Create an instance of a component of a certain type.

Parameters
[in]startupStartup the created component instance?
Returns
The created component instance, null pointer on error (maybe the component exists?), do not destroy the returned instance and do not keep a reference to it outside the C runtime stack (use the unique component ID instead)
Note
  • Before creating a new component instance, you might want to check whether or not there's already an instance of this component

Definition at line 43 of file Prototype-inl.h.

Component* qsf::Prototype::createComponentByCampClass ( const camp::Class &  campClass,
bool  startup = true 
)

Create an instance of a component by using a given CAMP reflection class.

Parameters
[in]campClassCAMP reflection class of the component to instantiate
[in]startupStartup the created component instance?
Returns
The created component instance, null pointer on error (maybe the component exists?), do not destroy the returned instance and do not keep a reference to it outside the C runtime stack (use the unique component ID instead)
Note
  • Before creating a new component instance, you might want to check whether or not there's already an instance of this component
Component* qsf::Prototype::createComponentByCampClassWithValues ( const camp::Class &  campClass,
const std::string &  values,
bool  startup = true 
)

Create an instance of a component by using a given CAMP reflection class and set component property values at once.

Parameters
[in]campClassCAMP reflection class of the component to instantiate
[in]valuesUTF-8 property values to set (e.g. "Name=\"Alice" Description="This is the test entity Alice"")
[in]startupStartup the created component instance?
Returns
The created component instance, null pointer on error (maybe the component exists?), do not destroy the returned instance and do not keep a reference to it outside the C runtime stack (use the unique component ID instead)
Note
  • Before creating a new component instance, you might want to check whether or not there's already an instance of this component
  • Don't use this generic method in highly performance critical situations
Component * qsf::Prototype::createComponentById ( const StringHash id,
bool  startup = true 
)
inline

Create an instance of a component by using its unique identifier.

Parameters
[in]idThe unique component identifier generated by "qsf::StringHash"
[in]startupStartup the created component instance?
Returns
The created component instance, null pointer on error (maybe the component exists?), do not destroy the returned instance and do not keep a reference to it outside the C runtime stack (use the unique component ID instead)
Note
  • Before creating a new component instance, you might want to check whether or not there's already an instance of this component

Definition at line 38 of file Prototype-inl.h.

Component * qsf::Prototype::createComponentByIdWithValues ( const StringHash id,
const std::string &  values,
bool  startup = true 
)
inline

Create an instance of a component by using its unique identifier and set component property values at once.

Parameters
[in]idThe unique component identifier generated by "qsf::StringHash"
[in]valuesUTF-8 property values to set (e.g. "Name=\"Alice" Description="This is the test entity Alice"")
[in]startupStartup the created component instance?
Returns
The created component instance, null pointer on error (maybe the component exists?), do not destroy the returned instance and do not keep a reference to it outside the C runtime stack (use the unique component ID instead)
Note
  • Before creating a new component instance, you might want to check whether or not there's already an instance of this component
  • Don't use this generic method in highly performance critical situations

Definition at line 48 of file Prototype-inl.h.

template<typename T >
T * qsf::Prototype::createComponentWithValues ( const std::string &  values,
bool  startup = true 
)

Create an instance of a component of a certain type and set component property values at once.

Parameters
[in]valuesUTF-8 property values to set (e.g. "Name=\"Alice" Description="This is the test entity Alice"")
[in]startupStartup the created component instance?
Returns
The created component instance, null pointer on error (maybe the component exists?), do not destroy the returned instance and do not keep a reference to it outside the C runtime stack (use the unique component ID instead)
Note
  • Before creating a new component instance, you might want to check whether or not there's already an instance of this component
  • Don't use this generic method in highly performance critical situations

Definition at line 53 of file Prototype-inl.h.

void qsf::Prototype::destroyAllComponents ( )

Destroy all components within this prototype.

bool qsf::Prototype::destroyComponent ( Component component)

Destroy a component instance.

Parameters
[in]componentThe component to destroy
Returns
"true" if all went fine, "false" if component was not part of this prototype
template<typename T >
bool qsf::Prototype::destroyComponent ( )

Destroy a component instance of a certain type.

Returns
"true" if component was successfully destroyed, "false" if component of the given type was not present in this prototype

Definition at line 58 of file Prototype-inl.h.

bool qsf::Prototype::destroyComponentByCampClass ( const camp::Class &  campClass)

Destroy a component instance by using a given CAMP reflection class.

Parameters
[in]campClassCAMP reflection class of the component to destroy
Returns
"true" if all went fine, else "false" (unknown component identifier?)
Note
bool qsf::Prototype::destroyComponentById ( const StringHash id)

Destroy a component instance by using its unique identifier.

Parameters
[in]idThe unique component identifier generated by "qsf::StringHash"
Returns
"true" if component was successfully destroyed, "false" if component of the given type was not present in this prototype
Prototype* qsf::Prototype::getBasePrototype ( ) const

Return the base prototype this prototype inherits default values for its properties from.

Returns
The prototype this prototype was originally cloned from; can be a null pointer, do no destroy the returned instance
template<typename T >
T * qsf::Prototype::getComponent ( ) const

Return a component instance of a certain type.

Returns
The requested component instance, null pointer on error, do no destroy the returned instance

Definition at line 63 of file Prototype-inl.h.

Component* qsf::Prototype::getComponentByCampClass ( const camp::Class &  campClass) const

Return a component instance by using a given CAMP reflection class.

Parameters
[in]campClassCAMP reflection class of the component to return
Returns
The requested component instance, null pointer on error, do no destroy the returned instance
Note
Component * qsf::Prototype::getComponentById ( const StringHash id) const
inline

Return a component instance pointer by using its unique identifier.

Parameters
[in]idThe unique component identifier generated by "qsf::StringHash"
Returns
The requested component instance, null pointer on error, do no destroy the returned instance

Definition at line 76 of file Prototype-inl.h.

uint8 qsf::Prototype::getComponentChangesCount ( ) const
inline

Definition at line 117 of file Prototype-inl.h.

ComponentManager& qsf::Prototype::getComponentManager ( ) const

Return the component manager that's responsible for this component instance.

Returns
The component manager; do not destroy the returned instance
const std::vector< Component * > & qsf::Prototype::getComponents ( ) const
inline

Return the component list.

Returns
Reference to the internal component list, do not manipulate the list or destroy the components

Definition at line 94 of file Prototype-inl.h.

template<typename T >
T & qsf::Prototype::getComponentSafe ( ) const

Return a component instance of a certain type.

Returns
The requested component instance
Note
  • In case the instance did not exist and could not be created, this method will throw an exception

Definition at line 69 of file Prototype-inl.h.

Component* qsf::Prototype::getConflictingRegisteredComponent ( uint32  componentId) const

Check whether a component or a conflicting component is registered already, including base classes (except "qsf::Component")

Parameters
[in]componentIdID of the component to check (e.g. qsf::StringHash("qsf::MetadataComponent") generating the hash value 483975945)
Returns
In case the component is registered already, the registered component instance is returned, or a null pointer if the component is not registered
Note
  • For example "qsf::MeshComponent" also registers itself under "qsf::RendererComponent"
  • The same is true for "qsf::LightComponent", which would conflict with "qsf::MeshComponent" for that reason
uint64 qsf::Prototype::getId ( ) const
inline

Return the unique prototype identifier.

Returns
The unique prototype identifier
Note
  • Connected to the CAMP reflection system

Definition at line 20 of file Prototype-inl.h.

bool qsf::Prototype::getIgnorePropertyChanges ( ) const
inline

Definition at line 104 of file Prototype-inl.h.

template<typename T >
T * qsf::Prototype::getOrCreateComponent ( bool  startup = true)

Return a component instance of a certain type, creates an component instance in case it does not exist.

Parameters
[in]startupStartup the created component instance?
Returns
The requested component instance, null pointer on error, do no destroy the returned instance
Note
  • This is only an ease of use method, avoid using it if you can and use "qsf::Component::createComponentById()" instead

Definition at line 82 of file Prototype-inl.h.

Component* qsf::Prototype::getOrCreateComponentByCampClass ( const camp::Class &  campClass,
bool  startup = true 
)

Return a component instance by using a given CAMP reflection class, creates an component instance in case it does not exist.

Parameters
[in]campClassCAMP reflection class of the component to return or create
[in]startupStartup the created component instance?
Returns
The requested component instance, null pointer on error, do no destroy the returned instance
Note
Component* qsf::Prototype::getOrCreateComponentById ( const StringHash id,
bool  startup = true 
)

Return a component instance by using its unique identifier, creates an component instance in case it does not exist.

Parameters
[in]idThe unique component identifier generated by "qsf::StringHash"
[in]startupStartup the created component instance?
Returns
The requested component instance, null pointer on error, do no destroy the returned instance
Note
  • This is only an ease of use method, avoid using it if you can and use "qsf::Component::getComponentById()" instead
template<typename T >
T & qsf::Prototype::getOrCreateComponentSafe ( bool  startup = true)

Return a component instance of a certain type, creates a component instance in case it does not exist.

Parameters
[in]startupStartup the created component instance?
Returns
The requested component instance as a reference, do no destroy the returned instance
Note
  • This is only an ease of use method, avoid using it if you can and use "qsf::Component::createComponentById()" instead
  • In case the instance did not exist and could not be created, this method will throw an exception

Definition at line 87 of file Prototype-inl.h.

BasePrototypeManager & qsf::Prototype::getPrototypeManager ( ) const
inline

Return the prototype manager this prototype is in.

Returns
The prototype manager this prototype is in, do no destroy the returned instance

Definition at line 25 of file Prototype-inl.h.

bool qsf::Prototype::isEntity ( ) const
inline

Return whether or not this is an entity.

Returns
Returns true if this prototype is of the entity sub-class, false if not

Definition at line 99 of file Prototype-inl.h.

void qsf::Prototype::onComponentPropertyChange ( Component component,
uint32  propertyId 
)
protected

Called in case a component property value was changed.

Parameters
[in]componentComponent instance which had a property value change
[in]propertyIdUnique class property ID the component property which values was changed
Note
  • The unique class property identifier is generated by "qsf::StringHash" by using the class property name (e.g. qsf::StringHash("Position") generating the hash value 3091144222)
void qsf::Prototype::onComponentTransformChange ( TransformComponent transformComponent,
const Transform transform,
uint8  flags 
)
protected

React to component transform changes.

Parameters
[in]transformComponentThe transform component holding the changes transformation
[in]transformThe changed transform
[in]flagsFlags describing the change, see "qsf::Component::TransformChangeFlag"
void qsf::Prototype::registerComponent ( Component component)
protected

Register the given component.

Parameters
[in]componentComponent to register
Note
  • Does not check whether or not the component is already registered
  • Also registeres the component under the base class IDs down to "qsf::Component" (but not "qsf::Component" itself), for example "qsf::MeshComponent" also registers itself under "qsf::RendererComponent"
void qsf::Prototype::reserveComponents ( size_t  numberOfComponents)
inline

Reserve components.

Parameters
[in]numberOfComponentsNumber of components to reserve
Note
  • You might want to reserve components before starting an insertion of component masses (performance)

Definition at line 32 of file Prototype-inl.h.

void qsf::Prototype::serializeContent ( BinarySerializer serializer)

Serialize or deserialize the prototype's components using a binary serializer.

Parameters
[in]serializerThe serializer, which can be either in read or write mode
void qsf::Prototype::serializeStructure ( BinarySerializer serializer)

Serialize or deserialize the prototype's list of components (but not their content) using a binary serializer.

Parameters
[in]serializerThe serializer, which can be either in read or write mode
void qsf::Prototype::setComponentPropertiesToDefaultValues ( )

Set all CAMP reflection system properties of all components to their default values.

Note
  • Don't use this method in highly performance critical situations
void qsf::Prototype::setIgnorePropertyChanges ( bool  ignorePropertyChanges)
inline

Definition at line 109 of file Prototype-inl.h.

Friends And Related Function Documentation

friend class BasePrototypeManager
friend

Definition at line 110 of file Prototype.h.

friend class Component
friend

Definition at line 107 of file Prototype.h.

friend class Layer
friend

Definition at line 111 of file Prototype.h.

friend class PrototypeManager
friend

Definition at line 109 of file Prototype.h.

friend class TransformComponent
friend

Definition at line 108 of file Prototype.h.

Member Data Documentation

uint8 qsf::Prototype::mComponentChangesCount
protected

An "counter" which is used to "track" if any changes to the component list (add/remove) where done.

Definition at line 666 of file Prototype.h.

ComponentList qsf::Prototype::mComponentList
protected

Component list.

Definition at line 662 of file Prototype.h.

ComponentMap qsf::Prototype::mComponentMap
protected

Component map with unique component identifier as key and pointer to the component as value.

Definition at line 663 of file Prototype.h.

FlagSet qsf::Prototype::mFlags
protected

Internal flags, see "qsf::Prototype::Flags".

Definition at line 665 of file Prototype.h.

uint64 qsf::Prototype::mId
protected

The unique prototype identifier inside the associated manager.

Definition at line 660 of file Prototype.h.

ComponentList qsf::Prototype::mListenerComponents
protected

List of components that can be listeners to component property changes (see "onComponentPropertyChange")

Definition at line 664 of file Prototype.h.

BasePrototypeManager* qsf::Prototype::mManager
protected

The manager this prototype is registered in.

Definition at line 661 of file Prototype.h.


The documentation for this class was generated from the following files: