Switch to unified view

a/src/utils/execmd.h b/src/utils/execmd.h
1
#ifndef _EXECMD_H_INCLUDED_
1
#ifndef _EXECMD_H_INCLUDED_
2
#define _EXECMD_H_INCLUDED_
2
#define _EXECMD_H_INCLUDED_
3
/* @(#$Id: execmd.h,v 1.4 2005-11-18 15:19:14 dockes Exp $  (C) 2004 J.F.Dockes */
3
/* @(#$Id: execmd.h,v 1.5 2006-01-24 12:22:20 dockes Exp $  (C) 2004 J.F.Dockes */
4
4
5
#include <string>
5
#include <string>
6
#include <list>
6
#include <list>
7
7
8
/** Callback function object to advise of new data arrival */
9
class ExecCmdAdvise {
10
 public:
11
    virtual ~ExecCmdAdvise() {}
12
    virtual void newData() = 0;
13
};
14
8
/**
15
/**
9
 Execute command possibly taking both input and output (will do
16
 * Execute command possibly taking both input and output (will do
10
 asynchronous io as appropriate for things to work).
17
 * asynchronous io as appropriate for things to work).
11
*/
18
 */
12
class ExecCmd {
19
class ExecCmd {
13
 public:
20
 public:
14
    /**
21
    /**
15
     * Execute command. Both input and output can be specified, and
22
     * Execute command. Both input and output can be specified, and
16
     * asynchronous io is used to prevent blocking. This wont work if
23
     * asynchronous io is used to prevent blocking. This wont work if
...
...
32
     * variables).
39
     * variables).
33
     * @param envassign an environment assignment string (name=value)
40
     * @param envassign an environment assignment string (name=value)
34
     */
41
     */
35
    void putenv(const std::string &envassign);
42
    void putenv(const std::string &envassign);
36
43
44
    /** Set function object to call whenever new data is available */
45
    void setAdvise(ExecCmdAdvise *adv) {m_advise = adv;}
46
47
    /** Cancel exec. This can be called from another thread or from newData */
48
    void setCancel() {m_cancelRequest = true;}
49
50
    ExecCmd() : m_advise(0), m_cancelRequest(false) {}
51
37
 private:
52
 private:
38
    std::list<std::string> env;
53
    std::list<std::string> m_env;
54
    ExecCmdAdvise *m_advise;
55
    bool m_cancelRequest;
39
};
56
};
40
57
41
58
42
#endif /* _EXECMD_H_INCLUDED_ */
59
#endif /* _EXECMD_H_INCLUDED_ */