| ## Public API Reference

- Main Page
- Classes
- Files

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# iCelPropertyClass Struct Reference

This is a property class for an entity. More...

`#include <physicallayer/propclas.h>`

List of all members.

## Public Member Functions
virtual bool | AddPropertyChangeCallback (iCelPropertyChangeCallback *cb)=0
| Add a callback which will be fired when a property changes.
virtual iCelEntity * | GetEntity ()=0
| Get the parent entity associated with this property class.
virtual const char * | GetName () const =0
| Get the name of this property class.
virtual csPtr< iCelDataBuffer > | GetPersistentData (celPersistenceType persistence_type)=0
| Return the persistent data of this property class.
virtual size_t | GetPropertyAndActionCount () const =0
| Return the number of supported properties and actions.
virtual bool | GetPropertyBool (csStringID propertyID)=0
| Get a property as bool.
virtual bool | GetPropertyColor (csStringID propertyID, csColor &v)=0
| Get a property as a color.
virtual iCelEntity * | GetPropertyEntity (csStringID propertyID)=0
| Get a property as entity.
virtual float | GetPropertyFloat (csStringID propertyID)=0
| Get a property as float.
virtual iBase * | GetPropertyIBase (csStringID propertyID)=0
| Get a property as iBase.
virtual long | GetPropertyLong (csStringID propertyID)=0
| Get a property as long.
virtual const char * | GetPropertyOrActionDescription (csStringID)=0
| Get the description of the given property or action.
virtual csStringID | GetPropertyOrActionID (size_t i)=0
| Get the ID of the given property or action.
virtual celDataType | GetPropertyOrActionType (csStringID propertyID)=0
| Get the type of the given property or action.
virtual iCelPropertyClass * | GetPropertyPClass (csStringID propertyID)=0
| Get a property as property class.
virtual const char * | GetPropertyString (csStringID propertyID)=0
| Get a property as string.
virtual bool | GetPropertyVector (csStringID propertyID, csVector3 &v)=0
| Get a property as a 3D vector.
virtual bool | GetPropertyVector (csStringID propertyID, csVector2 &v)=0
| Get a property as a 2D vector.
virtual const char * | GetTag () const =0
| Get the tag of this property class or return 0 if there is no tag.
virtual bool | IsPropertyReadOnly (csStringID propertyID)=0
| Return true if a property is read-only.
virtual bool | Load (iCelDataBuffer *databuf)=0
| Load this object from a data buffer.
virtual bool | LoadFirstPass (iCelDataBuffer *databuf)=0
| Load this object from a data buffer.
virtual bool | PerformAction (csStringID actionID, iCelParameterBlock *params, celData &ret)=0
| Perform an action with a generic string parameter.
virtual void | PropertyClassesHaveChanged ()=0
| This method is called by the parent entity when there is a change in property class setting.
virtual bool | RemovePropertyChangeCallback (iCelPropertyChangeCallback *cb)=0
| Remove a callback.
virtual csPtr< iCelDataBuffer > | Save ()=0
| Save this object to a data buffer.
virtual csPtr< iCelDataBuffer > | SaveFirstPass ()=0
| Save this object to a data buffer.
virtual void | SetEntity (iCelEntity *entity)=0
| Set the entity for this property class.
virtual celPersistenceResult | SetPersistentData (csTicks data_time, iCelDataBuffer *data, celPersistenceType persistence_type)=0
| Read the state of this property class from some persistent data.
virtual bool | SetProperty (csStringID propertyID, iBase *ibase)=0
| Set a generic property.
virtual bool | SetProperty (csStringID propertyID, iCelEntity *entity)=0
| Set a generic property.
virtual bool | SetProperty (csStringID propertyID, iCelPropertyClass *value)=0
| Set a generic property.
virtual bool | SetProperty (csStringID propertyID, const csColor &value)=0
| Set a generic property.
virtual bool | SetProperty (csStringID propertyID, const csVector3 &value)=0
| Set a generic property.
virtual bool | SetProperty (csStringID propertyID, const csVector2 &value)=0
| Set a generic property.
virtual bool | SetProperty (csStringID propertyID, const char *value)=0
| Set a generic property.
virtual bool | SetProperty (csStringID propertyID, bool value)=0
| Set a generic property.
virtual bool | SetProperty (csStringID propertyID, float value)=0
| Set a generic property.
virtual bool | SetProperty (csStringID propertyID, long value)=0
| Set a generic property.
virtual void | SetTag (const char *tagname)=0
| Set the optional tag of this property class.

## Detailed Description

This is a property class for an entity.

A property class describe physical attributes of an entity.

Definition at line 105 of file propclas.h.

