~stolowski/unity-scopes-api/canned-query-data

« back to all changes in this revision

Viewing changes to src/internal/zmq_middleware/ZmqConfig.cpp

  • Committer: Michi Henning
  • Date: 2013-11-19 02:51:46 UTC
  • mto: This revision was merged to the branch mainline in revision 62.
  • Revision ID: michi.henning@canonical.com-20131119025146-kglcalpphl4ozzk7
Fixed scoperegistry to use new scoperunner and to figure out which scopes to run from config files.
Still to do:
- deal with overrides and OEM scopes, particularly the grouping aspect.
- SignalThread needs to invoke a callback for clean shut-down on receipt of SIGINT.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2013 Canonical Ltd
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License version 3 as
 
6
 * published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authored by: Michi Henning <michi.henning@canonical.com>
 
17
 */
 
18
 
 
19
#include <scopes/internal/zmq_middleware/ZmqConfig.h>
 
20
 
 
21
using namespace std;
 
22
 
 
23
namespace unity
 
24
{
 
25
 
 
26
namespace api
 
27
{
 
28
 
 
29
namespace scopes
 
30
{
 
31
 
 
32
namespace internal
 
33
{
 
34
 
 
35
const char* ZmqConfig::ZMQ_CONFIG_GROUP = "Zmq";
 
36
 
 
37
namespace
 
38
{
 
39
    const string public_dir_str = "EndpointDir.Public";
 
40
    const string private_dir_str = "EndpointDir.Private";
 
41
}
 
42
 
 
43
ZmqConfig::ZmqConfig(string const& configfile) :
 
44
    ConfigBase(configfile)
 
45
{
 
46
    public_dir_ = get_string(ZMQ_CONFIG_GROUP, public_dir_str);
 
47
 
 
48
    // Private directory is not needed by all processes. It is retrieved
 
49
    // on demand during adapter creation.
 
50
}
 
51
 
 
52
ZmqConfig::~ZmqConfig() noexcept
 
53
{
 
54
}
 
55
 
 
56
string ZmqConfig::public_dir() const
 
57
{
 
58
    return public_dir_;
 
59
}
 
60
 
 
61
string ZmqConfig::private_dir() const
 
62
{
 
63
    lock_guard<mutex> lock(mutex_);
 
64
    if (private_dir_.empty())    // Initialize first time only
 
65
    {
 
66
        private_dir_ = get_string(ZMQ_CONFIG_GROUP, private_dir_str);
 
67
    }
 
68
    return private_dir_;
 
69
}
 
70
 
 
71
} // namespace internal
 
72
 
 
73
} // namespace scopes
 
74
 
 
75
} // namespace api
 
76
 
 
77
} // namespace unity