Changes between Initial Version and Version 1 of Component/Process Wrapper


Ignore:
Timestamp:
Mar 7, 2008, 4:54:00 PM (16 years ago)
Author:
Nicolas Pouillon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Component/Process Wrapper

    v1 v1  
     1[wiki:Component SocLib Components General Index]
     2
     3= Component description =
     4
     5This component is a common utility component.
     6
     7This creates a wrapper to a process. The wrapped process will be executed with the simulator, wrapping code may:
     8 * read stdout from wrapped process
     9 * poll stdout from wrapped process
     10 * write to wrapped process' stdin
     11 * send signals to wrapped process
     12
     13= Component usage =
     14
     15== Object ==
     16
     17{{{
     18soclib::common::ProcessWrapper *process;
     19}}}
     20
     21== Instanciation ==
     22
     23
     24{{{
     25    soclib::common::ProcessWrapper(
     26        const std::string &cmd,
     27        const std::vector<std::string> &argv );
     28}}}
     29
     30 cmd::
     31   The command to launch, it will be looked for in $PATH
     32 argv::
     33   The argv in a standart unix style. argv[0] should look like cmd.
     34
     35== Usage ==
     36
     37{{{
     38    std::vector<std::string> argv;
     39    argv.push_back("date");
     40    argv.push_back("+%s");
     41    soclib::common::ProcessWrapper process("date", argv);
     42
     43    char buffer[128];
     44    process.read( buffer, 128 );
     45    std::cout << "Date is " << buffer << " seconds since EPOCH" << std::endl;
     46}}}
     47