iso::flock::Swarm Class Reference

#include <iso_flock_swarm.h>

Inherits iso::flock::Agent.

Inheritance diagram for iso::flock::Swarm:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Swarm (const base::String &pName)
 create swarm
 Swarm (const base::String &pName, Swarm &pSwarm)
 copy constructor
 ~Swarm ()
 destructor
unsigned int agentCount () const
 return number of agents
QVector< Agent * > & agents ()
 return agents
const QVector< Agent * > & agents () const
 return agents
void addAgent () throw (FlockException)
 add single agent to swarm
Exceptions:
FlockException failed to add agent

void addAgents (unsigned int pAgentCount) throw (FlockException)
 add a number of agents to swarm
void removeAgent () throw (FlockException)
 remove last agent from swarm
Exceptions:
FlockException failed to remove agent

void removeAgent (unsigned int pAgentIndex) throw (FlockException)
 remove particular agent from swarm
Exceptions:
FlockException failed to remove agent

void removeAgents (unsigned int pAgentCount) throw (FlockException)
 remove the last n agents from swarm
void removeAgents (unsigned int pAgentIndex, unsigned int pAgentCount) throw (FlockException)
 remove agents starting from an agent index pAgentIndex start agent from where agents will be removed
void removeAgents () throw (FlockException)
 remove all agents from swarm
Exceptions:
FlockException failed to remove agents

unsigned int swarmParameterCount () const
 return number of swarm parameters the swarm contains
bool checkSwarmParameter (const base::String &pSwarmParameterName) const
 check if swarm has swarm parameter
ParameterswarmParameter (const base::String &pParameterName) throw (FlockException)
 get swarm parameter
ParameterswarmParameter (unsigned int pParameterIndex) throw (FlockException)
 get swarm parameter
Parameterparameter (unsigned int pAgentIndex, const base::String &pParameterName) throw (FlockException)
 get agent parameter
Parameterparameter (unsigned int pAgentIndex, unsigned int pParameterIndex) throw (FlockException)
 get agent parameter
ParameteragentParameter (unsigned int pAgentIndex, const base::String &pParameterName) throw (FlockException)
 get agent parameter
ParameteragentParameter (unsigned int pAgentIndex, unsigned int pParameterIndex) throw (FlockException)
 get agent parameter
void addParameter (Parameter *pParameter) throw (FlockException)
 add agent parameter
void addAgentParameter (Parameter *pParameter) throw (FlockException)
 add agent parameter
void addSwarmParameter (Parameter *pParameter) throw (FlockException)
 add swarm parameter
void addParameter (const base::String &pName, unsigned int pDim) throw (FlockException)
 create agent parameter
void addAgentParameter (const base::String &pName, unsigned int pDim) throw (FlockException)
 create agent parameter
void addSwarmParameter (const base::String &pName, unsigned int pDim) throw (FlockException)
 create swarm parameter
void addParameter (const base::String &pName, unsigned int pDim, real pValue) throw (FlockException)
 create agent parameter
void addAgentParameter (const base::String &pName, unsigned int pDim, real pValue) throw (FlockException)
 create agent parameter
void addSwarmParameter (const base::String &pName, unsigned int pDim, real pValue) throw (FlockException)
 create swarm parameter
void addParameter (const base::String &pName, const math::Vector< real > &pValues) throw (FlockException)
 create agent parameter
void addAgentParameter (const base::String &pName, const math::Vector< real > &pValues) throw (FlockException)
 create agent parameter
void addSwarmParameter (const base::String &pName, const math::Vector< real > &pValues) throw (FlockException)
 create swarm parameter
void removeParameter (const base::String pName) throw (FlockException)
 remove agent parameter
void removeAgentParameter (const base::String pName) throw (FlockException)
 remove agent parameter
void removeSwarmParameter (const base::String pName) throw (FlockException)
 remove agent parameter
void set (const base::String &pParameterName, real pParameterValue) throw (FlockException)
 set parameter values
