NDObject Class Reference

Represents a single game object (e.g. Player, Ball, etc.) which may be optionally synchronized between server and all clients. More...

List of all members.

Public Member Functions

NDObjectID getID (void)
 Returns the object's ID.
bool isLocal (void)
 Is this object a local object?
NDResult publish (void)
 Publishes a local object.
void setUserPtr (void *ptr)
 Stores a user pointer for this object.
void * getUserPtr (void)
 Retrieves the user pointer for this object.
NDNodeID getAuthNodeID (void)
 Gets the nodeID of the object authority for this object.
NDNodeID getOwnerID (void)
 Gets the nodeID of the owner of this object.
uint32_t getNumChildren (void)
 Gets the number of child objects of this object.
NDObjectID getChild (uint32_t idx)
 Gets the nth child of this object.
NDResult removeChild (NDObjectID objid)
 Removes a child object from this object.
NDResult addChild (NDObjectID objid)
 Adds a child object to this object.
NDObjectType getObjectType (void)
 Gets the object type of this object.
NDResult setPositionAttribute (NDAttribID atid)
 Reserved for future use.
NDAttribID getPositionAttribute (void)
 Reserved for future use.
NDAttribType getAttribType (NDAttribID atid)
 Gets the data type for the specified object attribute (data field).
NDResult getVect3Int32 (NDAttribID atid, NDVect3Int32 &p)
 Retrieves this object's specified attribute as a 3-dimensional vector of 32-bit ints.
NDResult setVect3Int32 (NDAttribID atid, const NDVect3Int32 &p, bool create=false)
 Sets this object's specified attribute as a 3-dimensional vector of 32-bit ints.
NDResult getVect3Int64 (NDAttribID atid, NDVect3Int64 &p)
 Retrieves this object's specified attribute as a 3-dimensional vector of 64-bit ints.
NDResult setVect3Int64 (NDAttribID atid, const NDVect3Int64 &p, bool create=false)
 Sets this object's specified attribute as a 3-dimensional vector of 64-bit ints.
NDResult getVect3Float (NDAttribID atid, NDVect3Float &p)
 Retrieves this object's specified attribute as a 3-dimensional vector of floats.
NDResult setVect3Float (NDAttribID atid, const NDVect3Float &p, bool create=false)
 Sets this object's specified attribute as a 3-dimensional vector of floats.
NDResult getVect3Double (NDAttribID atid, NDVect3Double &p)
 Retrieves this object's specified attribute as a 3-dimensional vector of doubles.
NDResult setVect3Double (NDAttribID atid, const NDVect3Double &p, bool create=false)
 Sets this object's specified attribute as a 3-dimensional vector of doubles.
NDResult getInt64 (NDAttribID atid, int64_t &val)
 Retrieves this object's specified attribute as a 64-bit int.
NDResult setInt64 (NDAttribID atid, int64_t val, bool create=false)
 Sets this object's specified attribute as a 64-bit int.
NDResult getInt32 (NDAttribID atid, int32_t &val)
 Retrieves this object's specified attribute as a 64-bit int.
NDResult setInt32 (NDAttribID atid, int32_t val, bool create=false)
 Sets this object's specified attribute as a 64-bit int.
NDResult getFloat (NDAttribID atid, float &val)
 Retrieves this object's specified attribute as a float.
NDResult setFloat (NDAttribID atid, float val, bool create=false)
 Sets this object's specified attribute as a float.
NDResult getDouble (NDAttribID atid, double &val)
 Retrieves this object's specified attribute as a double.
NDResult setDouble (NDAttribID atid, double val, bool create=false)
 Sets this object's specified attribute as a double.
NDResult getRaw (NDAttribID atid, char *ptr, uint32_t *len)
 Retrieves this object's specified attribute as raw data.
NDResult setRaw (NDAttribID atid, char *ptr, uint32_t len, bool create=false)
 Sets this object's specified attribute as raw data.

Static Public Member Functions

static const char * attribTypeToString (NDAttribType atype)
 Gets the string representation of the specified attribute data type.

Static Public Attributes

