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 
25 #include <YCP.h>
26 #include <ycp/y2log.h>
27 
38 class SCRAgent
39 {
40 public:
44  SCRAgent ();
45 
49  virtual ~SCRAgent ();
50 
56  virtual YCPValue Read (const YCPPath& path, const YCPValue& arg = YCPNull(), const YCPValue& opt = YCPNull()) = 0;
57 
61  virtual YCPBoolean Write (const YCPPath& path, const YCPValue& value,
62  const YCPValue& arg = YCPNull()) = 0;
63 
67  virtual YCPList Dir (const YCPPath& path) = 0;
68 
72  virtual YCPValue Execute (const YCPPath& path, const YCPValue& /*value*/ = YCPNull(),
73  const YCPValue& /*arg*/ = YCPNull()) {
74  ycp2error( "Unimplemented Execute called for path %s", path-> toString ().c_str () );
75  return YCPNull ();
76  }
77 
81  virtual YCPMap Error (const YCPPath& /*path*/) {
82  return unspecified_error;
83  }
84 
88  virtual YCPBoolean RegisterAgent (const YCPPath& path, const YCPValue& /*value*/) {
89  ycp2error( "Unimplemented RegisterAgent called for path %s", path-> toString ().c_str () );
90  return YCPBoolean( false );
91  }
92 
96  virtual YCPBoolean UnregisterAgent (const YCPPath& path) {
97  ycp2error( "Unimplemented UnregisterAgent called for path %s", path-> toString ().c_str () );
98  return YCPBoolean( false );
99  }
100 
105  ycp2error( "Unimplemented UnregisterAllAgents called" );
106  return YCPBoolean( false );
107  }
108 
112  virtual YCPBoolean UnmountAgent (const YCPPath& /*path*/) {
113  return YCPBoolean( false );
114  }
115 
120  ycp2error( "Unimplemented RegisterNewAgents called" );
121  return YCPBoolean( false );
122  }
123 
128  virtual YCPValue otherCommand (const YCPTerm& term);
129 
136 
142  static YCPValue readconf (const char *filename);
143 
144  static SCRAgent* instance();
145 
147  current_scr = this;
148  }
149 
150 private:
154 };
155 
156 
157 #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:112
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:119
virtual YCPBoolean RegisterAgent(const YCPPath &path, const YCPValue &)
Definition: SCRAgent.h:88
static YCPMap unspecified_error
returned by Error
Definition: SCRAgent.h:153
virtual YCPMap Error(const YCPPath &)
Definition: SCRAgent.h:81
#define ycp2error(format, args...)
Definition: libycp/src/include/ycp/y2log.h:41
static SCRAgent * current_scr
Definition: SCRAgent.h:151
virtual YCPBoolean Write(const YCPPath &path, const YCPValue &value, const YCPValue &arg=YCPNull())=0
SCRAgent * mainscragent
Definition: SCRAgent.h:135
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 YCPBoolean UnregisterAllAgents()
Definition: SCRAgent.h:104
virtual YCPBoolean UnregisterAgent(const YCPPath &path)
Definition: SCRAgent.h:96
SuSE Configuration Repository Agent.
Definition: SCRAgent.h:38
virtual YCPValue Execute(const YCPPath &path, const YCPValue &=YCPNull(), const YCPValue &=YCPNull())
Definition: SCRAgent.h:72
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:146
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.5