iso::flock::Agent Class Reference

agent class More...

#include <iso_flock_agent.h>

Inherited by iso::flock::Env, and iso::flock::Swarm.

Inheritance diagram for iso::flock::Agent:

Inheritance graph
[legend]
Collaboration diagram for iso::flock::Agent:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Agent ()
 default constructor
 Agent (const base::String &pName)
 create agent
 Agent (const base::String &pName, Agent &pAgent)
 copy constructor
virtual ~Agent ()
 destructor
unsigned int index () const
 return agent index
const base::String & name () const
 return agent name
unsigned int parameterCount () const
 return number of parameters the agent contains (first level parameters only
bool checkParameter (const base::String &pParameterName) const
 check if agent has parameter
unsigned int parameterIndex (const base::String &pParameterName) const throw (FlockException)
 return parameter index
Parameterparameter (unsigned int pParameterIndex) throw (FlockException)
 get parameter
Parameterparameter (const base::String &pParameterName) throw (FlockException)
 get parameter
virtual void addParameter (Parameter *pParameter) throw (FlockException)
 add parameter
virtual void addParameter (const base::String &pName, unsigned int pDim) throw (FlockException)
 create parameter
virtual void addParameter (const base::String &pName, unsigned int pDim, real pValue) throw (FlockException)
 create parameter
virtual void addParameter (const base::String &pName, const math::Vector< real > &pValues) throw (FlockException)
 create parameter
virtual void removeParameter (const base::String &pParameterName) throw (FlockException)
 create parameter
void setParameterValue (const base::String &pParameterName, real pParameterValue) throw (FlockException)
 set parameter value
void setParameterValues (const base::String &pParameterName, unsigned int pDim, double pValue1, double pValue2,...) throw (FlockException)
 set parameter valus
void setParameterValues (const base::String &pParameterName, const math::Vector< real > &pParameterValues) throw (FlockException)
 set parameter values
virtual void set (const base::String &pParameterName, real pParameterValue) throw (FlockException)
 set parameter values
virtual void set (const base::String &pParameterName, unsigned int pDim, double pValue1, double pValue2,...) throw (FlockException)
 set parameter valus
virtual void set (const base::String &pParameterName, const math::Vector< real > &pParameterValues) throw (FlockException)
 set parameter values
virtual void randomize (const base::String &pParameterName, real pMinParameterValue, real pMaxParameterValue) throw (FlockException)
 randomize parameter value
virtual void randomize (const base::String &pParameterName, const math::Vector< real > &pMinParameterValues, const math::Vector< real > &pMaxParameterValues) throw (FlockException)
 randomize parameter values
virtual void assignNeighbors (const base::String &pParameterName, const base::String &pSpaceName, bool pVisible, space::NeighborGroupAlg *pNeighborGroupAlg) throw (FlockException)
 assign neighbors for a parameter
virtual void assignNeighbors (const base::String &pParameterName, const base::String &pSpaceName, bool pVisible) throw (FlockException)
 assign neighbors for a parameter
virtual void assignNeighbors (const base::String &pParameterName, const base::String &pSpaceName, bool pVisible, real pNeighborRadius, int pMaxNeighborCount, bool pReplaceNeighborMode)
 assign neighbors for a parameter
unsigned int behaviorCount () const
 return number of behaviors
bool checkBehavior (const base::String &pBehaviorName) const
 check if agent has behavior
Behaviorbehavior (unsigned int pBehaviorIndex) throw (FlockException)
 get behavior
Behaviorbehavior (const base::String &pBehaviorName) throw (FlockException)
 get behavior
virtual void addBehavior (Behavior *pBehavior) throw (FlockException)
 add behavior
virtual void addBehavior (const base::String &pBehaviorName, const Behavior &pBehavior) throw (FlockException)
 add behavior
virtual void addBehavior (const base::String &pBehaviorName, unsigned int pBehaviorPosition, const Behavior &pBehavior) throw (FlockException)
 add behavior
virtual void addBehavior (const base::String &pBehaviorName, const base::String &pSuccessorBehaviorName, const Behavior &pBehavior) throw (FlockException)
 add behavior
virtual void moveBehavior (const base::String &pBehaviorName, unsigned int pBehaviorPosition) throw (FlockException)
 move behavior
virtual void moveBehavior (const base::String &pBehaviorName, const base::String &pSuccessorBehaviorName) throw (FlockException)
 move behavior
virtual void removeBehavior (const base::String &pBehaviorName) throw (FlockException)
 remove behavior
virtual void act ()
 perform behaviors
virtual void flush ()
 update parameters
virtual base::String info (int pPropagationLevel=0) const
 print agent information

Static Public Attributes

static const base::String sClassName
 default name
static unsigned int sInstanceCount
 number of agent instances

Protected Attributes

base::String mName
unsigned int mIndex
 agent name
ParameterList mParameterList
 agent index
BehaviorList mBehaviorList
 list of parameters

Friends

std::ostream & operator<< (std::ostream &pOstream, const Agent &pAgent)
 print agent information

Detailed Description

agent class

Created by Daniel Bisig on 3/23/07. Copyright 2006 Daniel Bisig All rights reserved.


Constructor & Destructor Documentation

Agent::Agent (  ) 

default constructor

Agent::Agent ( const base::String &  pName  ) 

create agent

Parameters:
pName name of agent

Agent::Agent ( const base::String &  pName,
Agent pAgent 
)

copy constructor

Parameters:
pName name of agent
pAgent agent to copy properties and behaviors from

Agent::~Agent (  )  [virtual]

destructor


Member Function Documentation

unsigned int Agent::index (  )  const

return agent index

Returns:
agent index

const base::String & Agent::name (  )  const

return agent name

Returns:
agent name

unsigned int Agent::parameterCount (  )  const

return number of parameters the agent contains (first level parameters only

Returns:
number of parameters the agent contains

bool Agent::checkParameter ( const base::String &  pParameterName  )  const

check if agent has parameter

Parameters:
pParameterName parameter name
Returns:
true if agent possesses a particular parameter

unsigned int Agent::parameterIndex ( const base::String &  pParameterName  )  const throw (FlockException)

return parameter index

Parameters:
pParameterName parameter name
Returns:
parameter index
Exceptions:
FlockException parameter does not exist

Parameter & Agent::parameter ( unsigned int  pParameterIndex  )  throw (FlockException)

get parameter

Parameters:
pParameterIndex parameter index
Returns:
parameter
Exceptions:
FlockException parameter does not exist

Parameter & Agent::parameter ( const base::String &  pParameterName  )  throw (FlockException)

get parameter

Parameters:
pParameterName parameter name
Returns:
parameter
Exceptions:
FlockException parameter does not exist

void Agent::addParameter ( Parameter pParameter  )  throw (FlockException) [virtual]

add parameter

Parameters:
pParameter parameter
Exceptions:
FlockException parameter name already exists

Reimplemented in iso::flock::Swarm.

void Agent::addParameter ( const base::String &  pName,
unsigned int  pDim 
) throw (FlockException) [virtual]

create parameter

Parameters:
pName parameter name
pDim dimension of parameter (> 0)
Exceptions:
FlockException parameter name already exists

Reimplemented in iso::flock::Swarm.

void Agent::addParameter ( const base::String &  pName,
unsigned int  pDim,
real  pValue 
) throw (FlockException) [virtual]

create parameter

Parameters:
pName parameter name
pDim dimension of parameter (> 0)
pValue uniform parameter value
Exceptions:
FlockException parameter name already exists

Reimplemented in iso::flock::Swarm.

void Agent::addParameter ( const base::String &  pName,
const math::Vector< real > &  pValues 
) throw (FlockException) [virtual]

create parameter

Parameters:
pName parameter name
pValues parameter values
Exceptions:
FlockException parameter name already exists

Reimplemented in iso::flock::Swarm.

void Agent::removeParameter ( const base::String &  pParameterName  )  throw (FlockException) [virtual]

create parameter

Parameters:
pParameterName parameter name
Exceptions:
FlockException failed to remove parameter

void Agent::setParameterValue ( const base::String &  pParameterName,
real  pParameterValue 
) throw (FlockException)

set parameter value

Parameters:
pParameterName parameter name
pParameterValue parameter value
Exceptions:
FlockException parameter name not found

void Agent::setParameterValues ( const base::String &  pParameterName,
unsigned int  pDim,
double  pValue1,
double  pValue2,
  ... 
) throw (FlockException)

set parameter valus

Parameters:
pParameterName parameter name
pDim dimension of parameter (> 0)
pValue1 first parameter valze
pValue2 second parameter value
Exceptions:
FlockException parameter name already exists

void Agent::setParameterValues ( const base::String &  pParameterName,
const math::Vector< real > &  pParameterValues 
) throw (FlockException)

set parameter values

Parameters:
pParameterName parameter name
pParameterValues parameter values
Exceptions:
FlockException parameter name is not found or parameter values has wrong dimension

void Agent::set ( const base::String &  pParameterName,
real  pParameterValue 
) throw (FlockException) [virtual]

set parameter values

Parameters:
pParameterName parameter name
pParameterValue parameter value
Exceptions:
FlockException parameter name is not found

Reimplemented in iso::flock::Env, and iso::flock::Swarm.

void Agent::set ( const base::String &  pParameterName,
unsigned int  pDim,
double  pValue1,
double  pValue2,
  ... 
) throw (FlockException) [virtual]

set parameter valus

Parameters:
pParameterName parameter name
pDim dimension of parameter (> 0)
pValue1 first parameter valze
pValue2 second parameter value
Exceptions:
FlockException parameter name already exists

void Agent::set ( const base::String &  pParameterName,
const math::Vector< real > &  pParameterValues 
) throw (FlockException) [virtual]

set parameter values

Parameters:
pParameterName parameter name
pParameterValues parameter values
Exceptions:
FlockException parameter name is not found or parameter values has wrong dimension

Reimplemented in iso::flock::Env, and iso::flock::Swarm.

void Agent::randomize ( const base::String &  pParameterName,
real  pMinParameterValue,
real  pMaxParameterValue 
) throw (FlockException) [virtual]

randomize parameter value

Parameters:
pParameterName parameter name
pMinParameterValue minimum parameter value
pMaxParameterValue maximum parameter value
Exceptions:
FlockException parameter name not found

Reimplemented in iso::flock::Env, and iso::flock::Swarm.

void Agent::randomize ( const base::String &  pParameterName,
const math::Vector< real > &  pMinParameterValues,
const math::Vector< real > &  pMaxParameterValues 
) throw (FlockException) [virtual]

randomize parameter values

Parameters:
pParameterName parameter name
pMinParameterValues minimum parameter values
pMaxParameterValues maximum parameter values
Exceptions:
FlockException parameter name not found or parameter values has wrong dimension

Reimplemented in iso::flock::Env, and iso::flock::Swarm.

void Agent::assignNeighbors ( const base::String &  pParameterName,
const base::String &  pSpaceName,
bool  pVisible,
space::NeighborGroupAlg *  pNeighborGroupAlg 
) throw (FlockException) [virtual]

assign neighbors for a parameter

Parameters:
pParameterName parameter name
pSpaceName name of neighbor space
pVisible whether parameter is visible
pNeighborGroupAlg neighbor group algorithm
Exceptions:
FlockException parameter not found, space not found, parameter and space dimension mismatch

Reimplemented in iso::flock::Swarm.

void Agent::assignNeighbors ( const base::String &  pParameterName,
const base::String &  pSpaceName,
bool  pVisible 
) throw (FlockException) [virtual]

assign neighbors for a parameter

Parameters:
pParameterName parameter name
pSpaceName name of neighbor space
pVisible whether parameter is visible
Exceptions:
FlockException parameter not found, space not found, parameter and space dimension mismatch
simpified assignNeighbors method that passes NULL for NeighborGroupAlg

Reimplemented in iso::flock::Swarm.

void Agent::assignNeighbors ( const base::String &  pParameterName,
const base::String &  pSpaceName,
bool  pVisible,
real  pNeighborRadius,
int  pMaxNeighborCount,
bool  pReplaceNeighborMode 
) [virtual]

assign neighbors for a parameter

Parameters:
pParameterName parameter name
pSpaceName name of neighbor space
pVisible whether parameter is visible
pNeighborRadius radius within which neighbors are searched
pMaxNeighborCount maximum number of neighbors in neighbor list if >= 0 (-1: no limit)
pReplaceNeighborMode replace more distant neighbors with closer neighbors if true
Exceptions:
FlockException parameter not found, space not found, parameter and space dimension mismatch
simpified assignNeighbors method that automaticall creates a NeighborGroupAlg.

Reimplemented in iso::flock::Swarm.

unsigned int Agent::behaviorCount (  )  const

return number of behaviors

Returns:
number of behaviors

bool Agent::checkBehavior ( const base::String &  pBehaviorName  )  const

check if agent has behavior

Parameters:
pBehaviorName behavior name
Returns:
true if agent possesses a particular behavior

Behavior & Agent::behavior ( unsigned int  pBehaviorIndex  )  throw (FlockException)

get behavior

Parameters:
pBehaviorIndex behavior index
Returns:
behavior
Exceptions:
FlockException behavior does not exist

Behavior & Agent::behavior ( const base::String &  pBehaviorName  )  throw (FlockException)

get behavior

Parameters:
pBehaviorName behavior name
Returns:
behavior
Exceptions:
FlockException behavior not found

void Agent::addBehavior ( Behavior pBehavior  )  throw (FlockException) [virtual]

add behavior

Parameters:
pBehavior behavior
Exceptions:
FlockException behavior already exists

void Agent::addBehavior ( const base::String &  pBehaviorName,
const Behavior pBehavior 
) throw (FlockException) [virtual]

add behavior

Parameters:
pBehaviorName behavior name
pBehavior behavior
Exceptions:
FlockException behavior already exists or Illegal Behavior Parameters

Reimplemented in iso::flock::Swarm.

void Agent::addBehavior ( const base::String &  pBehaviorName,
unsigned int  pBehaviorPosition,
const Behavior pBehavior 
) throw (FlockException) [virtual]

add behavior

Parameters:
pBehaviorName behavior name
pBehaviorPosition behavior position
pBehavior behavior
Exceptions:
FlockException behavior already exists or Illegal Behavior Parameters

Reimplemented in iso::flock::Swarm.

void Agent::addBehavior ( const base::String &  pBehaviorName,
const base::String &  pSuccessorBehaviorName,
const Behavior pBehavior 
) throw (FlockException) [virtual]

add behavior

Parameters:
pBehaviorName behavior name
pSuccessorBehaviorName name of behavior in front of which the new behavior is inserted
pBehavior behavior
Exceptions:
FlockException behavior already exists or Illegal Behavior Parameters

Reimplemented in iso::flock::Swarm.

void Agent::moveBehavior ( const base::String &  pBehaviorName,
unsigned int  pBehaviorPosition 
) throw (FlockException) [virtual]

move behavior

Parameters:
pBehaviorName behavior name
pBehaviorPosition behavior position
Exceptions:
FlockException behavior not found

Reimplemented in iso::flock::Swarm.

void Agent::moveBehavior ( const base::String &  pBehaviorName,
const base::String &  pSuccessorBehaviorName 
) throw (FlockException) [virtual]

move behavior

Parameters:
pBehaviorName behavior name
pSuccessorBehaviorName name of behavior in front of which the new behavior is inserted
Exceptions:
FlockException behavior not found

Reimplemented in iso::flock::Swarm.

void Agent::removeBehavior ( const base::String &  pBehaviorName  )  throw (FlockException) [virtual]

remove behavior

Parameters:
pBehaviorName behavior name
Exceptions:
FlockException failed to remove behavior

Reimplemented in iso::flock::Swarm.

void Agent::act (  )  [virtual]

perform behaviors

Reimplemented in iso::flock::Swarm.

void Agent::flush (  )  [virtual]

update parameters

Reimplemented in iso::flock::Swarm.

base::String Agent::info ( int  pPropagationLevel = 0  )  const [virtual]

print agent information

Parameters:
pPropagationLevel how far the propagation method proceeds through composite classes (-1: unlimited, 0: no proceeding, >0: limited proceeding)

Reimplemented in iso::flock::Swarm.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  pOstream,
const Agent pAgent 
) [friend]

print agent information


Member Data Documentation

const base::String Agent::sClassName [static]

default name

unsigned int Agent::sInstanceCount [static]

number of agent instances

Reimplemented in iso::flock::Swarm.

base::String iso::flock::Agent::mName [protected]

unsigned int iso::flock::Agent::mIndex [protected]

agent name

ParameterList iso::flock::Agent::mParameterList [protected]

agent index

BehaviorList iso::flock::Agent::mBehaviorList [protected]

list of parameters


The documentation for this class was generated from the following files:
Generated on Fri Feb 25 15:28:03 2011 for iso_flock by  doxygen 1.5.1