void set (unsigned int pAgentIndex, const base::String &pParameterName, real pParameterValue) throw (FlockException)
 set parameter values
void set (const base::String &pParameterName, const math::Vector< real > &pParameterValues) throw (FlockException)
 set parameter values
void set (unsigned int pAgentIndex, const base::String &pParameterName, const math::Vector< real > &pParameterValues) throw (FlockException)
 set parameter values
void randomize (const base::String &pParameterName, real pMinParameterValue, real pMaxParameterValue) throw (FlockException)
 randomize parameter value
void randomize (unsigned int pAgentIndex, const base::String &pParameterName, real pMinParameterValue, real pMaxParameterValue) throw (FlockException)
 randomize parameter value
void randomize (const base::String &pParameterName, const math::Vector< real > &pMinParameterValues, const math::Vector< real > &pMaxParameterValues) throw (FlockException)
 randomize parameter values
void randomize (unsigned int pAgentIndex, const base::String &pParameterName, const math::Vector< real > &pMinParameterValues, const math::Vector< real > &pMaxParameterValues) throw (FlockException)
 randomize parameter values
QList< NeighborAssignInfo * > agentNeighborInfo (const base::String &pParameterName)
QList< NeighborAssignInfo * > swarmNeighborInfo (const base::String &pParameterName)
void assignNeighbors (const base::String &pParameterName, const base::String &pSpaceName, bool pVisible, space::NeighborGroupAlg *pNeighborGroupAlg) throw (FlockException)
 assign neighbors for an agent and/or swarm parameter
void assignAgentNeighbors (const base::String &pParameterName, const base::String &pSpaceName, bool pVisible, space::NeighborGroupAlg *pNeighborGroupAlg) throw (FlockException)
 assign neighbors for a agent parameter
void assignSwarmNeighbors (const base::String &pParameterName, const base::String &pSpaceName, bool pVisible, space::NeighborGroupAlg *pNeighborGroupAlg) throw (FlockException)
 assign neighbors for a swarm parameter
void assignNeighbors (const base::String &pParameterName, const base::String &pSpaceName, bool pVisible) throw (FlockException)
 assign neighbors for an agent parameter
void assignAgentNeighbors (const base::String &pParameterName, const base::String &pSpaceName, bool pVisible) throw (FlockException)
 assign neighbors for an agent parameter
void assignSwarmNeighbors (const base::String &pParameterName, const base::String &pSpaceName, bool pVisible) throw (FlockException)
 assign neighbors for a swarm parameter
void assignNeighbors (const base::String &pParameterName, const base::String &pSpaceName, bool pVisible, real pNeighborRadius, int pMaxNeighborCount, bool pReplaceNeighborMode) throw (FlockException)
 assign neighbors for an agent parameter
void assignAgentNeighbors (const base::String &pParameterName, const base::String &pSpaceName, bool pVisible, real pNeighborRadius, int pMaxNeighborCount, bool pReplaceNeighborMode) throw (FlockException)
 assign neighbors for an agent parameter
void assignSwarmNeighbors (const base::String &pParameterName, const base::String &pSpaceName, bool pVisible, real pNeighborRadius, int pMaxNeighborCount, bool pReplaceNeighborMode) throw (FlockException)
 assign neighbors for a swarm parameter
void removeNeighbors (const base::String &pParameterName, const base::String &pSpaceName) throw (FlockException)
 remove neighbors for an agent parameter
void removeAgentNeighbors (const base::String &pParameterName, const base::String &pSpaceName) throw (FlockException)
 remove neighbors for an agent parameter
void removeSwarmNeighbors (const base::String &pParameterName, const base::String &pSpaceName) throw (FlockException)
 remove neighbors for a swarm parameter
unsigned int swarmBehaviorCount () const
 return number of swarm behaviors the swarm contains
bool checkSwarmBehavior (const base::String &pSwarmBehaviorName) const
 check if swarm has swarm behavior
BehaviorswarmBehavior (const base::String &pBehaviorName) throw (FlockException)
 get swarm behavior
