LibMC::MCAgent Class Reference

Wrapper class for MCAgent_t structure. More...


Public Types

enum  MC_AgentType_e
 Enum for describing the type of an agent. More...
enum  MC_AgentStatus_e
 Enum for describing the status of an agent. More...

Public Member Functions

 MCAgent ()
 Default constructor.
override string ToString ()
 Display the agent's fields.
int DeleteAgent ()
 Deletes an agent.
String GetAgentXMLString ()
 Gets the agent's XML string.
int PrintAgentCode ()
 Gets the agent's C code string.
String RetrieveAgentCode ()
 Gets the agent's C code string.
int TerminateAgent ()
 Terminates an agent.
int AclPost (MCAclMessage message)
 Posts an ACL message to the agent.
MCAclMessage AclRetrieve ()
 Retrieve an ACL message from the agent.
MCAclMessage AclWaitRetrieve ()
 Wait for and retrieve an ACL message from the agent.
int CallAgentFunc (String funcName, IntPtr retval, IntPtr varg)
 Calls a function in an agent script.
IntPtr GetAgentExecEngine ()
 Gets an agent's Ch interpreter.
int GetAgentReturnData (int task_num, IntPtr data, IntPtr dim, IntPtr extent)
 Calls a function in an agent script.

Static Public Member Functions

static implicit operator IntPtr (MCAgent agent)
static implicit operator MCAgent (IntPtr ip)

Properties

internal IntPtr Agent [get, set]
int AgentID [get]
 Gets the agent's ID number.
String AgentName [get]
 Gets the agent's name.
int AgentNumTasks [get]
 Gets the agent's number of tasks.
MC_AgentStatus_e AgentStatus [get, set]
 Gets or sets the agent's status.
MC_AgentType_e AgentType [get]
 Gets the agent's type.

Private Member Functions

internal MCAgent (IntPtr ip)
void GetAgentFields ()

Private Attributes

IntPtr agent_p
String name = ""
int id = -1
int numTasks = -1
MC_AgentStatus_e status = MC_AgentStatus_e.MC_NO_STATUS
MC_AgentType_e type = MC_AgentType_e.MC_NONE


Detailed Description

Wrapper class for MCAgent_t structure.

This class provides an interface to the Mobile-C agent structure. Member functions for the class are generally overloaded versions of the respective functions in the Mobile-C library. The class maintains a pointer to a Mobile-C agent in unmanaged memory. The pointer is not accessible by the user.

Definition at line 60 of file MCAgent.cs.


Member Enumeration Documentation

enum LibMC::MCAgent::MC_AgentType_e

Enum for describing the type of an agent.

Note:
This enum is pulled directly from the Mobile-C library.
Enumerator:
MC_NONE  Default value to describe unininitialized agent.
MC_REMOTE_AGENT  A remote agent.
MC_LOCAL_AGENT  A local agent.
MC_RETURN_AGENT  A returning agent.

Definition at line 74 of file MCAgent.cs.

enum LibMC::MCAgent::MC_AgentStatus_e

Enum for describing the status of an agent.

Note:
This enum is pulled directly from the Mobile-C library.
Enumerator:
MC_NO_STATUS  Default value for uninitialized agent
MC_WAIT_CH  Waiting to be started
MC_WAIT_MESSGSEND  Finished, waiting to migrate
MC_AGENT_ACTIVE  Running
MC_AGENT_NEUTRAL  Not running, but do not flush
MC_AGENT_SUSPENDED  Unused
MC_WAIT_FINISHED  Finished, waiting to be flushed

Definition at line 87 of file MCAgent.cs.


Constructor & Destructor Documentation

LibMC::MCAgent::MCAgent (  )  [inline]

Default constructor.

Creates an empty agent.

Definition at line 103 of file MCAgent.cs.

Referenced by operator MCAgent().

internal LibMC::MCAgent::MCAgent ( IntPtr  ip  )  [inline, private]

Definition at line 109 of file MCAgent.cs.

References Agent.


Member Function Documentation

override string LibMC::MCAgent::ToString (  )  [inline]

Display the agent's fields.

Formats an returns a string with all of the agents properties.

