summaryrefslogtreecommitdiff
path: root/cpp/demo/book/simple_filesystem/FilesystemI.h
blob: e848eb550627ac031b7221a2d333aff0905fc007 (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
// **********************************************************************
//
// Copyright (c) 2003-2009 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 __FilesystemI_h__
#define __FilesystemI_h__

#include <Ice/Ice.h>
#include <Filesystem.h>

namespace Filesystem {

    class DirectoryI;
    typedef IceUtil::Handle<DirectoryI> DirectoryIPtr;

    class NodeI : virtual public Node {
    public:
        virtual std::string name(const Ice::Current&);
        NodeI(const Ice::CommunicatorPtr&, const std::string&, const DirectoryIPtr&);
        void activate(const Ice::ObjectAdapterPtr&);
    private:
        std::string _name;
        Ice::Identity _id;
        DirectoryIPtr _parent;
        NodeI(const NodeI&);            // Copy forbidden
        void operator=(const NodeI&);   // Assignment forbidden
    };

    typedef IceUtil::Handle<NodeI> NodeIPtr;

    class FileI : virtual public File,
                  virtual public NodeI {
    public:
        virtual Lines read(const Ice::Current&);
        virtual void write(const Lines&,
                           const Ice::Current& = Ice::Current());
        FileI(const Ice::CommunicatorPtr&, const std::string&, const DirectoryIPtr&);
    private:
        Lines _lines;
    };

    typedef IceUtil::Handle<FileI> FileIPtr;

    class DirectoryI : virtual public Directory,
                       virtual public NodeI {
    public:
        virtual NodeSeq list(const Ice::Current&);
        DirectoryI(const Ice::CommunicatorPtr&, const std::string&, const DirectoryIPtr&);
        void addChild(const Filesystem::NodePrx&);
    private:
        Filesystem::NodeSeq _contents;
    };
}

#endif