BehaviorswarmBehavior (unsigned int pBehaviorIndex) throw (FlockException)
 get swarm behavior
void addSwarmBehavior (Behavior *pBehavior) throw (FlockException)
 add agent behavior add agent behavior add swarm behavior
void addBehavior (const base::String &pBehaviorName, const Behavior &pBehavior) throw (FlockException)
 add agent behavior
void addBehavior (const base::String &pBehaviorName, unsigned int pBehaviorPosition, const Behavior &pBehavior) throw (FlockException)
 add agent behavior
void addBehavior (const base::String &pBehaviorName, const base::String &pSuccessorBehaviorName, const Behavior &pBehavior) throw (FlockException)
 add agent behavior
void moveBehavior (const base::String &pBehaviorName, unsigned int pBehaviorPosition) throw (FlockException)
 move agent behavior
void moveBehavior (const base::String &pBehaviorName, const base::String &pSuccessorBehaviorName) throw (FlockException)
 move agent behavior
void addAgentBehavior (const base::String &pBehaviorName, const Behavior &pBehavior) throw (FlockException)
 add agent behavior
void addAgentBehavior (const base::String &pBehaviorName, unsigned int pBehaviorPosition, const Behavior &pBehavior) throw (FlockException)
 add agent behavior
void addAgentBehavior (const base::String &pBehaviorName, const base::String &pSuccessorBehaviorName, const Behavior &pBehavior) throw (FlockException)
 add agent behavior
void moveAgentBehavior (const base::String &pBehaviorName, unsigned int pBehaviorPosition) throw (FlockException)
 move agent behavior
void moveAgentBehavior (const base::String &pBehaviorName, const base::String &pSuccessorBehaviorName) throw (FlockException)
 move agent behavior
void addSwarmBehavior (const base::String &pBehaviorName, const Behavior &pBehavior) throw (FlockException)
 add swarm behavior
void addSwarmBehavior (const base::String &pBehaviorName, unsigned int pBehaviorPosition, const Behavior &pBehavior) throw (FlockException)
 add swarm behavior
void addSwarmBehavior (const base::String &pBehaviorName, const base::String &pSuccessorBehaviorName, const Behavior &pBehavior) throw (FlockException)
 add swarm behavior
void moveSwarmBehavior (const base::String &pBehaviorName, unsigned int pBehaviorPosition) throw (FlockException)
 move swarm behavior
void moveSwarmBehavior (const base::String &pBehaviorName, const base::String &pSuccessorBehaviorName) throw (FlockException)
 move swarm behavior
void removeBehavior (const base::String &pBehaviorName) throw (FlockException)
 remove agent behavior
void removeAgentBehavior (const base::String &pBehaviorName) throw (FlockException)
 remove agent behavior
void removeSwarmBehavior (const base::String &pBehaviorName) throw (FlockException)
 remove swarm behavior
virtual void act ()
 perform behaviors
virtual void flush ()
 update parameters
void notify ()
 notify swarm whenever the simulation progresses a step
virtual base::String info (int pPropagationLevel=0) const
 print swarm information

Static Public Attributes

static unsigned int sInstanceCount
 number of agent instances

Protected Member Functions

 Swarm ()
 total number of swarm instances ever created default constructor

Protected Attributes

ParameterListmAgentParameterList
BehaviorListmAgentBehaviorList
 list of agent parameters
ParameterList mSwarmParameterList
 list of agent behaviors
BehaviorList mSwarmBehaviorList
 swarm exclusive list of parameters
QVector< Agent * > mAgents
 swarm exclusive list of behaviors
unsigned int mAgentCreationCount
 swarm agents
QHash< base::String, NeighborAssignInfo * > mAgentNeighborAssignRegistry
 numbers of agents ever created for this swarm
QHash< base::String, NeighborAssignInfo * > mSwarmNeighborAssignRegistry
 registry for all agent parameters that are assigned to some neighbor space

Friends