Returns:
A string containing a formatted representation of the agent's properties.
Note:
The agency port and any other options must be set before calling this function.

Definition at line 125 of file MCAgent.cs.

References AgentID, AgentName, AgentNumTasks, AgentStatus, and AgentType.

void LibMC::MCAgent::GetAgentFields (  )  [inline, private]

Definition at line 162 of file MCAgent.cs.

References Agent, name, numTasks, status, and type.

static implicit LibMC::MCAgent::operator IntPtr ( MCAgent  agent  )  [inline, static]

Definition at line 277 of file MCAgent.cs.

References Agent.

static implicit LibMC::MCAgent::operator MCAgent ( IntPtr  ip  )  [inline, static]

Definition at line 282 of file MCAgent.cs.

References MCAgent().

int LibMC::MCAgent::DeleteAgent (  )  [inline]

Deletes an agent.

Deletes an agent from the agency.

Returns:
The return value of the underlying MC_DeleteAgent function call.

Definition at line 299 of file MCAgent.cs.

References Agent.

String LibMC::MCAgent::GetAgentXMLString (  )  [inline]

Gets the agent's XML string.

Returns the full XML string associated with the agent.

Returns:
The return value of the underlying MC_GetAgentXMLString function call.

Definition at line 312 of file MCAgent.cs.

References Agent.

int LibMC::MCAgent::PrintAgentCode (  )  [inline]

Gets the agent's C code string.

Prints the C code associated with the agent to stdout.

Returns:
The return value of the underlying MC_PrintAgentCode function call.

Definition at line 325 of file MCAgent.cs.

References Agent.

String LibMC::MCAgent::RetrieveAgentCode (  )  [inline]

Gets the agent's C code string.

Returns the C code associated with the agent.

Returns:
A string containing the agent's C code.

Definition at line 337 of file MCAgent.cs.

References Agent.

int LibMC::MCAgent::TerminateAgent (  )  [inline]

Terminates an agent.

Terminates an agent regardless of the agent's state.

Returns:
The return value of the underlying MC_TerminateAgent function call.

Definition at line 350 of file MCAgent.cs.

References Agent.

int LibMC::MCAgent::AclPost ( MCAclMessage  message  )  [inline]

Posts an ACL message to the agent.

Delivers an ACL message to the agent.

Parameters:
message The ACL message object to deliver.
Returns:
The return value of the underlying MC_AclPost function call.
Note:
The message must be a valid message or this function call will fail.

Definition at line 375 of file MCAgent.cs.

References LibMC::MCAclMessage::AclMsg, and Agent.

MCAclMessage LibMC::MCAgent::AclRetrieve (  )  [inline]

Retrieve an ACL message from the agent.

Retrieves an ACL message from the agent if one is available.

Returns:
The ACL message or a blank ACL message if one was not available.
Note:
The message must be a valid message or this function call will fail.

Definition at line 391 of file MCAgent.cs.

References Agent.

MCAclMessage LibMC::MCAgent::AclWaitRetrieve (  )  [inline]

Wait for and retrieve an ACL message from the agent.

Retrieves an ACL message from the agent when one becomes available.

Returns:
The ACL message or a blank ACL message if the call fails.
Note:
This function call blocks.

Definition at line 410 of file MCAgent.cs.

References Agent.

int LibMC::MCAgent::CallAgentFunc ( String  funcName,
IntPtr  retval,
IntPtr  varg 
) [inline]

Calls a function in an agent script.

Calls a function in an agent's script file. This function requires manual marshaling by the user.

Parameters:
funcName The name of the function to call
retval A pointer to memory for the return value
varg A pointer to the argument for the function
Returns:
The return value of the underlying MC_CallAgentFunc function call.
Note:
BE VERY CAREFUL! You must marshal your arguments!
Todo:
Find a better way to handle retval and varg

Definition at line 434 of file MCAgent.cs.

References Agent.

IntPtr LibMC::MCAgent::GetAgentExecEngine (  )  [inline]

Gets an agent's Ch interpreter.

Gets a pointer to the agent's Ch interpreter. Will be improved shortly.

