1
0
mirror of https://github.com/stefanocasazza/ULib.git synced 2025-09-28 19:05:55 +08:00
ULib/include/ulib/net/rpc/rpc_parser.h
2015-01-23 17:24:36 +01:00

93 lines
2.3 KiB
Objective-C

// ============================================================================
//
// = LIBRARY
// ULib - c++ library
//
// = FILENAME
// rpc_parser.h - RPC parser
//
// = AUTHOR
// Stefano Casazza
//
// ============================================================================
#ifndef ULIB_RPC_PARSER_H
#define ULIB_RPC_PARSER_H 1
#include <ulib/net/rpc/rpc.h>
#include <ulib/net/rpc/rpc_envelope.h>
/**
@class URPCParser
@brief URPCParser is a parser RPC
*/
class URPCObject;
class U_EXPORT URPCParser {
public:
// Check for memory error
U_MEMORY_TEST
// Allocator e Deallocator
U_MEMORY_ALLOCATOR
U_MEMORY_DEALLOCATOR
// COSTRUTTORI
URPCParser(UVector<UString>* arg = 0);
~URPCParser()
{
U_TRACE_UNREGISTER_OBJECT(0, URPCParser)
clearData();
U_INTERNAL_ASSERT_POINTER(envelope.arg)
delete envelope.arg;
}
// SERVICES
void clearData();
UVector<UString>& getArgument() { return *(envelope.arg); }
UString getNsName() const { return envelope.nsName; } // return the name of namespace qualified
// element information
UString getMethodName() const { return envelope.methodName; } // return the name of the method
// the caller wants to execute
// ---------------------------------------------------------------------
// Given a URPCObject this calls the appropriate URPCMethod.
// If this fails, ask for a URPCFault. Returns a RPC send-ready response
// ---------------------------------------------------------------------
// bContainsFault: Indicates if the returned string contains a fault
// ---------------------------------------------------------------------
UString processMessage(const UString& msg, URPCObject& object, bool& bContainsFault);
// DEBUG
#if defined(U_STDCPP_ENABLE) && defined(DEBUG)
const char* dump(bool reset) const;
#endif
protected:
URPCEnvelope envelope;
private:
#ifdef U_COMPILER_DELETE_MEMBERS
URPCParser(const URPCParser&) = delete;
URPCParser& operator=(const URPCParser&) = delete;
#else
URPCParser(const URPCParser&) {}
URPCParser& operator=(const URPCParser&) { return *this; }
#endif
};
#endif