std::ostream & operator<< (std::ostream &pOstream, const Swarm &pSwarm)
 print swarm information

Constructor & Destructor Documentation

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

create swarm

Parameters:
pName swarm name

Swarm::Swarm ( const base::String &  pName,
Swarm pSwarm 
)

copy constructor

Parameters:
pName swarm name
pSwarm swarm to copy from

Swarm::~Swarm (  ) 

destructor

Swarm::Swarm (  )  [protected]

total number of swarm instances ever created default constructor


Member Function Documentation

unsigned int Swarm::agentCount (  )  const

return number of agents

Returns:
number of agents

QVector< Agent * > & Swarm::agents (  ) 

return agents

Returns:
agents

const QVector< Agent * > & Swarm::agents (  )  const

return agents

Returns:
agents

void Swarm::addAgent (  )  throw (FlockException)

add single agent to swarm

Exceptions:
FlockException failed to add agent

void Swarm::addAgents ( unsigned int  pAgentCount  )  throw (FlockException)

add a number of agents to swarm

Parameters:
pAgentCount number of agents to add
Exceptions:
FlockException failed to add agents

void Swarm::removeAgent (  )  throw (FlockException)

remove last agent from swarm

Exceptions:
FlockException failed to remove agent

void Swarm::removeAgent ( unsigned int  pAgentIndex  )  throw (FlockException)

remove particular agent from swarm

Exceptions:
FlockException failed to remove agent

void Swarm::removeAgents ( unsigned int  pAgentCount  )  throw (FlockException)

remove the last n agents from swarm

Parameters:
pAgentCount number of agents to remove
Exceptions:
FlockException failed to remove agents

void Swarm::removeAgents ( unsigned int  pAgentIndex,
unsigned int  pAgentCount 
) throw (FlockException)

remove agents starting from an agent index pAgentIndex start agent from where agents will be removed

Parameters:
pAgentCount number of agents to remove
Exceptions:
FlockException failed to remove agents

void Swarm::removeAgents (  )  throw (FlockException)

remove all agents from swarm

Exceptions:
FlockException failed to remove agents

unsigned int Swarm::swarmParameterCount (  )  const

return number of swarm parameters the swarm contains

Returns:
number of swarm parameters the swarm contains

bool Swarm::checkSwarmParameter ( const base::String &  pSwarmParameterName  )  const

check if swarm has swarm parameter

Parameters:
pSwarmParameterName swarm parameter name
Returns:
true if swarm possesses a particular swarm parameter

Parameter & Swarm::swarmParameter ( const base::String &  pParameterName  )  throw (FlockException)

get swarm parameter

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

Parameter & Swarm::swarmParameter ( unsigned int  pParameterIndex  )  throw (FlockException)

get swarm parameter

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

Parameter & Swarm::parameter ( unsigned int  pAgentIndex,
const base::String &  pParameterName 
) throw (FlockException)

get agent parameter

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

Parameter & Swarm::parameter ( unsigned int  pAgentIndex,
unsigned int  pParameterIndex 
) throw (FlockException)

get agent parameter

Parameters:
pAgentIndex agent index
pParameterIndex agent parameter index
Returns:
parameter
Exceptions:
FlockException agent does not exist or agent parameter does not exist

Parameter & Swarm::agentParameter ( unsigned int  pAgentIndex,
const base::String &  pParameterName 
) throw (FlockException)

get agent parameter

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

Parameter & Swarm::agentParameter ( unsigned int  pAgentIndex,
unsigned int  pParameterIndex 
) throw (FlockException)

get agent parameter

Parameters:
pAgentIndex agent index
pParameterIndex agent parameter index
Returns:
parameter
Exceptions:
FlockException agent does not exist or agent parameter does not exist

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

add agent parameter

Parameters:
pParameter agent parameter
Exceptions:
FlockException agent parameter name already exists

Reimplemented from iso::flock::Agent.

void Swarm::addAgentParameter ( Parameter pParameter  )  throw (FlockException)

add agent parameter