Returns:
A pointer to the Ch interpreter.
Note:
Nothing in the LibMC.NET library can make use of the Ch interpreter yet.
Todo:
Wrap MC_GetAgentExecEngine with an object for the void* pointer return type (Ch interpreter).

Definition at line 451 of file MCAgent.cs.

References Agent.

int LibMC::MCAgent::GetAgentReturnData ( int  task_num,
IntPtr  data,
IntPtr  dim,
IntPtr  extent 
) [inline]

Calls a function in an agent script.

Calls a function in an agent's script file. This function requires manual marshaling by the user.

Parameters:
task_num Task number to get data from
data A pointer to memory for the data
dim A pointer to hold the dimensions of the data
extent A pointer to hold the dimensions of the data
Returns:
The return value of the underlying MC_GetAgentReturnData function call.
Note:
This function does nothing but throw an exception right now.
Todo:
Implement GetAgentReturnData

Definition at line 472 of file MCAgent.cs.


Field Documentation

IntPtr LibMC::MCAgent::agent_p [private]

Definition at line 62 of file MCAgent.cs.

String LibMC::MCAgent::name = "" [private]

Definition at line 63 of file MCAgent.cs.

Referenced by GetAgentFields().

int LibMC::MCAgent::id = -1 [private]

Definition at line 64 of file MCAgent.cs.

int LibMC::MCAgent::numTasks = -1 [private]

Definition at line 65 of file MCAgent.cs.

Referenced by GetAgentFields().

MC_AgentStatus_e LibMC::MCAgent::status = MC_AgentStatus_e.MC_NO_STATUS [private]

Definition at line 66 of file MCAgent.cs.

Referenced by GetAgentFields().

MC_AgentType_e LibMC::MCAgent::type = MC_AgentType_e.MC_NONE [private]

Definition at line 67 of file MCAgent.cs.

Referenced by GetAgentFields().


Property Documentation

internal IntPtr LibMC::MCAgent::Agent [get, set, private]

Definition at line 142 of file MCAgent.cs.

Referenced by AclPost(), AclRetrieve(), AclWaitRetrieve(), LibMC::MCAgency::AddAgent(), CallAgentFunc(), DeleteAgent(), GetAgentExecEngine(), GetAgentFields(), GetAgentXMLString(), MCAgent(), operator IntPtr(), PrintAgentCode(), LibMC::MCAgency::RegisterService(), RetrieveAgentCode(), and TerminateAgent().

int LibMC::MCAgent::AgentID [get]

Gets the agent's ID number.

Gets the agent's ID number as assigned by Mobile-C if the agent is a valid agent.

Returns:
The agent's ID number or -1 for an empty agent.

Definition at line 180 of file MCAgent.cs.

Referenced by ToString().

String LibMC::MCAgent::AgentName [get]

Gets the agent's name.

Gets the agent's name as assigned by Mobile-C or the agent script if the agent is a valid agent.

Returns:
The agent's name or an empty string for an empty agent.

Definition at line 200 of file MCAgent.cs.

Referenced by ToString().

int LibMC::MCAgent::AgentNumTasks [get]

Gets the agent's number of tasks.

Gets the agent's ID number of tasks if the agent is a valid agent.

Returns:
The agent's ID number of tasks or -1 for an empty agent.

Definition at line 219 of file MCAgent.cs.

Referenced by ToString().

MC_AgentStatus_e LibMC::MCAgent::AgentStatus [get, set]

Gets or sets the agent's status.

Gets or sets the agent's status. When setting the status, the status is double-checked after setting it and may not be set depending on the state of the agent and the agency.

Returns:
The agent's status or MC_NO_STATUS for an empty agent.

Definition at line 241 of file MCAgent.cs.

Referenced by ToString().

MC_AgentType_e LibMC::MCAgent::AgentType [get]

Gets the agent's type.

Gets the agent's type.

Returns:
The agent's type or MC_NONE for an empty agent.

Definition at line 263 of file MCAgent.cs.

Referenced by ToString().


The documentation for this class was generated from the following file:
Generated on Mon Jun 23 16:01:18 2008 for Mobile-C by  doxygen 1.5.4