Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / OpenFOAM / db / IOstreams / token / CompoundToken.H
blob915e6b6a973629053e9291842befd3ce1c201a73
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2004-2010 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by
13     the Free Software Foundation, either version 3 of the License, or
14     (at your option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::CompoundToken
27 Description
28     An abstract base class for managing compound tokens
30 \*---------------------------------------------------------------------------*/
32 #ifndef CompoundToken_H
33 #define CompoundToken_H
35 #include "refCount.H"
36 #include "typeInfo.H"
37 #include "autoPtr.H"
38 #include "runTimeSelectionTables.H"
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 namespace Foam
45 // Forward declaration of friend functions and operators
47 class CompoundToken;
48 Ostream& operator<<(Ostream&, const CompoundToken&);
51 /*---------------------------------------------------------------------------*\
52                            Class CompoundToken Declaration
53 \*---------------------------------------------------------------------------*/
55 class CompoundToken
57     public refCount
59     // Private Member Functions
61         //- Disallow default bitwise copy construct
62         CompoundToken(const CompoundToken&);
64         //- Disallow default bitwise assignment
65         void operator=(const CompoundToken&);
68 public:
70     //- Runtime type information
71     virtual const word& type() const = 0;
74     // Declare run-time constructor selection tables
76         declareRunTimeSelectionTable
77         (
78             autoPtr,
79             CompoundToken,
80             Istream,
81             (const word& type, Istream& is),
82             (type, is)
83         );
86     // Constructors
88         //- Construct null
89         CompoundToken()
90         {}
92         //- Return the clone as this and increment reference count
93         virtual autoPtr<CompoundToken> clone() const = 0;
96     // Selectors
98         //- Select null constructed
99         static autoPtr<CompoundToken> New(const word& type, Istream& is);
102     //- Destructor
103     virtual ~CompoundToken();
106     // Member Functions
108         // Access
110         // Check
112         // Edit
114         // Write
116             virtual void write(Istream&) = 0;
119     // IOstream Operators
121         friend Ostream& operator<<(Ostream&, const CompoundToken&);
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 } // End namespace Foam
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 #endif
133 // ************************************************************************* //