Ice 3.8
C++ API Reference
Loading...
Searching...
No Matches
NativePropertiesAdmin.h
1// Copyright (c) ZeroC, Inc.
2
3#ifndef ICE_NATIVE_PROPERTIES_ADMIN_H
4#define ICE_NATIVE_PROPERTIES_ADMIN_H
5
6#include "Ice/PropertiesAdmin.h"
7#include "Ice/PropertyDict.h"
8
9#include <functional>
10#include <list>
11#include <memory>
12#include <mutex>
13
14namespace Ice
15{
16 /// The default implementation for the "Properties" admin facet.
17 /// @headerfile Ice/Ice.h
18 class ICE_API NativePropertiesAdmin final : public PropertiesAdmin,
19 public std::enable_shared_from_this<NativePropertiesAdmin>
20 {
21 public:
22 /// Constructs a NativePropertiesAdmin.
23 /// @param properties The properties to manage.
24 /// @param logger The logger to use for logging.
26
28
29 std::string getProperty(std::string key, const Current& current) final;
30
31 PropertyDict getPropertiesForPrefix(std::string prefix, const Current& current) final;
32
33 void setProperties(PropertyDict newProperties, const Current& current) final;
34
35 /// Registers an update callback that will be invoked when a property update occurs.
36 /// @param cb The callback.
37 /// @return A function that unregisters the callback.
38 std::function<void()> addUpdateCallback(std::function<void(const PropertyDict&)> cb);
39
40 private:
41 void removeUpdateCallback(std::list<std::function<void(const PropertyDict&)>>::iterator p);
42
43 const PropertiesPtr _properties;
44 const LoggerPtr _logger;
45 std::recursive_mutex _mutex;
46
47 std::list<std::function<void(const PropertyDict&)>> _updateCallbacks;
48 };
49
50 /// A shared pointer to a NativePropertiesAdmin.
52}
53
54#endif
PropertyDict getPropertiesForPrefix(std::string prefix, const Current &current) final
Gets all properties whose keys begin with prefix.
std::function< void()> addUpdateCallback(std::function< void(const PropertyDict &)> cb)
Registers an update callback that will be invoked when a property update occurs.
void setProperties(PropertyDict newProperties, const Current &current) final
Updates the communicator's properties with the given property set.
std::string getProperty(std::string key, const Current &current) final
Gets a property by key.
NativePropertiesAdmin(PropertiesPtr properties, LoggerPtr logger)
Constructs a NativePropertiesAdmin.
The default implementation for the "Properties" admin facet.
Provides remote access to the properties of a communicator.
std::shared_ptr< Properties > PropertiesPtr
A shared pointer to a Properties.
Definition PropertiesF.h:13
std::shared_ptr< Logger > LoggerPtr
A shared pointer to a Logger.
Definition Logger.h:16
std::shared_ptr< NativePropertiesAdmin > NativePropertiesAdminPtr
A shared pointer to a NativePropertiesAdmin.
std::map< std::string, std::string, std::less<> > PropertyDict
A simple collection of properties, represented as a dictionary of key/value pairs.
The Ice RPC framework.
Definition SampleEvent.h:59
Provides information about an incoming request being dispatched.
Definition Current.h:18