
* GenericComplexClass -> not needed right now! maybe use a simpler version which only provides toString()
	Any get(string id)
	has
	set(string id, Any);
	
* RemoteObject:
  <event> Connect
  <event> Disconnect
  <event> BeforeInvoke
  <event> AfterInvoke
  <event> BeforeReply
  <event> AfterReply
non-remote methods:
  connect(EndPoint) 
  disconnect(EndPoint)
  

the question is -> who is sending what to whom?
  - security checks
  - logging
  - Before- and AfterReply: split makes sense for skeleton side
  
* Skeleton  
 - contains RemoteObject
 - stores for each method a static const description: 
 		- string methodName
 		- one input ParameterInfo, which groups together all input params for the method
 		- one output ParameterInfo, which groups together all output params for the method
 		- a list of exceptions that the method can throw (simple strings like "Foundation::Exception", ...)
 			useful for webservices where this can also be defined and triggers generation of specially formatted XML messages
 		- one ParameterInfo has:
 			string paramName (for the root type this is the methodName)
 			bool isVector;
 			bool isComplexType -> redundant: check children count
 			?bool optional
 			?Any defaultValue
 			?Type type  (inparam, outparam, inoutparam)
 			std::string declarationType;
 			Children of type ParameterInfo
   the following non-remote(!) methods are offered:
 - connect(EndPoint) -> makes the object visible to the outside
 - disconnect(EndPoint) 
 			

* Proxy
 - contains a Transport (Serializer/Deserializer)
 - connect(EndPoint, string transport) -> establishes a connection to the defined endpoint
 - disconnect(EndPoint)
  
* Stub
 - contains either a proxy or a skeleton
 
* Skeleton, Proxy, Stub, all implement RemoteObject

* Skeleton, Proxy, Stubs are generated by manager class, which does garbage collection (or simply use SharedPtr?)
 and registers event listeners at the individual classes (depending on config)

		
Proxy, Skel + Stub are generated! no macro code!!!! Use the existing C++ parser (for pocodoc)
and extend it for that purpose

The RemoteObject:
Each method supports properties:
 - OneWay (aka Async)
 - Exclusive (ie. lock the object)
 - Remote: only method where this property is set are available remote! OneWay and exclusive are ignored without this property!
 
Other properties: 
 - Logging
 - Security

Should Properties be available on the class level too? (setting defaults per method)
 - synchronized
 - remote 
 - oneway
  
 
Due to c++ limitations properties must be hidden in a comment

//[remote, synchronized]
void mymethod(in i, int j);

Properties influence the way, skeleton, stub and proxy code are generated.

*******************************************
	 		

Common Serializer Interface:
*	  Serializer(outputStream)
	  serializeRequest(MethodInfo, const Any& a);
	  serializeResponse(MethodInfo, const Any& a);
	  serializeFault(MethodInfo, const Any& a, Exception&);
	  serializeHeaderStart(MethodInfo);
	  serializeHeaderEnd(MethodInfo);
	  serializeComplexTypeStart(ParamInfo);
	  serializeComplexTypeEnd(ParamInfo);
	  
	  serialize(const ParamInfo& pi, int i);
	  serialize(const ParamInfo& pi, double j);
	  serialize <T> (const ParamInfo& pi, const std::vector < T >& vec);
	  [...]
	  
A TypeSerializer has the following interface:
 	serialize(const ParamInfo& pi, const Any& value, Serializer& output) 
	  
  
Example: XML transport of a method call "void mymethod(int i, float j, SomeComplexClass& scs)":
 The XML transport uses XMLSerializer: Serializer
 
 
 For each primitive data type it has to provide a TypeSerializer (suppose, we have that for int, double, float),
 template data types like map, vector, list,... are also supported (VectorSerializer < TypeSerializer >)
 
 The code generator has generated
   - a proxy class
   - a skel class
   - a stub class
   
For each method the code generator has generated a datatype plus TypeSerializer.
For "void mymethod(int i, float j, SomeComplexClass& scs)":
 MyMethodData : GenericComplexClass
 	getI
 	getJ
 	getSomeComplexClass
 	setI ....
 	hasI ....
 	

 MyMethodSer: TypeSerializer
 	serialize(const ParamInfo& pi, const Any& a, Serializer& out)
 	{
 		const MyMethodData& myData = RefAnyCast <...>(a);
 		out.serialize(pi.get("i"), myData.getI());
 		out.serialize(pi.get("j"), myData.getJ());
 		
 		const ParamInfo& scs = pi.get("scs");
 		// assume scs.isOptional(), note that if scs.hasDefaultValue() constructors for the class will already be generated with that default value set, so no need to check that here
 		if (myData.hasSomeComplexClass())
 		{
 			out.serializeComplexTypeStart(scs);
 			SomeComplexClassSerializer::serialize(scs, myData.getSomeComplexClass(), out);
 			out.serializeComplexTypeEnd(scs);
 		}
 	}
  
 
Serializers for complex data types are added to the XML transport serializer during program start-up by some static init routine,
i.e. MyMethodSer is registered as serializer for type_info(MyMethodData)


void mymethod(int i, float j, SomeComplexClass& scs)
{
	MyMethodData d(i,j, scs);
	xmlTransport.prepareOneWayStart(getMethodInfo("mymethod"));
	GenSerializer < MyMethodData>::serialize(x,y, xmlTransport.baseSerializer());
	xmlTransport.prepareOneWayEnd(getMethodInfo("mymethod"));
	
	Any data(d);
	Event.notify(d); 
	xmlTransport.executeOneWay(getMethodInfo("mymethod"), data) 
	{
		[...]
		-> xmlSerializer.serializeHeaderStart("mymethod");
		-> xmlSerializer.serialize(getParamInfo("mymethod"), d, output);
		-> xmlSerializer.serializeHeaderEnd("mymethod");
		[...]
	}
}

The skeleton code:
	- Deserializer deser(iStream);
		- parse until method name is known
		- fetch methodinfo/paraminfo from the skeleton
		- continue parsing
	- once parsing is done and the input is successfully reconstructed, throw events and execute the method call in a try catch block which is
	  generated based on the list of allowed exceptions per method
	- serialize the response/fault (if any)
	
***********************************************

Configuration:
- how to specify which remoteobjects should be started at which end-point
- how to announce that to the client


***********************************************

Transport
 - void executeOneWay(MethodInfo, const Any& input);
 - void execute(MethodInfo, const Any& input, Any& output);
 - AsyncHandler executeAsync(MethodInfo, const Any& input);
 - void connect(EndPoint);
 - void disconnect(EndPoint);
 - bool isAlive();
 
***********************************************

Listener foreach transport