Parameters:
pParameter agent parameter
Exceptions:
FlockException agent parameter name already exists

void Swarm::addSwarmParameter ( Parameter pParameter  )  throw (FlockException)

add swarm parameter

Parameters:
pParameter swarm parameter
Exceptions:
FlockException swarm parameter name already exists

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

create agent parameter

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

Reimplemented from iso::flock::Agent.

void Swarm::addAgentParameter ( const base::String &  pName,
unsigned int  pDim 
) throw (FlockException)

create agent parameter

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

void Swarm::addSwarmParameter ( const base::String &  pName,
unsigned int  pDim 
) throw (FlockException)

create swarm parameter

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

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

create agent parameter

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

Reimplemented from iso::flock::Agent.

void Swarm::addAgentParameter ( const base::String &  pName,
unsigned int  pDim,
real  pValue 
) throw (FlockException)

create agent parameter

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

void Swarm::addSwarmParameter ( const base::String &  pName,
unsigned int  pDim,
real  pValue 
) throw (FlockException)

create swarm parameter

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

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

create agent parameter

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

Reimplemented from iso::flock::Agent.

void Swarm::addAgentParameter ( const base::String &  pName,
const math::Vector< real > &  pValues 
) throw (FlockException)

create agent parameter

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

void Swarm::addSwarmParameter ( const base::String &  pName,
const math::Vector< real > &  pValues 
) throw (FlockException)

create swarm parameter

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

void Swarm::removeParameter ( const base::String  pName  )  throw (FlockException)

remove agent parameter

Parameters:
pName agent parameter
Exceptions:
failed to remove agent parameter

void Swarm::removeAgentParameter ( const base::String  pName  )  throw (FlockException)

remove agent parameter

Parameters:
pName agent parameter
Exceptions:
failed to remove agent parameter

void Swarm::removeSwarmParameter ( const base::String  pName  )  throw (FlockException)

remove agent parameter

Parameters:
pName agent parameter
Exceptions:
failed to remove agent parameter

void Swarm::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 from iso::flock::Agent.

void Swarm::set ( unsigned int  pAgentIndex,
const base::String &  pParameterName,
real  pParameterValue 
) throw (FlockException)

set parameter values

Parameters:
pAgentIndex agent index
pParameterName parameter name
pParameterValue parameter value
Exceptions:
FlockException agent index out of bounds or parameter name is not found

void Swarm::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 from iso::flock::Agent.

void Swarm::set ( unsigned int  pAgentIndex,
const base::String &  pParameterName,
const math::Vector< real > &  pParameterValues 
) throw (FlockException)

set parameter values

Parameters:
pAgentIndex agent index
pParameterName parameter name
pParameterValues parameter values
Exceptions:
FlockException agent index out of bounds or parameter name is not found

void Swarm::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 from iso::flock::Agent.

void Swarm::randomize ( unsigned int  pAgentIndex,
const base::String &  pParameterName,
real  pMinParameterValue,
real  pMaxParameterValue 
) throw (FlockException)

randomize parameter value

Parameters:
pAgentIndex agent index
pParameterName parameter name
pMinParameterValue minimum parameter value
pMaxParameterValue maximum parameter value
Exceptions:
FlockException agent index out of bounds or parameter name is not found

void Swarm::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 from iso::flock::Agent.

void Swarm::randomize ( unsigned int  pAgentIndex,
const base::String &  pParameterName,
const math::Vector< real > &  pMinParameterValues,
const math::Vector< real > &  pMaxParameterValues 
) throw (FlockException)

randomize parameter values

Parameters:
pAgentIndex agent index
pParameterName parameter name
pMinParameterValues minimum parameter values
pMaxParameterValues maximum parameter values
Exceptions:
FlockException agent index out of bounds, parameter name not found or parameter values has wrong dimension

QList< NeighborAssignInfo * > Swarm::agentNeighborInfo ( const base::String &  pParameterName  ) 

