File: actions.hpp

package info (click to toggle)
sip-tester 1.1rc1-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 472 kB
  • ctags: 678
  • sloc: cpp: 8,504; ansic: 648; makefile: 157
file content (140 lines) | stat: -rw-r--r-- 3,791 bytes parent folder | download
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *  Authors : Benjamin GAUTHIER - 24 Mar 2004
 *            Joseph BANINO
 *            Olivier JACQUES
 *            Richard GAYRAUD
 *            From Hewlett Packard Company.
 *           
 */

#ifndef _CACTIONS
#define _CACTIONS

class CAction
{
  public:
    enum T_ActionType
    {
      E_AT_NO_ACTION = 0,
      E_AT_ASSIGN_FROM_REGEXP,
      E_AT_CHECK,
      E_AT_ASSIGN_FROM_VALUE,
      E_AT_LOG_TO_FILE,
      E_AT_EXECUTE_CMD,
      E_AT_EXEC_INTCMD,
      E_AT_NB_ACTION
    };

    enum T_VarType
    {
      E_VT_REGEXP = 0,
      E_VT_CONST,
      E_VT_UNDEFINED,
      E_VT_NB_VAR_TYPE
    };

    enum T_LookingPlace
    {
      E_LP_MSG = 0,
      E_LP_HDR,
      E_LP_NB_LOOKING_PLACE
    };

    enum T_IntCmdType
    {
      E_INTCMD_INVALID = 0,
      E_INTCMD_STOPCALL,
      E_INTCMD_STOP_ALL,
      E_INTCMD_STOP_NOW
    };

    typedef struct _T_Action
    {
    } T_Action;

    void afficheInfo();

    T_ActionType   getActionType();
    T_VarType      getVarType();  
    T_LookingPlace getLookingPlace();
    bool           getCheckIt();
    int            getVarId();
    char*          getLookingChar();
    char*          getMessage();  /* log specific function  */
    char*          getCmdLine();  /* exec specific function */
    T_IntCmdType   getIntCmd();   /* exec specific function */

    void setActionType   (T_ActionType   P_value);
    void setVarType      (T_VarType      P_value);  
    void setLookingPlace (T_LookingPlace P_value);
    void setCheckIt      (bool           P_value);
    void setVarId        (int            P_value);
    void setLookingChar  (char*          P_value);
    void setAction       (CAction        P_action);
    void setMessage      (char*          P_value);  /* log specific function  */
    void setCmdLine      (char*          P_value);  /* exec specific function */
    void setIntCmd       (T_IntCmdType   P_type );  /* exec specific function */

    void setSubVarId     (int P_value);
    int  getSubVarId     (int P_index);
    void setNbSubVarId   (int P_value);
    int  getNbSubVarId   ();
    int* getSubVarId() ;
    
    CAction(const CAction &P_Action);
    CAction();
    ~CAction();
  
  private:
      T_ActionType   M_action;
      T_VarType      M_varType;
      T_LookingPlace M_lookingPlace;
      bool           M_checkIt;
      int            M_varId;

      int            M_nbSubVarId;
      int            M_maxNbSubVarId;
      int *          M_subVarId;

      char*          M_lookingChar;
      /* log specific member  */
      char*          M_message;
      /* exec specific member */
      char*          M_cmdLine;
      T_IntCmdType   M_IntCmd;
};

class CActions
{
  public:
    void afficheInfo();
    void setAction(CAction P_action);
    void reset();
    int  getUsedAction();
    int  getMaxSize();
    CAction* getAction(int i);
    CActions(const CActions &P_Actions);
    CActions(int P_nbAction);
    ~CActions();
  
  private:
    CAction*   M_actionList;
    int        M_nbAction;
    int        M_currentSettedAction;
};

#endif