ExecutableDevice_impl.h
Go to the documentation of this file.
1 /*
2  * This file is protected by Copyright. Please refer to the COPYRIGHT file
3  * distributed with this source distribution.
4  *
5  * This file is part of REDHAWK core.
6  *
7  * REDHAWK core is free software: you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation, either version 3 of the License, or (at your
10  * option) any later version.
11  *
12  * REDHAWK core is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15  * for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this program. If not, see http://www.gnu.org/licenses/.
19  */
20 
21 #ifndef EXECUTABLE_DEVICE_IMPL_H
22 #define EXECUTABLE_DEVICE_IMPL_H
23 
24 #include <sys/types.h>
25 
26 #include "LoadableDevice_impl.h"
27 #include "CF/cf.h"
28 #include "ossie/Autocomplete.h"
29 
30 
32 #ifdef BEGIN_AUTOCOMPLETE_IGNORE
33  public virtual POA_CF::ExecutableDevice,
34 #endif
35  public LoadableDevice_impl
36 {
37 
38  ENABLE_LOGGING
39 
40 public:
41 
42  ExecutableDevice_impl (char*, char*, char*, char*);
43  ExecutableDevice_impl (char*, char*, char*, char*, CF::Properties capacities);
44  ExecutableDevice_impl (char*, char*, char*, char*, char*);
45  ExecutableDevice_impl (char*, char*, char*, char*, CF::Properties capacities, char*);
47  };
48  CF::ExecutableDevice::ProcessID_Type execute (const char* name, const CF::Properties& options,
49  const CF::Properties& parameters) throw (CF::ExecutableDevice::ExecuteFail,
50  CF::InvalidFileName, CF::ExecutableDevice::InvalidOptions,
51  CF::ExecutableDevice::InvalidParameters,
52  CF::ExecutableDevice::InvalidFunction, CF::Device::InvalidState,
53  CORBA::SystemException);
54  void configure (const CF::Properties& configProperties)
55  throw (CF::PropertySet::PartialConfiguration,
56  CF::PropertySet::InvalidConfiguration, CORBA::SystemException);
57 
60  // Execute a Component with the associated soft packages as modifiers for its environment
61  CF::ExecutableDevice::ProcessID_Type executeLinked (const char* name, const CF::Properties& options,
62  const CF::Properties& parameters, const CF::StringSequence& deps) throw (CF::ExecutableDevice::ExecuteFail,
63  CF::InvalidFileName, CF::ExecutableDevice::InvalidOptions,
64  CF::ExecutableDevice::InvalidParameters,
65  CF::ExecutableDevice::InvalidFunction, CF::Device::InvalidState,
66  CORBA::SystemException);
67  // Perform the actual Component forking
68  CF::ExecutableDevice::ProcessID_Type do_execute (const char* name, const CF::Properties& options,
69  const CF::Properties& parameters, const std::vector<std::string> prepend_args) throw (CF::ExecutableDevice::ExecuteFail,
70  CF::InvalidFileName, CF::ExecutableDevice::InvalidOptions,
71  CF::ExecutableDevice::InvalidParameters,
72  CF::ExecutableDevice::InvalidFunction, CF::Device::InvalidState,
73  CORBA::SystemException);
74 
75  // Terminate a process
76  void terminate (CF::ExecutableDevice::ProcessID_Type processId) throw
77  (CF::Device::InvalidState, CF::ExecutableDevice::InvalidProcess,
78  CORBA::SystemException);
79 
80 protected:
81  // Parse the command-line arguments to retrieve the name of the Component that is to be launched
82  static std::string get_component_name_from_exec_params(const CF::Properties& params);
83  // Retrieve the name of the Component from its profile
84  static std::string component_name_from_profile_name(const std::string& profile_name);
85 
86  // process affinity options
87  virtual void set_resource_affinity( const CF::Properties& options,
88  const pid_t rsc_pid,
89  const char *rsc_name,
90  const std::vector<int> &bl = std::vector<int>(0) );
91 
92 private:
93  CF::ExecutableDevice::ProcessID_Type PID;
94 };
95 
96 #endif
97 
static std::string get_component_name_from_exec_params(const CF::Properties &params)
Definition: ExecutableDevice_impl.h:31
CF::ExecutableDevice::ProcessID_Type do_execute(const char *name, const CF::Properties &options, const CF::Properties &parameters, const std::vector< std::string > prepend_args)
CF::ExecutableDevice::ProcessID_Type execute(const char *name, const CF::Properties &options, const CF::Properties &parameters)
virtual void set_resource_affinity(const CF::Properties &options, const pid_t rsc_pid, const char *rsc_name, const std::vector< int > &bl=std::vector< int >(0))
~ExecutableDevice_impl()
Definition: ExecutableDevice_impl.h:46
CF::ExecutableDevice::ProcessID_Type executeLinked(const char *name, const CF::Properties &options, const CF::Properties &parameters, const CF::StringSequence &deps)
static std::string component_name_from_profile_name(const std::string &profile_name)
void configure(const CF::Properties &configProperties)
Definition: LoadableDevice_impl.h:159
void terminate(CF::ExecutableDevice::ProcessID_Type processId)