## Member Function Documentation

virtual bool iCelPropertyClass::AddPropertyChangeCallback | ( | iCelPropertyChangeCallback * | cb | ) | `[pure virtual]`

Add a callback which will be fired when a property changes.

Not all property class implementations actually have properties. It is safe to call this function with the same callback (nothing will happen in that case and false will be returned). Otherwise this function will IncRef the callback.

virtual iCelEntity* iCelPropertyClass::GetEntity | ( |  | ) | `[pure virtual]`

Get the parent entity associated with this property class.

Referenced by celStandardLocalEntitySet::IsLocal().

virtual const char* iCelPropertyClass::GetName | ( |  | ) | const`[pure virtual]`

Get the name of this property class.

virtual csPtr<iCelDataBuffer> iCelPropertyClass::GetPersistentData | ( | celPersistenceType | persistence_type | ) | `[pure virtual]`

Return the persistent data of this property class.

Note: this function replaces the Save function.

virtual size_t iCelPropertyClass::GetPropertyAndActionCount | ( |  | ) | const`[pure virtual]`

Return the number of supported properties and actions.

virtual bool iCelPropertyClass::GetPropertyBool | ( | csStringID | propertyID | ) | `[pure virtual]`

Get a property as bool.

virtual bool iCelPropertyClass::GetPropertyColor | ( | csStringID | propertyID,
|  | csColor & | v |
| ) |  |  | `[pure virtual]`

Get a property as a color.

virtual iCelEntity* iCelPropertyClass::GetPropertyEntity | ( | csStringID | propertyID | ) | `[pure virtual]`

Get a property as entity.

virtual float iCelPropertyClass::GetPropertyFloat | ( | csStringID | propertyID | ) | `[pure virtual]`

Get a property as float.

virtual iBase* iCelPropertyClass::GetPropertyIBase | ( | csStringID | propertyID | ) | `[pure virtual]`

Get a property as iBase.

virtual long iCelPropertyClass::GetPropertyLong | ( | csStringID | propertyID | ) | `[pure virtual]`

Get a property as long.

virtual const char* iCelPropertyClass::GetPropertyOrActionDescription | ( | csStringID |  | ) | `[pure virtual]`

Get the description of the given property or action.

virtual csStringID iCelPropertyClass::GetPropertyOrActionID | ( | size_t | i | ) | `[pure virtual]`

Get the ID of the given property or action.

virtual celDataType iCelPropertyClass::GetPropertyOrActionType | ( | csStringID | propertyID | ) | `[pure virtual]`

Get the type of the given property or action.

Returns CEL_DATA_NONE if property is not supported. Only the following types are supported:

- CEL_DATA_LONG
- CEL_DATA_FLOAT
- CEL_DATA_BOOL
- CEL_DATA_STRING
- CEL_DATA_VECTOR2
- CEL_DATA_VECTOR3
- CEL_DATA_COLOR
- CEL_DATA_ACTION
- CEL_DATA_PCLASS
- CEL_DATA_ENTITY

virtual iCelPropertyClass* iCelPropertyClass::GetPropertyPClass | ( | csStringID | propertyID | ) | `[pure virtual]`

Get a property as property class.

virtual const char* iCelPropertyClass::GetPropertyString | ( | csStringID | propertyID | ) | `[pure virtual]`

Get a property as string.

virtual bool iCelPropertyClass::GetPropertyVector | ( | csStringID | propertyID,
|  | csVector3 & | v |
| ) |  |  | `[pure virtual]`

Get a property as a 3D vector.

virtual bool iCelPropertyClass::GetPropertyVector | ( | csStringID | propertyID,
|  | csVector2 & | v |
| ) |  |  | `[pure virtual]`

Get a property as a 2D vector.

virtual const char* iCelPropertyClass::GetTag | ( |  | ) | const`[pure virtual]`

Get the tag of this property class or return 0 if there is no tag.

virtual bool iCelPropertyClass::IsPropertyReadOnly | ( | csStringID | propertyID | ) | `[pure virtual]`

Return true if a property is read-only.

virtual bool iCelPropertyClass::Load | ( | iCelDataBuffer * | databuf | ) | `[pure virtual]`

Load this object from a data buffer.

virtual bool iCelPropertyClass::LoadFirstPass | ( | iCelDataBuffer * | databuf | ) | `[pure virtual]`

Load this object from a data buffer.

This is the first pass version. Most property classes will return 0 here.

virtual bool iCelPropertyClass::PerformAction | ( | csStringID | actionID,
|  | iCelParameterBlock * | params,
|  | celData & | ret |
| ) |  |  | `[pure virtual]`

