newspeoplefor developersdocumentationdownloads

nArg Class Reference
[Nebula Kernel]

#include <narg.h>

List of all members.


Detailed Description

nArg encapsulates a typed argument (float, int, bool, string or object pointer) into an uniform C++ class.

(C) 2002 RadonLabs GmbH

Definition at line 21 of file narg.h.


Public Types

enum  Type {
  Void,
  Int,
  Float,
  String,
  Bool,
  Object,
  List,
  Float4,
  Matrix44
}

Public Member Functions

 nArg ()
 the default constructor
 nArg (const nArg &rhs)
 the copy constructor
 ~nArg ()
 the destructor
void Delete ()
 delete contents (sets type to Void)
void Copy (const nArg &rhs)
 copy content
void Copy (va_list *marker)
 copy from va_list
bool operator== (const nArg &rhs) const
 the equals operator
nArgoperator= (const nArg &rhs)
 assignment operator
void Reset (char c)
 Set type corresponding to data type character and reset arg contents.
void SetI (int i)
 set content to an integer
void SetB (bool b)
 set content to a bool
void SetF (float f)
 set content to a float
void SetS (const char *s)
 set content to a string
void SetO (void *)
 set content to an (object) pointer
void SetL (nArg *_l, int len)
 Set content to an array of nArgs.
void SetF4 (const nFloat4 &f4)
 set to float4
void SetV4 (const vector4 &v4)
 set to float4, as vector4
void SetV3 (const vector3 &v3)
 set to float4, as vector3
void SetM44 (const matrix44 &m44)
 set to matrix44
Type GetType () const
 get the content data type
int GetI () const
 get int content
bool GetB () const
 get bool content
float GetF () const
 get float content
const char * GetS () const
 get string content
void * GetO () const
 get object pointer content
int GetL (nArg *&) const
 Get an array of nArgs.
const nFloat4GetF4 () const
 get float4 content
const vector4GetV4 () const
 get content as vector4
const vector3GetV3 () const
 get content as vector3
const matrix44GetM44 () const
 get matrix44 content

Static Public Member Functions

static bool IsValidArg (char c)
 check if the provided data type character is a valid argument
static bool IsVoid (char c)
 check if the provided data type character is void

Member Enumeration Documentation

enum nArg::Type
 

Enumerator:
Void 
Int 
Float 
String 
Bool 
Object 
List 
Float4 
Matrix44 

Definition at line 24 of file narg.h.


Constructor & Destructor Documentation

nArg::nArg  )  [inline]
 

the default constructor

The default constructor will initialize the arg type to Void

Definition at line 327 of file narg.h.

nArg::nArg const nArg rhs  )  [inline]
 

the copy constructor

The copy constructor simply calls nArg::Copy()

Parameters:
rhs reference to nArg object to be copied

Definition at line 342 of file narg.h.

nArg::~nArg  )  [inline]
 

the destructor

Definition at line 353 of file narg.h.


Member Function Documentation

void nArg::Delete  )  [inline]
 

delete contents (sets type to Void)

Delete content, sets type to Void.

Definition at line 132 of file narg.h.

void nArg::Copy const nArg rhs  )  [inline]
 

copy content

Copy contents. Only calls delete if necessary to avoid memory allocation overhead.

Parameters:
rhs reference to nArg object to be copied

Definition at line 166 of file narg.h.

void nArg::Copy va_list *  marker  )  [inline]
 

copy from va_list

Copy contents from variable argument list marker. The type of the variable is known by the this->type.

Parameters:
marker va_list parameter

Definition at line 252 of file narg.h.

bool nArg::operator== const nArg rhs  )  const [inline]
 

the equals operator

Checks whether data type and contents of the object are identical.

Definition at line 375 of file narg.h.

nArg & nArg::operator= const nArg rhs  )  [inline]
 

assignment operator

Definition at line 363 of file narg.h.

void nArg::Reset char  c  )  [inline]
 

Set type corresponding to data type character and reset arg contents.

Definition at line 798 of file narg.h.

void nArg::SetI int  _i  )  [inline]
 

set content to an integer

Sets the contents to an integer, and sets the arg type to Int.

Parameters:
_i the integer

Definition at line 433 of file narg.h.

void nArg::SetB bool  _b  )  [inline]
 

set content to a bool