QList< NeighborAssignInfo * > Swarm::swarmNeighborInfo ( const base::String &  pParameterName  ) 

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

assign neighbors for an agent and/or swarm 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 from iso::flock::Agent.

void Swarm::assignAgentNeighbors ( const base::String &  pParameterName,
const base::String &  pSpaceName,
bool  pVisible,
space::NeighborGroupAlg *  pNeighborGroupAlg 
) throw (FlockException)

assign neighbors for a agent parameter

Parameters:
pParameterName agent 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

void Swarm::assignSwarmNeighbors ( const base::String &  pParameterName,
const base::String &  pSpaceName,
bool  pVisible,
space::NeighborGroupAlg *  pNeighborGroupAlg 
) throw (FlockException)

assign neighbors for a swarm parameter

Parameters:
pParameterName swarm 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

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

assign neighbors for an agent 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 from iso::flock::Agent.

void Swarm::assignAgentNeighbors ( const base::String &  pParameterName,
const base::String &  pSpaceName,
bool  pVisible 
) throw (FlockException)

assign neighbors for an agent 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

void Swarm::assignSwarmNeighbors ( const base::String &  pParameterName,
const base::String &  pSpaceName,
bool  pVisible 
) throw (FlockException)

assign neighbors for a swarm 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

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

assign neighbors for an agent 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 from iso::flock::Agent.

void Swarm::assignAgentNeighbors ( const base::String &  pParameterName,
const base::String &  pSpaceName,
bool  pVisible,
real  pNeighborRadius,
int  pMaxNeighborCount,
bool  pReplaceNeighborMode 
) throw (FlockException)

assign neighbors for an agent 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.

void Swarm::assignSwarmNeighbors ( const base::String &  pParameterName,
const base::String &  pSpaceName,
bool  pVisible,
real  pNeighborRadius,
int  pMaxNeighborCount,
bool  pReplaceNeighborMode 
) throw (FlockException)

assign neighbors for a swarm 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.

void Swarm::removeNeighbors ( const base::String &  pParameterName,
const base::String &  pSpaceName 
) throw (FlockException)

remove neighbors for an agent parameter

Parameters:
pParameterName parameter name
pSpaceName name of neighbor space
Exceptions:
FlockException parameter not found, space not found

void Swarm::removeAgentNeighbors ( const base::String &  pParameterName,
const base::String &  pSpaceName 
) throw (FlockException)

remove neighbors for an agent parameter

Parameters:
pParameterName parameter name
pSpaceName name of neighbor space
Exceptions:
FlockException parameter not found, space not found

void Swarm::removeSwarmNeighbors ( const base::String &  pParameterName,
const base::String &  pSpaceName 
) throw (FlockException)

remove neighbors for a swarm parameter

Parameters:
pParameterName parameter name
pSpaceName name of neighbor space
Exceptions:
FlockException parameter not found, space not found

unsigned int Swarm::swarmBehaviorCount (  )  const

return number of swarm behaviors the swarm contains

Returns:
number of swarm behaviors the swarm contains

bool Swarm::checkSwarmBehavior ( const base::String &  pSwarmBehaviorName  )  const

check if swarm has swarm behavior

Parameters:
pSwarmBehaviorName swarm behavior name
Returns:
true if swarm possesses a particular swarm behavior

Behavior & Swarm::swarmBehavior ( const base::String &  pBehaviorName  )  throw (FlockException)

get swarm behavior

Parameters:
pBehaviorName swarm behavior name
Returns:
swarm behavior
Exceptions:
FlockException swarm behavior does not exist

Behavior & Swarm::swarmBehavior ( unsigned int  pBehaviorIndex  )  throw (FlockException)

get swarm behavior

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

void Swarm::addSwarmBehavior ( Behavior pBehavior  )  throw (FlockException)

add agent behavior add agent behavior add swarm behavior

Parameters:
pBehavior swarm behavior
Exceptions:
FlockException swarm behavior already exists

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

add agent behavior

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

Reimplemented from iso::flock::Agent.

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