static const NDAttribType TYPE_RAW = 0x00
static const NDAttribType TYPE_OBJECT = 0x01
static const NDAttribType TYPE_INTERP = 0x02
static const NDAttribType TYPE_INT32 = 0x03
static const NDAttribType TYPE_INT64 = 0x04
static const NDAttribType TYPE_FLOAT = 0x05
static const NDAttribType TYPE_DOUBLE = 0x06
static const NDAttribType TYPE_VECT3_INT32 = 0x07
static const NDAttribType TYPE_VECT3_INT64 = 0x08
static const NDAttribType TYPE_VECT3_FLOAT = 0x09
static const NDAttribType TYPE_VECT3_DOUBLE = 0x0A

Detailed Description

Represents a single game object (e.g. Player, Ball, etc.) which may be optionally synchronized between server and all clients


Member Function Documentation

NDResult NDObject::addChild ( NDObjectID  objid  ) 

Adds a child object to this object

Parameters:
objid the objectID of the child object to be removed
Returns:
NDRES_OK if the child object was successfully removed
const char * NDObject::attribTypeToString ( NDAttribType  atype  )  [static]

Gets the string representation of the specified attribute data type

Parameters:
atype the attribute (field) data type
Returns:
a string describing the attribute data type
NDAttribType NDObject::getAttribType ( NDAttribID  atid  ) 

Gets the data type for the specified object attribute (data field)

Parameters:
atid the attribute (field) ID
Returns:
the data type for the specified attribute
NDNodeID NDObject::getAuthNodeID ( void   ) 

Gets the nodeID of the object authority for this object

Returns:
the nodeID of the object authority
NDObjectID NDObject::getChild ( uint32_t  idx  ) 

Gets the nth child of this object

Parameters:
idx the index of the child object
Returns:
the objectID of the object at the specified index
NDResult NDObject::getDouble ( NDAttribID  atid,
double &  val 
)

Retrieves this object's specified attribute as a double.

Parameters:
atid the attribute (field) ID to retrieve
val the variable (passed by reference) into which this value will be read
Returns:
NDRES_OK if the value was successfully read
NDRES_NOT_FOUND if an attribute with the specified ID does not exist
NDRES_WRONG_TYPE if the iterator currently points to an item which is not of the specified type
NDResult NDObject::getFloat ( NDAttribID  atid,
float &  val 
)

Retrieves this object's specified attribute as a float.

Parameters:
atid the attribute (field) ID to retrieve
val the variable (passed by reference) into which this value will be read
Returns:
NDRES_OK if the value was successfully read
NDRES_NOT_FOUND if an attribute with the specified ID does not exist
NDRES_WRONG_TYPE if the iterator currently points to an item which is not of the specified type
NDObjectID NDObject::getID ( void   ) 

Returns the object's ID

The ID of an object is a 64-bit unsigned integer. And ID of zero indicates that the object is invalid.

Returns:
NDObjectID of this object
NDResult NDObject::getInt32 ( NDAttribID  atid,
int32_t &  val 
)

Retrieves this object's specified attribute as a 64-bit int.

Parameters:
atid the attribute (field) ID to retrieve
val the variable (passed by reference) into which this value will be read
Returns:
NDRES_OK if the value was successfully read
NDRES_NOT_FOUND if an attribute with the specified ID does not exist
NDRES_WRONG_TYPE if the iterator currently points to an item which is not of the specified type
NDResult NDObject::getInt64 ( NDAttribID  atid,
int64_t &  val 
)

Retrieves this object's specified attribute as a 64-bit int.

Parameters:
atid the attribute (field) ID to retrieve
val the variable (passed by reference) into which this value will be read
Returns:
NDRES_OK if the value was successfully read
NDRES_NOT_FOUND if an attribute with the specified ID does not exist
NDRES_WRONG_TYPE if the iterator currently points to an item which is not of the specified type
uint32_t NDObject::getNumChildren ( void   ) 

Gets the number of child objects of this object

Returns:
the number of child objects
NDObjectType NDObject::getObjectType ( void   ) 

Gets the object type of this object

Returns:
the type of this object
NDNodeID NDObject::getOwnerID ( void   ) 

Gets the nodeID of the owner of this object

Returns:
the nodeID of the owner
NDAttribID NDObject::getPositionAttribute ( void   ) 

Reserved for future use

Returns:
reserved
NDResult NDObject::getRaw ( NDAttribID  atid,
char *  ptr,
uint32_t *  len 
)

Retrieves this object's specified attribute as raw data.

