Emergency 20 Dokumentation  4.2.0
qsf::Object Class Reference

Object base class. More...

#include <Object.h>

Inheritance diagram for qsf::Object:
em5::EventHintParameters em5::FireMaterial em5::FreeplayEvent em5::FreeplayEventFactory em5::GameMode em5::GangsterType em5::Injury em5::multiplayer::HostEntry em5::OrderInfo em5::PersonAnimationController em5::TreatmentInformation em5::UnitPool em5::VisualVitalSigns qsf::Action qsf::ai::TrafficLaneWorldCreationSettings qsf::Application qsf::BaseAsset qsf::BaseAssetPackage qsf::BaseCachedAsset qsf::BaseProject qsf::editor::base::AssetCompilerConfig qsf::editor::base::Operation qsf::editor::base::OperationData qsf::editor::base::UserBase qsf::game::WeatherState qsf::InheritedObject qsf::Layer qsf::logic::Sequence qsf::logic::SequenceTrack qsf::logic::SequenceTrackKey qsf::Node qsf::PluginableBase qsf::Prototype qsf::Script qsf::ScriptBinding qsf::StreetEdge qsf::StreetGateway qsf::StreetGatewayLink

Public Types

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 }
 

Public Member Functions

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 Member Functions

 Object ()
 Default constructor. More...
 

Detailed Description

Object base class.

Remarks
Whenever you need a common base class for CAMP class instances, use "qsf::Object" as common base class. This means that an object is an instance of a (CAMP meta-)class, which is a common terminology in the literature. There's no need to derive each and every class connected to the CAMP reflection system from the "qsf::Object" class. Since "qsf::Object" offers additional ease-us-use features like reseting properties to their default values, most of our classes, connected to the CAMP reflection system, are derived from "qsf::Object".

Member Enumeration Documentation

Enumerator
PROPERTY_INVALID 

Property does not exist at all.

PROPERTY_DEFAULT 

Property uses an inherited or hard-coded default value.

PROPERTY_OVERRIDE 

Property uses a custom value overriding the default value; the value can be equal to the default nevertheless.

PROPERTY_REMOVED 

Property is defined by the inherited default, but was explicitly removed in this instance.

Enumerator
SERIALIZE_FLAT 

Serialize all serializable properties of the object, no matter if overridden or not; do not store the override state.

SERIALIZE_COMPLETE 

Serialize all serializable properties of the object, also store information about their override states.

SERIALIZE_DIFFERENTIAL 

Serialize only the overridden serializable properties of the object, ignore the others.

SERIALIZE_IGNORE_UNKNOWN 

Like SERIALIZE_FLAT, but ignore unknown properties when deserializing.

Enumerator
MODE_MINIMAL 

"Minimal" serialization: only values, no property names and types, or other meta-data

MODE_COMPATIBLE 

"Compatible" serialization: also serialize property names and value types

Constructor & Destructor Documentation

virtual qsf::Object::~Object ( )
virtual

Destructor.

qsf::Object::Object ( )
inlineprotected

Default constructor.

Note
  • There's no point in creating an instance of this base class

Member Function Documentation

void qsf::Object::deserializeFromBinarySerializer ( BinarySerializer serializer,
SerializationMode  mode = MODE_MINIMAL,
SerializationMethod  serializationMethod = SERIALIZE_DIFFERENTIAL,
bool  setOverrideState = true 
)
bool qsf::Object::deserializeFromBoostPTree ( const boost::property_tree::ptree pTree,
SerializationMethod  serializationMethod = SERIALIZE_DIFFERENTIAL 
)
bool qsf::Object::deserializeFromBoostPTree ( const boost::property_tree::ptree pTree,
const camp::Class &  campClass,
SerializationMethod  serializationMethod = SERIALIZE_DIFFERENTIAL 
)
virtual Script* qsf::Object::getAssociatedScript ( ) const
virtual

