About
The Software Agent paradigm is a powerful abstract view of network programming. While arguably not well suited for high-performance computing, few development techniques can out pace agents for rapidly prototyping network applications.
Unfortunately for the C/C++ community, and the communities of alternative languages, the advantage of agents has been mostly limited to Java - the language most platforms are developed in. I prefer C++ to Java and I've had more than a few weekend projects which would have benefited greatly from the software agent paradigm.
I wrote this small agent package to help fill the void. This is an alpha release. It contains only the barest essentials - the finite state transducer. In the (hopefully) near future, a complementary package will be released for supporting network communications and message passing.
After the message passing interface is in place, I'll start work on documentation. Until then here is a brief description of how to get started.
Architecture
There really is no platform here, the OS is the platform. An agent is a process running a finite state transducer, in which each state is associated with a function. These functions are often called Behaviors; in SPRAC++ they're called Actions. When an agent's state transitions, the function associated with the new state is called.
In SPRAC++, each behavior is implemented as a class derived from the base class AgentAction. Actions are easy to write, simply overload the action() function. Any action may retain local variables and declare public/private methods for manipulating its local variables.
Agents in SPRAC++ are derived from the base class Agent. The agent class defines what actions the agent is capable of. The actions are tied to programmer defined states in either the agent constructor (which may be overloaded - so long as the base class constructor is also called) or the init() function. The init() function is called just before the state machine is engaged. The state machine may be engaged by calling the agent's run() function. Finally, cleanup routines may be run from either an overloaded de-constructor or the overloaded function cleanup().
References to an agent's local variables may be exposed to a behavior through the AgentVariables interface. A pointer to the variable is passed in, along with a reference tag. The programmer then uses the reference tag to retrieve the reference to the variable or object. It is up to the programmer to ensure that the variable pointer is valid (i.e. that the object has not been released from memory), but if the variables are declared as private members (not dynamically allocated private members mind you) then they are assured to be valid while the agent is running.
Documentation
Coming soon.... well, okay, so this will be the last section to get filled in. For now, just look at the HelloWorldAgent example and let your curiosity lead you.
TODO
Add network & messaging support via libsprac-net.
Build more examples using network messaging.
Write a better section to describe the architecture.
Write some programming documentation.
Contributions
Contributions are welcome, of course. Send patches to austirg@cs.okstate.edu. Credit will be given for any patches accepted for commit.
License
This software is being released under a BSD-style license, give credit where credit is due. Enjoy.