yast2-core
SCRAgent.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | |
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
8 | |
9 | core system |
10 | (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12 
13  File: SCRAgent.h
14 
15  Author: Mathias Kettner <kettner@suse.de>
16  Maintainer: Arvin Schnell <arvin@suse.de>
17 
18 /-*/
19 // -*- c++ -*-
20 
21 #ifndef SCRAgent_h
22 #define SCRAgent_h
23 
24 #include <YCP.h>
25 #include <ycp/y2log.h>
26 
37 class SCRAgent
38 {
39 public:
43  SCRAgent ();
44 
48  virtual ~SCRAgent ();
49 
55  virtual YCPValue Read (const YCPPath& path, const YCPValue& arg = YCPNull(), const YCPValue& opt = YCPNull()) = 0;
56 
60  virtual YCPBoolean Write (const YCPPath& path, const YCPValue& value,
61  const YCPValue& arg = YCPNull()) = 0;
62 
66  virtual YCPList Dir (const YCPPath& path) = 0;
67 
71  virtual YCPValue Execute (const YCPPath& path, const YCPValue& /*value*/ = YCPNull(),
72  const YCPValue& /*arg*/ = YCPNull()) {
73  ycp2error( "Unimplemented Execute called for path %s", path-> toString ().c_str () );
74  return YCPNull ();
75  }
76 
80  virtual YCPMap Error (const YCPPath& /*path*/) {
81  return unspecified_error;
82  }
83 
87  virtual YCPBoolean RegisterAgent (const YCPPath& path, const YCPValue& /*value*/) {
88  ycp2error( "Unimplemented RegisterAgent called for path %s", path-> toString ().c_str () );
89  return YCPBoolean( false );
90  }
91 
95  virtual YCPBoolean UnregisterAgent (const YCPPath& path) {
96  ycp2error( "Unimplemented UnregisterAgent called for path %s", path-> toString ().c_str () );
97  return YCPBoolean( false );
98  }
99 
104  ycp2error( "Unimplemented UnregisterAllAgents called" );
105  return YCPBoolean( false );
106  }
107 
111  virtual YCPBoolean UnmountAgent (const YCPPath& /*path*/) {
112  return YCPBoolean( false );
113  }
114 
119  ycp2error( "Unimplemented RegisterNewAgents called" );
120  return YCPBoolean( false );
121  }
122 
127  virtual YCPValue otherCommand (const YCPTerm& term);
128 
135 
136 
143  virtual const char *root () const;
144 
150  static YCPValue readconf (const char *filename);
151 
152  static SCRAgent* instance();
153 
155  current_scr = this;
156  }
157 
163  string targetPath( const string &path) const;
164 
165 private:
169 };
170 
171 
172 #endif // SCRAgent_h
SCRAgent()
Definition: SCRAgent.cc:32
virtual YCPValue Read(const YCPPath &path, const YCPValue &arg=YCPNull(), const YCPValue &opt=YCPNull())=0
virtual YCPBoolean UnmountAgent(const YCPPath &)
Definition: SCRAgent.h:111
This is a Modules Agent TODO file $Id path
Definition: agent-modules/doc/TODO.txt:9
virtual YCPValue otherCommand(const YCPTerm &term)
Definition: SCRAgent.cc:67
static YCPValue readconf(const char *filename)
Definition: SCRAgent.cc:74
virtual YCPBoolean RegisterNewAgents()
Definition: SCRAgent.h:118
virtual YCPBoolean RegisterAgent(const YCPPath &path, const YCPValue &)
Definition: SCRAgent.h:87
static YCPMap unspecified_error
returned by Error
Definition: SCRAgent.h:168
string targetPath(const string &path) const
Definition: SCRAgent.cc:115
virtual YCPMap Error(const YCPPath &)
Definition: SCRAgent.h:80
#define ycp2error(format, args...)
Definition: libycp/src/include/ycp/y2log.h:41
static SCRAgent * current_scr
Definition: SCRAgent.h:166
virtual YCPBoolean Write(const YCPPath &path, const YCPValue &value, const YCPValue &arg=YCPNull())=0
SCRAgent * mainscragent
Definition: SCRAgent.h:134
Wrapper for YCPMapRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPMapRep with the arrow operator. See YCPMapRep.
Definition: YCPMap.h:184
virtual const char * root() const
Definition: SCRAgent.cc:110
virtual YCPBoolean UnregisterAllAgents()
Definition: SCRAgent.h:103
virtual YCPBoolean UnregisterAgent(const YCPPath &path)
Definition: SCRAgent.h:95
SuSE Configuration Repository Agent.
Definition: SCRAgent.h:37
virtual YCPValue Execute(const YCPPath &path, const YCPValue &=YCPNull(), const YCPValue &=YCPNull())
Definition: SCRAgent.h:71
virtual YCPList Dir(const YCPPath &path)=0
Wrapper for YCPListRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPListRep with the arrow operator. See YCPListRep.
Definition: YCPList.h:236
void setAsCurrentSCR()
Definition: SCRAgent.h:154
Wrapper for YCPTermRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPTermRep with the arrow operator. See YCPTermRep.
Definition: YCPTerm.h:177
string toString(int d)
Definition: toString.h:38
Wrapper for YCPValueRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPValueRep with the arrow operator. See YCPValueRep.
Definition: YCPValue.h:275
Wrapper for YCPPathRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPPathRep with the arrow operator. See YCPPathRep.
Definition: YCPPath.h:175
static SCRAgent * instance()
Definition: SCRAgent.cc:51
virtual ~SCRAgent()
Definition: SCRAgent.cc:46
Wrapper for YCPBooleanRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPBooleanRep with the arrow operator. See YCPBooleanRep.
Definition: YCPBoolean.h:93
Definition: YCPElement.h:125

Generated on a sunny day for yast2-core by doxygen 1.8.11