Return the script instance associated with this object instance.

Returns
The script instance associated with this object instance, can be a null pointer, do not destroy the instance
Note
  • The default implementation is empty and always returns a null pointer

Reimplemented in qsf::ScriptComponent, qsf::game::ScriptCommand, and qsf::ScriptAction.

const camp::Class& qsf::Object::getCampClass ( ) const

Return the CAMP class.

const camp::Property* qsf::Object::getCampPropertyById ( const StringHash propertyId) const

Return the CAMP property by using the unique class property ID.

Parameters
[in]propertyIdUnique class property ID of the CAMP property to return
Returns
CAMP property, null pointer on error, do not destroy the instance
See also
  • "qsf::Object::getPropertyIndexById()"
virtual camp::Value qsf::Object::getPropertyDefaultValue ( const StringHash propertyId) const
virtual

Reimplemented in qsf::InheritedObject.

uint32 qsf::Object::getPropertyIdByIndex ( int  index) const

Return the unique class property ID with the given index.

Parameters
[in]indexProperty index, negative value on error
Returns
Unique class property ID the CAMP property for which to return its index
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)
  • Don't use this method in highly performance critical situations
int qsf::Object::getPropertyIndexById ( const StringHash propertyId) const

Return the CAMP property index by using the unique class property ID.

Parameters
[in]propertyIdUnique class property ID the CAMP property for which to return its index
Returns
CAMP property index, negative value on error
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)
  • Don't use this method in highly performance critical situations
std::string qsf::Object::getPropertyNameById ( const StringHash propertyId) const

Return the CAMP property name by using the unique class property ID.

Parameters
[in]propertyIdUnique class property ID the CAMP property for which to return its name
Returns
CAMP property ASCII name, empty string on error
See also
  • "qsf::Object::getPropertyIndexById()"
virtual PropertyOverrideState qsf::Object::getPropertyOverrideState ( const StringHash propertyId) const
virtual

Reimplemented in qsf::InheritedObject.

void qsf::Object::onPostDeserialize ( )
inlinevirtual

Called right after the object was deserialized using any of the above methods. Default implementation is empty.

Reimplemented in qsf::editor::base::CreateEntityOperation, qsf::editor::base::DestroyEntityOperation, and qsf::editor::base::DestroyComponentOperation.

void qsf::Object::onPreDeserialize ( )
inlinevirtual

Called right before the object is deserialized using any of the above methods. Default implementation is empty.

Reimplemented in qsf::editor::base::CreateEntityOperation, qsf::editor::base::DestroyEntityOperation, and qsf::editor::base::DestroyComponentOperation.

void qsf::Object::serializeToBinarySerializer ( BinarySerializer serializer,
SerializationMode  mode = MODE_MINIMAL,
SerializationMethod  serializationMethod = SERIALIZE_DIFFERENTIAL 
) const
void qsf::Object::serializeToBoostPTree ( boost::property_tree::ptree pTree,
SerializationMethod  serializationMethod = SERIALIZE_DIFFERENTIAL 
) const
void qsf::Object::serializeToBoostPTree ( boost::property_tree::ptree pTree,
const camp::Class &  campClass,
SerializationMethod  serializationMethod = SERIALIZE_DIFFERENTIAL 
) const
void qsf::Object::setPropertiesToDefaultValues ( )

Set all CAMP reflection system properties to their default values.

Note
  • Don't use this method in highly performance critical situations
virtual bool qsf::Object::setPropertyOverrideState ( const StringHash propertyId,
PropertyOverrideState  overrideState 
)
virtual

Reimplemented in qsf::InheritedObject.

void qsf::Object::setPropertyValuesByString ( const std::string &  values)

Set CAMP reflection property values by using a given string.

Parameters
[in]valuesUTF-8 property values to set (e.g. "Name=\"Alice" Description="This is the test entity Alice"")
Note
  • Don't use this generic method in highly performance critical situations

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