Turi Create  4.0
object_factory_base.hpp
1 /* Copyright © 2017 Apple Inc. All rights reserved.
2  *
3  * Use of this source code is governed by a BSD-3-clause license that can
4  * be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
5  */
6 #ifndef CPPIPC_COMMON_OBJECT_FACTORY_BASE_HPP
7 #define CPPIPC_COMMON_OBJECT_FACTORY_BASE_HPP
8 #include <map>
9 #include <string>
10 #include <typeinfo>
11 #include <core/system/cppipc/cppipc.hpp>
12 namespace cppipc {
13 
14 
15 /**
16  * \internal
17  * \ingroup cppipc
18  * The object factory is the root object and has special powers.
19  */
21  public:
22  /**
23  * Creates an object with type "objectname" on the server
24  * and returns the object ID of the object
25  */
26  virtual size_t make_object(std::string objectname) = 0;
27 
28  /**
29  * Replies with the pingval.
30  */
31  virtual std::string ping(std::string pingval) = 0;
32 
33  /**
34  * Deletes the object refered to by an object ID
35  */
36  virtual void delete_object(size_t object_id) = 0;
37 
38  /**
39  * Get the address on which the server is publishing status updates.
40  */
41  virtual std::string get_status_publish_address() = 0;
42 
43  /**
44  * Get the address which the server is receiving control messages
45  */
46  virtual std::string get_control_address() = 0;
47 
48  /**
49  * Takes a list of active objects on the client side and garbage collects
50  * the objects on the server that are now unused by the client.
51  *
52  * If active_list is true, the object_ids refer to the list of objects that
53  * are still active: in other words, the server should delete any objects that
54  * are not in the active_list.
55  *
56  * If active_list is false, the object_ids refer to the list of objects that
57  * are no longer active: in other words, the server should delete any objects
58  * that are in the active list
59  */
60  virtual void sync_objects(std::vector<size_t> object_ids, bool active_list) = 0;
61 
62  virtual ~object_factory_base() { }
63 
64  REGISTRATION_BEGIN(object_factory)
71  REGISTRATION_END
72 };
73 
74 
75 
76 } // cppipc
77 #endif
virtual void delete_object(size_t object_id)=0
virtual std::string get_status_publish_address()=0
virtual std::string get_control_address()=0
virtual size_t make_object(std::string objectname)=0
#define REGISTRATION_BEGIN(name)
virtual std::string ping(std::string pingval)=0
virtual void sync_objects(std::vector< size_t > object_ids, bool active_list)=0