2 * Copyright (C) 2004-2008 Geometer Plus <contact@geometerplus.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 #ifndef __PROGRAMCOLLECTION_H__
21 #define __PROGRAMCOLLECTION_H__
27 #include <shared_ptr.h>
28 #include <ZLMessage.h>
29 #include <ZLOptions.h>
34 Program(const std::string
&name
, shared_ptr
<ZLMessageOutputChannel
> channel
);
37 void run(const std::string
&command
, const std::string
¶meter
) const;
40 struct OptionDescription
{
41 OptionDescription(const std::string
&name
, const std::string
&defaultValue
);
42 std::string OptionName
;
43 std::string DefaultValue
;
45 const std::vector
<OptionDescription
> &options() const;
48 const std::string myName
;
49 shared_ptr
<ZLMessageOutputChannel
> myChannel
;
50 std::map
<std::string
,ZLCommunicationManager::Data
> myCommandData
;
51 std::vector
<OptionDescription
> myOptions
;
52 std::map
<std::string
,std::string
> myDefaultValues
;
54 friend class ProgramCollection
;
55 friend class ProgramCollectionBuilder
;
58 class ProgramCollection
{
61 mutable ZLBooleanOption EnableCollectionOption
;
62 mutable ZLStringOption CurrentNameOption
;
65 ProgramCollection(const std::string
&name
);
67 const std::vector
<std::string
> &names() const;
68 shared_ptr
<Program
> currentProgram() const;
69 shared_ptr
<Program
> program(const std::string
&name
) const;
72 std::vector
<std::string
> myNames
;
73 std::map
<std::string
,shared_ptr
<Program
> > myPrograms
;
75 friend class ProgramCollectionBuilder
;
78 class ProgramCollectionMap
{
81 ProgramCollectionMap();
82 shared_ptr
<ProgramCollection
> collection(const std::string
&name
) const;
85 std::map
<std::string
,shared_ptr
<ProgramCollection
> > myMap
;
87 friend class ProgramCollectionBuilder
;
90 #endif /* __PROGRAMCOLLECTION_H__ */