LibMC::MCAgent Class Reference
Wrapper class for MCAgent_t structure.
More...
Public Types
Enum for describing the type of an agent.
More...
Enum for describing the status of an agent.
More...
Public Member Functions
Default constructor.
Display the agent's fields.
Deletes an agent.
Gets the agent's XML string.
Gets the agent's C code string.
Gets the agent's C code string.
Terminates an agent.
Posts an ACL message to the agent.
Retrieve an ACL message from the agent.
Wait for and retrieve an ACL message from the agent.
Calls a function in an agent script.
Calls a function in an agent script.
Gets an agent's Ch interpreter.
Calls a function in an agent script.
Static Public Member Functions
Properties
internal IntPtr
Agent [get, set]
Gets the agent's ID number.
Gets the agent's name.
Gets the agent's number of tasks.
Gets or sets the agent's status.
Gets the agent's type.
Checks whether the agent is valid.
Private Member Functions
Private Attributes
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 61 of file MCAgent.cs.
Member Enumeration Documentation
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 75 of file MCAgent.cs.
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 88 of file MCAgent.cs.
Constructor & Destructor Documentation
LibMC::MCAgent::MCAgent
(
)
[inline]
internal LibMC::MCAgent::MCAgent
(
IntPtr
ip
)
[inline, private]
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 126 of file MCAgent.cs.
References AgentID, AgentName, AgentNumTasks, AgentStatus, and AgentType.
void LibMC::MCAgent::GetAgentFields
(
)
[inline, private]
static implicit LibMC::MCAgent::operator IntPtr
(
MCAgent
agent
)
[inline, static]
static implicit LibMC::MCAgent::operator
MCAgent
(
IntPtr
ip
)
[inline, static]
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 322 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 335 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 348 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 360 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 373 of file MCAgent.cs.
References Agent.
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 398 of file MCAgent.cs.
References LibMC::MCAclMessage::AclMsg, and Agent.
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 414 of file MCAgent.cs.
References Agent.
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 433 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! If possible, use the other CallAgentFunc that handles marshaling automatically.
- See also:
- Overloaded CallAgentFunc, LibMCConsole example
Definition at line 459 of file MCAgent.cs.
References Agent.
Referenced by CallAgentFunc().
int LibMC::MCAgent::CallAgentFunc
(
String
funcName,
ref object
retval,
ref object
varg
)
[inline]
Calls a function in an agent script.
Calls a function in an agent's script file. This function requires boxing of parameters, but no marshaling.
- Parameters:
-
funcName The name of the function to call
retval A boxed object to hold the return value
varg The boxed argument to the agent function
- Returns:
- The return value of the underlying MC_CallAgentFunc function call.
- Note:
- This function handles marshaling of the argument and return value. The memory provided to the agent function for both retval and varg is not preserved after this function call! If the memory is to be kept by the agent, use the manually marshaled version of this function. Also note that even though structures can be marshaled automatically, in this function, the type of the structure is unknown and therefore it must be handled manually, even though the marshaling is transparent to the user.
- See also:
- Overloaded CallAgentFunc, LibMCConsole example
Definition at line 489 of file MCAgent.cs.
References CallAgentFunc().
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 534 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 555 of file MCAgent.cs.
Field Documentation
Property Documentation
internal IntPtr LibMC::MCAgent::Agent [get, set, private]
Definition at line 143 of file MCAgent.cs.
Referenced by AclPost(), AclRetrieve(), AclWaitRetrieve(), LibMC::MCAgency::AddAgent(), CallAgentFunc(), DeleteAgent(), GetAgentExecEngine(), GetAgentFields(), GetAgentXMLString(), MCAgent(), 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 181 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 201 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 220 of file MCAgent.cs.
Referenced by ToString().
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 242 of file MCAgent.cs.
Referenced by ToString().
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 264 of file MCAgent.cs.
Referenced by ToString().
bool LibMC::MCAgent::Valid [get]
Checks whether the agent is valid.
Checks the internal agent pointer to see if it is non-zero.
- Returns:
- True if the pointer is valid, false otherwise
Definition at line 286 of file MCAgent.cs.
The documentation for this class was generated from the following file:
- /home/dko/projects/mobilec/trunk/src/win32/LibMC.net/LibMC/MCAgent.cs