8 #ifndef Y2AgentComponent_h 9 #define Y2AgentComponent_h 74 template <
class Agent>
82 template <
class Agent>
95 y2debug (
"evaluate (%s)", v->toString ().c_str ());
100 y2debug (
"Going to evaluate %s", v->toString ().c_str ());
103 if (value->isCode ())
105 YCodePtr c = v->asCode ()->code ();
110 y2milestone (
"Evaluating an expression, not SCR builtin");
111 value = value->asCode ()->evaluate ();
115 value = value->asCode ()->evaluate ();
118 if (value.isNull () || value->isVoid ())
121 y2debug (
"After code evaluation: %s", value->toString ().c_str ());
123 if( value->isTerm () ) {
124 YCPTerm term = value ->asTerm ();
125 string command = term->
name ();
129 if( command ==
"Read" ) {
132 else if( command ==
"Write" ) {
135 else if( command ==
"Dir" ) {
138 else if( command ==
"Error" ) {
141 else if( command ==
"Execute" ) {
142 y2debug(
"Execute, arg size is %d", args->
size() );
143 switch( args->
size() ) {
153 y2debug(
"Passing term to otherCommand" );
158 if( value->isCode () ) {
159 y2debug(
"Passing (evaluated) code to otherCommand" );
160 return getSCRAgent ()-> otherCommand (value->asCode ()->evaluate ()->asTerm ());
164 y2error(
"Unhandled value (%s): %s", value->valuetype_str (), value->toString ().c_str () );
175 agent =
new Agent ();
183 y2error(
"Y2AgentComp::Read" );
187 #endif // Y2AgentComponent_h virtual YCPValue Read(const YCPPath &path, const YCPValue &arg=YCPNull(), const YCPValue &opt=YCPNull())=0
This is a Modules Agent TODO file $Id path
Definition: agent-modules/doc/TODO.txt:9
const char * my_name
Definition: Y2AgentComponent.h:64
virtual SCRAgent * getSCRAgent()
Definition: Y2AgentComponent.h:171
virtual ~Y2AgentComp()
Definition: Y2AgentComponent.h:83
virtual string name() const
Definition: Y2AgentComponent.h:45
Execute(.run,"cmd")`Execute(.run_output
#define y2milestone(format, args...)
Definition: liby2util-r/src/include/y2util/y2log.h:110
YCPValue value(int n) const
Definition: YCPList.h:266
Communication handle to a YaST2 component.
Definition: Y2Component.h:262
SuSE Configuration Repository Agent.
Definition: SCRAgent.h:37
string name() const
Definition: YCPTerm.h:185
#define y2error(format, args...)
Definition: liby2util-r/src/include/y2util/y2log.h:112
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
Y2AgentComp(const char *)
Definition: Y2AgentComponent.h:75
virtual YCPValue evaluate(const YCPValue &command)
Definition: Y2AgentComponent.h:93
Wrapper for YCPVoidRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPVoidRep with the arrow operator. See YCPVoidRep.
Definition: YCPVoid.h:75
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
YCPList args() const
Definition: YCPTerm.h:186
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
virtual YCPValue Read(const YCPPath &path)
Definition: Y2AgentComponent.h:181
Definition: Y2AgentComponent.h:27
cmd num Write(.buffer_size_err, num)`Write(.stdin
#define y2debug(format, args...)
Definition: liby2util-r/src/include/y2util/y2log.h:107
Definition: YCPElement.h:125
Agent * agent
Definition: Y2AgentComponent.h:69
int size() const
Definition: YCPList.h:250