21 #include "cafDocument.h"
22 #include "cafLogger.h"
23 #include "cafNotNull.h"
24 #include "cafPortableDataType.h"
25 #include "cafSession.h"
40 Client(
const std::string& hostname,
int port )
41 : m_hostname( hostname )
45 virtual ~
Client() =
default;
48 virtual std::shared_ptr<caffa::ObjectHandle> document(
const std::string& documentId )
const = 0;
49 virtual std::vector<std::shared_ptr<caffa::ObjectHandle>> documents()
const = 0;
50 virtual std::string execute( caffa::not_null<const caffa::ObjectHandle*> selfObject,
51 const std::string& methodName,
52 const std::string& jsonArguments )
const = 0;
53 virtual bool stopServer() = 0;
54 virtual void sendKeepAlive() = 0;
62 virtual void changeSession( caffa::Session::Type newType ) = 0;
63 virtual void destroySession() = 0;
64 virtual const std::string& sessionUuid()
const = 0;
65 virtual void startKeepAliveThread() = 0;
67 template <
typename DataType>
70 template <
typename DataType>
73 virtual std::shared_ptr<caffa::ObjectHandle> getShallowCopyOfChildObject(
const caffa::ObjectHandle* objectHandle,
74 const std::string& fieldName )
const = 0;
76 virtual std::shared_ptr<caffa::ObjectHandle> getDeepCopyOfChildObject(
const caffa::ObjectHandle* objectHandle,
77 const std::string& fieldName )
const = 0;
79 const std::string& fieldName,
82 virtual std::vector<std::shared_ptr<caffa::ObjectHandle>> getChildObjects(
const caffa::ObjectHandle* objectHandle,
83 const std::string& fieldName )
const = 0;
86 const std::string& fieldName,
90 removeChildObject(
const caffa::ObjectHandle* objectHandle,
const std::string& fieldName,
size_t index ) = 0;
92 virtual void clearChildObjects(
const caffa::ObjectHandle* objectHandle,
const std::string& fieldName ) = 0;
95 const std::string& fieldName,
99 const std::string& hostname()
const {
return m_hostname; }
100 int port()
const {
return m_port; }
104 setJson(
const caffa::ObjectHandle* objectHandle,
const std::string& fieldName,
const nlohmann::json& value ) = 0;
105 virtual nlohmann::json getJson(
const caffa::ObjectHandle*,
const std::string& fieldName )
const = 0;
108 std::string m_hostname;
115 template <
typename DataType>
118 nlohmann::json jsonValue = getJson( objectHandle, fieldName );
119 return jsonValue.get<DataType>();
125 template <
typename DataType>
128 nlohmann::json jsonValue = value;
129 setJson( objectHandle, fieldName, jsonValue );
Definition: cafObjectHandle.h:55
Definition: cafRpcClient.h:38
DataType get(const caffa::ObjectHandle *objectHandle, const std::string &fieldName) const
Get a value through RPC.
Definition: cafRpcClient.h:116
void set(const caffa::ObjectHandle *objectHandle, const std::string &fieldName, const DataType &value)
Set a value through RPC.
Definition: cafRpcClient.h:126
virtual caffa::Session::Type checkSession() const =0
Check the session. Will return a session type (including possibly INVALID) if the session exists....
Main Caffa namespace.
Definition: __init__.py:1
Basic Application Information.
Definition: cafApplication.h:39