-
Notifications
You must be signed in to change notification settings - Fork 6
/
Action.h
73 lines (48 loc) · 1.47 KB
/
Action.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef _ACTION_H_
#define _ACTION_H_
#include "Ground.h"
class Action : public ParamCond {
public:
Condition *pre, *eff;
Action( const std::string & s )
: ParamCond( s ), pre( 0 ), eff( 0 ) {}
Action( ParamCond * c )
: ParamCond( c ), pre( 0 ), eff( 0 ) {}
Action( const Action * a, Domain & d )
: ParamCond( a ), pre( 0 ), eff( 0 ) {
if ( a->pre ) pre = a->pre->copy( d );
if ( a->eff ) eff = a->eff->copy( d );
}
virtual ~Action() {
if ( pre ) delete pre;
if ( eff ) delete eff;
}
void print( std::ostream & s ) const {
s << name << params << "\n";
s << "Pre: " << pre;
if ( eff ) s << "Eff: " << eff;
}
virtual double duration() {
return 1;
}
void PDDLPrint( std::ostream & s, unsigned indent, const TokenStruct< std::string > & ts, Domain & d );
void parseConditions( Filereader & f, TokenStruct< std::string > & ts, Domain & d );
void parse( Filereader & f, TokenStruct< std::string > & ts, Domain & d );
void SHOPparse( Filereader & f, TokenStruct< std::string > & ts, Domain & d ){
}
void addParams( int m, unsigned n ) {
}
void addParams( const IntVec & v ) {
if ( pre ) pre->addParams( params.size(), v.size() );
if ( eff ) eff->addParams( params.size(), v.size() );
params.insert( params.end(), v.begin(), v.end() );
}
Condition * copy( Domain & d ) {
return new Action( this, d );
}
CondVec precons();
GroundVec addEffects();
GroundVec deleteEffects();
};
typedef std::vector< Action * > ActionVec;
#endif