Parameters:
atid the attribute (field) ID to retrieve
ptr the pointer into which data will be read
len a pointer into which the length of the raw data will be stored (NULL may be passed if the length is not needed)
Returns:
NDRES_OK if the value was successfully read
NDRES_NOT_FOUND if an attribute with the specified ID does not exist
NDRES_WRONG_TYPE if the iterator currently points to an item which is not of the specified type
void * NDObject::getUserPtr ( void   ) 

Retrieves the user pointer for this object. NULL by default.

Returns:
The user pointer
NDResult NDObject::getVect3Double ( NDAttribID  atid,
NDVect3Double &  p 
)

Retrieves this object's specified attribute as a 3-dimensional vector of doubles.

Parameters:
atid the attribute (field) ID to retrieve
p the variable (passed by reference) into which this value will be read
Returns:
NDRES_OK if the value was successfully read
NDRES_NOT_FOUND if an attribute with the specified ID does not exist
NDRES_WRONG_TYPE if the iterator currently points to an item which is not of the specified type
NDResult NDObject::getVect3Float ( NDAttribID  atid,
NDVect3Float &  p 
)

Retrieves this object's specified attribute as a 3-dimensional vector of floats.

Parameters:
atid the attribute (field) ID to retrieve
p the variable (passed by reference) into which this value will be read
Returns:
NDRES_OK if the value was successfully read
NDRES_NOT_FOUND if an attribute with the specified ID does not exist
NDRES_WRONG_TYPE if the iterator currently points to an item which is not of the specified type
NDResult NDObject::getVect3Int32 ( NDAttribID  atid,
NDVect3Int32 &  p 
)

Retrieves this object's specified attribute as a 3-dimensional vector of 32-bit ints.

Parameters:
atid the attribute (field) ID to retrieve
p the variable (passed by reference) into which this value will be read
Returns:
NDRES_OK if the value was successfully read
NDRES_NOT_FOUND if an attribute with the specified ID does not exist
NDRES_WRONG_TYPE if the iterator currently points to an item which is not of the specified type
NDResult NDObject::getVect3Int64 ( NDAttribID  atid,
NDVect3Int64 &  p 
)

Retrieves this object's specified attribute as a 3-dimensional vector of 64-bit ints.

Parameters:
atid the attribute (field) ID to retrieve
p the variable (passed by reference) into which this value will be read
Returns:
NDRES_OK if the value was successfully read
NDRES_NOT_FOUND if an attribute with the specified ID does not exist
NDRES_WRONG_TYPE if the iterator currently points to an item which is not of the specified type
bool NDObject::isLocal ( void   ) 

Determines whether this object is a local object. Local objects are only visible to the current instance of NetDog, and are not shared across the network. All new objects are created as local objects. To create a global object, see NDObject::publish()

Returns:
bool true if local, false if global
NDResult NDObject::publish ( void   ) 

Publishes a local object. Local object is validated by an object server. If accepted, the object becomes a global object, visible to all.

Returns:
NDRES_OK on success
NDResult NDObject::removeChild ( NDObjectID  objid  ) 

Removes a child object from this object

Parameters:
objid the objectID of the child object to be removed
Returns:
NDRES_OK if the child object was successfully removed
NDResult NDObject::setDouble ( NDAttribID  atid,
double  val,
bool  create = false 
)

Sets this object's specified attribute as a double.

Parameters:
atid the attribute (field) ID to set
val the value to set this attribute to
create if true, the attribute with this ID will created if it doesn't exist, if false, the value will only be set if the attribute with this ID already exists
Returns:
NDRES_OK if the value was successfully read
NDRES_NOT_FOUND if an attribute with the specified ID does not exist
NDRES_WRONG_TYPE if the iterator currently points to an item which is not of the specified type
NDResult NDObject::setFloat ( NDAttribID  atid,
float  val,
bool  create = false 
)

Sets this object's specified attribute as a float.

Parameters:
atid the attribute (field) ID to set
val the value to set this attribute to
create if true, the attribute with this ID will created if it doesn't exist, if false, the value will only be set if the attribute with this ID already exists
Returns:
NDRES_OK if the value was successfully read
NDRES_NOT_FOUND if an attribute with the specified ID does not exist
NDRES_WRONG_TYPE if the iterator currently points to an item which is not of the specified type
NDResult NDObject::setInt32 ( NDAttribID  atid,
int32_t  val,
bool  create = false 
)

Sets this object's specified attribute as a 64-bit int.