add agent behavior

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

Reimplemented from iso::flock::Agent.

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

add agent 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 from iso::flock::Agent.

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

move agent behavior

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

Reimplemented from iso::flock::Agent.

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

move agent behavior

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

Reimplemented from iso::flock::Agent.

void Swarm::addAgentBehavior ( const base::String &  pBehaviorName,
const Behavior pBehavior 
) throw (FlockException)

add agent behavior

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

void Swarm::addAgentBehavior ( const base::String &  pBehaviorName,
unsigned int  pBehaviorPosition,
const Behavior pBehavior 
) throw (FlockException)

add agent behavior

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

void Swarm::addAgentBehavior ( const base::String &  pBehaviorName,
const base::String &  pSuccessorBehaviorName,
const Behavior pBehavior 
) throw (FlockException)

add agent 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

void Swarm::moveAgentBehavior ( const base::String &  pBehaviorName,
unsigned int  pBehaviorPosition 
) throw (FlockException)

move agent behavior

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

void Swarm::moveAgentBehavior ( const base::String &  pBehaviorName,
const base::String &  pSuccessorBehaviorName 
) throw (FlockException)

move agent behavior

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

void Swarm::addSwarmBehavior ( const base::String &  pBehaviorName,
const Behavior pBehavior 
) throw (FlockException)

add swarm behavior

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

void Swarm::addSwarmBehavior ( const base::String &  pBehaviorName,
unsigned int  pBehaviorPosition,
const Behavior pBehavior 
) throw (FlockException)

add swarm behavior

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

void Swarm::addSwarmBehavior ( const base::String &  pBehaviorName,
const base::String &  pSuccessorBehaviorName,
const Behavior pBehavior 
) throw (FlockException)

add swarm 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

void Swarm::moveSwarmBehavior ( const base::String &  pBehaviorName,
unsigned int  pBehaviorPosition 
) throw (FlockException)

move swarm behavior

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

void Swarm::moveSwarmBehavior ( const base::String &  pBehaviorName,
const base::String &  pSuccessorBehaviorName 
) throw (FlockException)

move swarm behavior

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

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

remove agent behavior

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

Reimplemented from iso::flock::Agent.

void Swarm::removeAgentBehavior ( const base::String &  pBehaviorName  )  throw (FlockException)

remove agent behavior

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

void Swarm::removeSwarmBehavior ( const base::String &  pBehaviorName  )  throw (FlockException)

remove swarm behavior

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

void Swarm::act (  )  [virtual]

perform behaviors

Reimplemented from iso::flock::Agent.

void Swarm::flush (  )  [virtual]

update parameters

Reimplemented from iso::flock::Agent.

void Swarm::notify (  ) 

notify swarm whenever the simulation progresses a step

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

print swarm information

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

Reimplemented from iso::flock::Agent.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  pOstream,
const Swarm pSwarm 
) [friend]

print swarm information


Member Data Documentation

unsigned int Swarm::sInstanceCount [static]

number of agent instances

Reimplemented from iso::flock::Agent.

ParameterList& iso::flock::Swarm::mAgentParameterList [protected]

BehaviorList& iso::flock::Swarm::mAgentBehaviorList [protected]

list of agent parameters

ParameterList iso::flock::Swarm::mSwarmParameterList [protected]

list of agent behaviors

BehaviorList iso::flock::Swarm::mSwarmBehaviorList [protected]

swarm exclusive list of parameters

QVector<Agent*> iso::flock::Swarm::mAgents [protected]

swarm exclusive list of behaviors

unsigned int iso::flock::Swarm::mAgentCreationCount [protected]

swarm agents

QHash< base::String, NeighborAssignInfo* > iso::flock::Swarm::mAgentNeighborAssignRegistry [protected]

numbers of agents ever created for this swarm

QHash< base::String, NeighborAssignInfo* > iso::flock::Swarm::mSwarmNeighborAssignRegistry [protected]

registry for all agent parameters that are assigned to some neighbor space


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