summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/PropertiesAdminI.h
blob: 4cc60dc30c1ebd8adfe754fdd69d1193ba62d10a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// **********************************************************************
//
// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

#ifndef ICE_PROPERTIES_ADMIN_I_H
#define ICE_PROPERTIES_ADMIN_I_H

#include <IceUtil/RecMutex.h>
#include <Ice/Properties.h>
#include <Ice/PropertiesAdmin.h>
#include <Ice/NativePropertiesAdmin.h>
#include <Ice/LoggerF.h>

#ifdef ICE_CPP11_MAPPING
#include <list>
#endif

namespace IceInternal
{

class PropertiesAdminI : public Ice::PropertiesAdmin, public Ice::NativePropertiesAdmin,
#ifdef ICE_CPP11_MAPPING
                         public std::enable_shared_from_this<PropertiesAdminI>,
#endif
                         private IceUtil::RecMutex
{
public:

    PropertiesAdminI(const InstancePtr&);

#ifdef ICE_CPP11_MAPPING
    virtual std::string getProperty(std::string, const Ice::Current&) override;
    virtual Ice::PropertyDict getPropertiesForPrefix(std::string, const Ice::Current&) override;
    virtual void setProperties(::Ice::PropertyDict, const Ice::Current&) override;

    virtual std::function<void()> addUpdateCallback(std::function<void(const Ice::PropertyDict&)>) override;
    void removeUpdateCallback(std::list<std::function<void(const Ice::PropertyDict&)>>::iterator);

#else
    virtual std::string getProperty(const std::string&, const Ice::Current&);
    virtual Ice::PropertyDict getPropertiesForPrefix(const std::string&, const Ice::Current&);
    virtual void setProperties(const Ice::PropertyDict&, const Ice::Current&);

    virtual void addUpdateCallback(const Ice::PropertiesAdminUpdateCallbackPtr&);
    virtual void removeUpdateCallback(const Ice::PropertiesAdminUpdateCallbackPtr&);
#endif

private:

    const Ice::PropertiesPtr _properties;
    const Ice::LoggerPtr _logger;

#ifdef ICE_CPP11_MAPPING
    std::list<std::function<void(const Ice::PropertyDict&)>> _updateCallbacks;
#else
    std::vector<Ice::PropertiesAdminUpdateCallbackPtr> _updateCallbacks;
#endif

};
ICE_DEFINE_PTR(PropertiesAdminIPtr, PropertiesAdminI);

}

#endif