Perform an action with a generic string parameter.

Parameters:

  | actionID | the id of the action.
  | params | an optional parameter block for this action.
  | ret | is an optional return value. Note! Make sure to clear this variable before calling. PerformAction() implementations can choose not to initialize it.

virtual void iCelPropertyClass::PropertyClassesHaveChanged | ( |  | ) | `[pure virtual]`

This method is called by the parent entity when there is a change in property class setting.

i.e. another property class has been added or removed from the entity. This allows this property class to make adjustments to the references it keeps internally for other property classes.

virtual bool iCelPropertyClass::RemovePropertyChangeCallback | ( | iCelPropertyChangeCallback * | cb | ) | `[pure virtual]`

Remove a callback.

It is safe to call this function for a callback that is not registered. Nothing will happen in that case (except that false is returned). This function will DecRef the callback if it was present.

virtual csPtr<iCelDataBuffer> iCelPropertyClass::Save | ( |  | ) | `[pure virtual]`

Save this object to a data buffer.

virtual csPtr<iCelDataBuffer> iCelPropertyClass::SaveFirstPass | ( |  | ) | `[pure virtual]`

Save this object to a data buffer.

This routine is the first pass saving routine. Few property classes need to implement this. The idea is that here information is saved which is important to make other property classes work. This can be information related to level data that is essential for other property classes. Most property classes will return 0 here.

virtual void iCelPropertyClass::SetEntity | ( | iCelEntity * | entity | ) | `[pure virtual]`

Set the entity for this property class.

virtual celPersistenceResult iCelPropertyClass::SetPersistentData | ( | csTicks | data_time,
|  | iCelDataBuffer * | data,
|  | celPersistenceType | persistence_type |
| ) |  |  | `[pure virtual]`

Read the state of this property class from some persistent data.

Note: this function replaces the Load function.

Parameters:

  | data_time | The timestamp of the persistent data.
  | data | The persistent data.
  | persistence_type | The type of the persistence source.

Returns:
  Whether a problem has been encountered or not. Cheats can happen only if the type of the persistence source is CEL_PERSIST_TYPE_CLIENT_CONTROL (ie, when we are on the server side and the entity is controlled by a client).

virtual bool iCelPropertyClass::SetProperty | ( | csStringID | propertyID,
|  | iBase * | ibase |
| ) |  |  | `[pure virtual]`

Set a generic property.

virtual bool iCelPropertyClass::SetProperty | ( | csStringID | propertyID,
|  | iCelEntity * | entity |
| ) |  |  | `[pure virtual]`

Set a generic property.

virtual bool iCelPropertyClass::SetProperty | ( | csStringID | propertyID,
|  | iCelPropertyClass * | value |
| ) |  |  | `[pure virtual]`

Set a generic property.

virtual bool iCelPropertyClass::SetProperty | ( | csStringID | propertyID,
|  | const csColor & | value |
| ) |  |  | `[pure virtual]`

Set a generic property.

virtual bool iCelPropertyClass::SetProperty | ( | csStringID | propertyID,
|  | const csVector3 & | value |
| ) |  |  | `[pure virtual]`

Set a generic property.

virtual bool iCelPropertyClass::SetProperty | ( | csStringID | propertyID,
|  | const csVector2 & | value |
| ) |  |  | `[pure virtual]`

Set a generic property.

virtual bool iCelPropertyClass::SetProperty | ( | csStringID | propertyID,
|  | const char * | value |
| ) |  |  | `[pure virtual]`

Set a generic property.

virtual bool iCelPropertyClass::SetProperty | ( | csStringID | propertyID,
|  | bool | value |
| ) |  |  | `[pure virtual]`

Set a generic property.

virtual bool iCelPropertyClass::SetProperty | ( | csStringID | propertyID,
|  | float | value |
| ) |  |  | `[pure virtual]`

Set a generic property.

virtual bool iCelPropertyClass::SetProperty | ( | csStringID | propertyID,
|  | long | value |
| ) |  |  | `[pure virtual]`

Set a generic property.

In order to make it easier to access properties in a property class from general scripting languages this generic interface to properties is provided. It is always faster and more efficient to set properties directly but this system is usable in general.

This function returns false if the property could not be set for some reason.

The physical layer maintains a registry of ID's to use. The convention is to use property names like: 'cel.property.num'.

virtual void iCelPropertyClass::SetTag | ( | const char * | tagname | ) | `[pure virtual]`

Set the optional tag of this property class.

Multiple property classes of the same type (same name) can be attached to the same entity. To do that you need to add a tag so that you can uniquely identify them.

The documentation for this struct was generated from the following file:

- physicallayer/propclas.h