Parameters:
atid the attribute (field) ID to set
val the value to set this attribute to
create if true, the attribute with this ID will created if it doesn't exist, if false, the value will only be set if the attribute with this ID already exists
Returns:
NDRES_OK if the value was successfully read
NDRES_NOT_FOUND if an attribute with the specified ID does not exist
NDRES_WRONG_TYPE if the iterator currently points to an item which is not of the specified type
NDResult NDObject::setInt64 ( NDAttribID  atid,
int64_t  val,
bool  create = false 
)

Sets this object's specified attribute as a 64-bit int.

Parameters:
atid the attribute (field) ID to set
val the value to set this attribute to
create if true, the attribute with this ID will created if it doesn't exist, if false, the value will only be set if the attribute with this ID already exists
Returns:
NDRES_OK if the value was successfully read
NDRES_NOT_FOUND if an attribute with the specified ID does not exist
NDRES_WRONG_TYPE if the iterator currently points to an item which is not of the specified type
NDResult NDObject::setPositionAttribute ( NDAttribID  atid  ) 

Reserved for future use

Returns:
reserved
NDResult NDObject::setRaw ( NDAttribID  atid,
char *  ptr,
uint32_t  len,
bool  create = false 
)

Sets this object's specified attribute as raw data.

Parameters:
atid the attribute (field) ID to set
ptr the pointer to raw data to set this attribute to
len the length of the raw data (in bytes)
create if true, the attribute with this ID will created if it doesn't exist, if false, the value will only be set if the attribute with this ID already exists
Returns:
NDRES_OK if the value was successfully read
NDRES_NOT_FOUND if an attribute with the specified ID does not exist
NDRES_WRONG_TYPE if the iterator currently points to an item which is not of the specified type
void NDObject::setUserPtr ( void *  ptr  ) 

Stores a user pointer for this object. This is a convienience to the user, allowing storage of user-specific information within this object.

Parameters:
ptr the pointer to be stored in the object
NDResult NDObject::setVect3Double ( NDAttribID  atid,
const NDVect3Double &  p,
bool  create = false 
)

Sets this object's specified attribute as a 3-dimensional vector of doubles.

Parameters:
atid the attribute (field) ID to set
p the value to set this attribute to
create if true, the attribute with this ID will created if it doesn't exist, if false, the value will only be set if the attribute with this ID already exists
Returns:
NDRES_OK if the value was successfully read
NDRES_NOT_FOUND if an attribute with the specified ID does not exist
NDRES_WRONG_TYPE if the iterator currently points to an item which is not of the specified type
NDResult NDObject::setVect3Float ( NDAttribID  atid,
const NDVect3Float &  p,
bool  create = false 
)

Sets this object's specified attribute as a 3-dimensional vector of floats.

Parameters:
atid the attribute (field) ID to set
p the value to set this attribute to
create if true, the attribute with this ID will created if it doesn't exist, if false, the value will only be set if the attribute with this ID already exists
Returns:
NDRES_OK if the value was successfully read
NDRES_NOT_FOUND if an attribute with the specified ID does not exist
NDRES_WRONG_TYPE if the iterator currently points to an item which is not of the specified type
NDResult NDObject::setVect3Int32 ( NDAttribID  atid,
const NDVect3Int32 &  p,
bool  create = false 
)

Sets this object's specified attribute as a 3-dimensional vector of 32-bit ints.

Parameters:
atid the attribute (field) ID to set
p the value to set this attribute to
create if true, the attribute with this ID will created if it doesn't exist, if false, the value will only be set if the attribute with this ID already exists
Returns:
NDRES_OK if the value was successfully read
NDRES_NOT_FOUND if an attribute with the specified ID does not exist
NDRES_WRONG_TYPE if the iterator currently points to an item which is not of the specified type
NDResult NDObject::setVect3Int64 ( NDAttribID  atid,
const NDVect3Int64 &  p,
bool  create = false 
)

Sets this object's specified attribute as a 3-dimensional vector of 64-bit ints.

Parameters:
atid the attribute (field) ID to set
p the value to set this attribute to
create if true, the attribute with this ID will created if it doesn't exist, if false, the value will only be set if the attribute with this ID already exists
Returns:
NDRES_OK if the value was successfully read
NDRES_NOT_FOUND if an attribute with the specified ID does not exist
NDRES_WRONG_TYPE if the iterator currently points to an item which is not of the specified type

Generated on Wed Jul 21 18:14:48 2010 for nd2 by  doxygen 1.6.1