Sets the contents to a bool value, and set the arg type to Bool.

Parameters:
_b the bool value

Definition at line 447 of file narg.h.

void nArg::SetF float  _f  )  [inline]
 

set content to a float

Sets the contents to a float value, and sets the arg type to Float.

Parameters:
_f the float value

Definition at line 462 of file narg.h.

void nArg::SetS const char *  _s  )  [inline]
 

set content to a string

Sets the contents to a string, and sets the arg type to String. The string is duplicated internally.

Parameters:
_s the string

Definition at line 478 of file narg.h.

void nArg::SetO void *  _o  )  [inline]
 

set content to an (object) pointer

Sets the contents to an object pointer, and sets the arg type to Object. The pointer is NOT safe (if the object is destroyed, the pointer points to Nirvana).

Parameters:
_o the object pointer

Definition at line 500 of file narg.h.

void nArg::SetL nArg _l,
int  len
[inline]
 

Set content to an array of nArgs.

Sets the contents to an array of other nArgs, and sets the arg type to List. The array is NOT duplicated.

Parameters:
_l pointer to array of nArg
len length of array

Definition at line 516 of file narg.h.

void nArg::SetF4 const nFloat4 _f4  )  [inline]
 

set to float4

Set the content to a float4 value.

Definition at line 539 of file narg.h.

void nArg::SetV4 const vector4 v  )  [inline]
 

set to float4, as vector4

Set the content to a Float4 value, with vector4 as parameter.

Definition at line 552 of file narg.h.

void nArg::SetV3 const vector3 v  )  [inline]
 

set to float4, as vector3

Set the content to a vector3 value.

Definition at line 565 of file narg.h.

void nArg::SetM44 const matrix44 _m44  )  [inline]
 

set to matrix44

Set the content to a matrix44 value.

Definition at line 581 of file narg.h.

nArg::Type nArg::GetType  )  const [inline]
 

get the content data type

Returns the argument type of the object, which is one of Void - unitialized Int Bool Float List Float4 Matrix44

Returns:
the arg type

Definition at line 610 of file narg.h.

int nArg::GetI  )  const [inline]
 

get int content

Returns the integer content of the object. Throws assertion if not set to an integer.

Returns:
the integer value

Definition at line 624 of file narg.h.

bool nArg::GetB  )  const [inline]
 

get bool content

Returns the bool content of the object. Throws assertion if not set to a bool.

Returns:
the bool value

Definition at line 639 of file narg.h.

float nArg::GetF  )  const [inline]
 

get float content

Returns the float content of the object. Throws assertion if not set to a float.

Returns:
the float value

Definition at line 654 of file narg.h.

const char * nArg::GetS  )  const [inline]
 

get string content

Returns the string content of the object. Throws assertion if not set to a string.

Returns:
the string pointer

Definition at line 669 of file narg.h.

void * nArg::GetO  )  const [inline]
 

get object pointer content

Returns the object pointer content of the object. Throws assertion if not set to an object pointer.

Returns:
the object pointer

Definition at line 684 of file narg.h.

int nArg::GetL nArg *&  _l  )  const [inline]
 

Get an array of nArgs.

Returns the nArg array content of the object. Throws assertion if not set to a list.

Parameters:
_l Pointer to nArg array. Will be set by this function
Returns:
the length of the array

Definition at line 701 of file narg.h.

const nFloat4 & nArg::GetF4  )  const [inline]
 

get float4 content

Return float4 content.

Definition at line 714 of file narg.h.

const vector4 & nArg::GetV4  )  const [inline]
 

get content as vector4

Return float4 content as vector4

Definition at line 726 of file narg.h.

const vector3 & nArg::GetV3  )  const [inline]
 

get content as vector3

Return float4 content as vector3

Definition at line 738 of file narg.h.

const matrix44 & nArg::GetM44  )  const [inline]
 

get matrix44 content

Return matrix44 content.

Definition at line 750 of file narg.h.

bool nArg::IsValidArg char  c  )  [inline, static]
 

check if the provided data type character is a valid argument

Definition at line 762 of file narg.h.

bool nArg::IsVoid char  c  )  [inline, static]
 

check if the provided data type character is void

Definition at line 784 of file narg.h.


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

Copyright © 1999-2005 by the contributing authors. Ideas, requests, problems: Send feedback.