summaryrefslogtreecommitdiff
path: root/cpp/src/IceStorm/TopicManagerI.h
blob: a56d76931da469287862960021162635639fdf2c (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
70
71
72
73
74
// **********************************************************************
//
// Copyright (c) 2003-2007 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 TOPIC_MANAGER_I_H
#define TOPIC_MANAGER_I_H

#include <IceStorm/IceStorm.h>
#include <IceStorm/PersistentTopicMap.h>

namespace IceStorm
{

//
// Forward declarations.
//
class Instance;
typedef IceUtil::Handle<Instance> InstancePtr;

//
// Map of TopicI objects.
//
class TopicI;
typedef IceUtil::Handle<TopicI> TopicIPtr;

typedef std::map<std::string, TopicIPtr> TopicIMap;

//
// TopicManager implementation.
//
class TopicManagerI : public TopicManager, public IceUtil::Mutex
{
public:

    TopicManagerI(const InstancePtr&,
		  const Ice::ObjectAdapterPtr&,
		  const std::string&,
		  const std::string&);
    ~TopicManagerI();

    virtual TopicPrx create(const std::string&, const Ice::Current&);
    virtual TopicPrx retrieve(const std::string&, const Ice::Current&) const;
    virtual TopicDict retrieveAll(const Ice::Current&) const;

    virtual Ice::SliceChecksumDict getSliceChecksums(const Ice::Current&) const;

    void reap();

    void shutdown();

private:

    void installTopic(const std::string&, const LinkRecordDict&, bool);
  
    const InstancePtr _instance;
    const Ice::ObjectAdapterPtr _topicAdapter;
    const std::string _envName;
    const std::string _dbName;
    const Freeze::ConnectionPtr _connection;
    PersistentTopicMap _topics;

    TopicIMap _topicIMap;
};

typedef IceUtil::Handle<TopicManagerI> TopicManagerIPtr;

} // End namespace IceStorm

#endif