33 #include "ossie/debug.h" 34 #include "ossie/Events.h" 35 #include "ossie/CorbaUtils.h" 36 #include "ossie/Autocomplete.h" 41 #ifdef BEGIN_AUTOCOMPLETE_IGNORE 42 public virtual POA_CF::Device,
51 static std::string
getLogConfig(
const char* devmgr_ior,
const char* log_config, std::string& devmgr_label);
54 Device_impl (
char*,
char*,
char*,
char*, CF::Properties& capacities);
55 Device_impl (
char*,
char*,
char*,
char*, CF::Properties& capacities,
char*);
59 static void start_device(T** devPtr,
struct sigaction sa,
int argc,
char* argv[]) {
60 start_device(boost::bind(&Device_impl::make_device<T>,boost::ref(*devPtr),_1,_2,_3,_4,_5), sa, argc, argv);
63 void releaseObject () throw (CF::LifeCycle::ReleaseError, CORBA::SystemException);
64 char*
label () throw (CORBA::SystemException);
65 CF::Device::UsageType
usageState ()throw (CORBA::SystemException);
66 CF::Device::AdminType
adminState ()throw (CORBA::SystemException);
67 CF::Device::OperationalType
operationalState ()throw (CORBA::SystemException);
68 CF::AggregateDevice_ptr
compositeDevice ()throw (CORBA::SystemException);
69 void adminState (CF::Device::AdminType _adminType) throw (CORBA::SystemException);
70 void deallocateCapacity (const CF::Properties& capacities) throw (CF::Device::InvalidState, CF::Device::InvalidCapacity, CORBA::SystemException);
71 CORBA::Boolean
allocateCapacity (const CF::Properties& capacities) throw (CF::Device::InvalidState, CF::Device::InvalidCapacity, CF::Device::InsufficientCapacity, CORBA::SystemException);
72 void configure (const CF::Properties& configProperties) throw (CF::PropertySet::PartialConfiguration, CF::PropertySet::InvalidConfiguration, CORBA::SystemException);
121 std::string ®istrar_ior,
122 const std::string &idm_channel_ior=
"",
123 const std::string &nic=
"",
124 const int sigfd=-1 );
132 StandardEvent::StateChangeType &toState,
133 StandardEvent::StateChangeCategoryType category );
137 void deallocate (CORBA::Any& deviceCapacity,
const CORBA::Any& resourceRequest);
138 bool allocate (CORBA::Any& deviceCapacity,
const CORBA::Any& resourceRequest);
149 template <
typename T>
150 void setAllocationImpl (
const std::string&
id,
bool (*alloc)(
const T&),
void (*dealloc)(
const T&))
152 useNewAllocation =
true;
154 PropertyWrapper<T>* wrapper = getAllocationPropertyById<T>(id);
155 wrapper->setAllocator(alloc);
156 wrapper->setDeallocator(dealloc);
157 }
catch (
const std::exception& error) {
158 LOG_WARN(
Device_impl,
"Cannot set allocation implementation: " << error.what());
162 template <
class C,
typename T>
164 void (C::*dealloc)(
const T&))
166 useNewAllocation =
true;
168 PropertyWrapper<T>* wrapper = getAllocationPropertyById<T>(id);
169 wrapper->setAllocator(target, alloc);
170 wrapper->setDeallocator(target, dealloc);
171 }
catch (
const std::exception& error) {
172 LOG_WARN(
Device_impl,
"Cannot set allocation implementation: " << error.what());
176 template <
typename Alloc,
typename Dealloc>
182 template <
typename Target,
typename Alloc,
typename Dealloc>
188 template <
typename T>
191 PropertyWrapper<T>*
property = getPropertyWrapperById<T>(id);
192 if (!property->isAllocatable()) {
193 throw std::invalid_argument(
"Property '" +
id +
"' is not allocatable");
200 template <
typename T,
typename Alloc,
typename Dealloc>
203 useNewAllocation =
true;
206 wrapper->setAllocator(alloc);
207 wrapper->setDeallocator(dealloc);
208 }
catch (
const std::exception& error) {
209 LOG_WARN(
Device_impl,
"Cannot set allocation implementation: " << error.what());
214 template <
typename T,
typename Target,
typename Alloc,
typename Dealloc>
217 useNewAllocation =
true;
220 wrapper->setAllocator(target, alloc);
221 wrapper->setDeallocator(target, dealloc);
222 }
catch (
const std::exception& error) {
223 LOG_WARN(
Device_impl,
"Cannot set allocation implementation: " << error.what());
229 return this->_devMgr;
237 char* profile,
char* compositeDeviceIOR)
239 if (compositeDeviceIOR) {
242 device =
new T(devMgrIOR, identifier, label, profile, compositeDeviceIOR);
244 device =
new T(devMgrIOR, identifier, label, profile);
245 PortableServer::ObjectId_var oid = ossie::corba::RootPOA()->activate_object(device);
251 typedef boost::function<Device_impl* (char*, char*, char*, char*, char*)> ctor_type;
252 static void start_device(ctor_type ctor,
struct sigaction sa,
int argc,
char* argv[]);
253 void initResources(
char*,
char*,
char*,
char*);
255 void validateCapacities (
const CF::Properties& capacities);
257 bool useNewAllocation;
258 bool allocateCapacityNew (
const CF::Properties& capacities);
259 void deallocateCapacityNew (
const CF::Properties& capacities);
261 bool allocateCapacityLegacy (
const CF::Properties& capacities);
262 void deallocateCapacityLegacy (
const CF::Properties& capacities);
264 redhawk::DeviceManagerContainer *_devMgr;
void deallocateCapacity(const CF::Properties &capacities)
CF::AggregateDevice_ptr compositeDevice()
void setAllocationImpl(const char *id, Target target, Alloc alloc, Dealloc dealloc)
Definition: Device_impl.h:183
CF::Device::UsageType usageState()
Definition: Device_impl.h:110
void setAdminState(CF::Device::AdminType _adminType)
bool allocate(CORBA::Any &deviceCapacity, const CORBA::Any &resourceRequest)
CF::Device::OperationalType operationalState()
AnyComparisonType
Definition: Device_impl.h:105
void connectIDMChannel(const std::string &idm_ior="")
CF::AggregateDevice_ptr _aggregateDevice
Definition: Device_impl.h:99
CORBA::Boolean allocateCapacity(const CF::Properties &capacities)
void deallocate(CORBA::Any &deviceCapacity, const CORBA::Any &resourceRequest)
std::string _compositeDev_ior
Definition: Device_impl.h:103
virtual void postConstruction(std::string &softwareProfile, std::string ®istrar_ior, const std::string &idm_channel_ior="", const std::string &nic="", const int sigfd=-1)
void setAdditionalParameters(std::string &softwareProfile, std::string &application_registrar_ior, const std::string &nic)
bool initialConfiguration
Definition: Device_impl.h:135
int sig_fd
Definition: Device_impl.h:116
CF::Device::UsageType _usageState
Definition: Device_impl.h:95
Definition: Device_impl.h:109
void setAllocationImpl(const char *id, Alloc alloc, Dealloc dealloc)
Definition: Device_impl.h:177
void setUsageState(CF::Device::UsageType newUsageState)
CF::Device::AdminType adminState()
std::string _label
Definition: Device_impl.h:101
PropertyWrapper< T > * getAllocationPropertyById(const std::string &id)
Definition: Device_impl.h:189
redhawk::DeviceManagerContainer * getDeviceManager()
Definition: Device_impl.h:228
Definition: Device_impl.h:111
void resolveDomainContext()
redhawk::events::PublisherPtr idm_publisher
Definition: Device_impl.h:115
Definition: Resource_impl.h:40
void setAllocationImpl(T &value, Alloc alloc, Dealloc dealloc)
Definition: Device_impl.h:201
Definition: Device_impl.h:40
CF::Properties originalCap
Definition: Device_impl.h:136
Definition: Device_impl.h:107
CF::Device::AdminType _adminState
Definition: Device_impl.h:93
CF::Device::OperationalType _operationalState
Definition: Device_impl.h:97
static void start_device(T **devPtr, struct sigaction sa, int argc, char *argv[])
Definition: Device_impl.h:59
Definition: Device_impl.h:112
void sendStateChange(StandardEvent::StateChangeType &fromState, StandardEvent::StateChangeType &toState, StandardEvent::StateChangeCategoryType category)
void configure(const CF::Properties &configProperties)
void setAllocationImpl(T &value, Target target, Alloc alloc, Dealloc dealloc)
Definition: Device_impl.h:215
void setAllocationImpl(const std::string &id, bool(*alloc)(const T &), void(*dealloc)(const T &))
Definition: Device_impl.h:150
Device_impl::AnyComparisonType compareAnyToZero(CORBA::Any &first)
PropertyWrapper< T > * getPropertyWrapper(T &value)
Definition: PropertySet_impl.h:288
Device_impl::AnyComparisonType compareAnys(CORBA::Any &first, CORBA::Any &second)
void setAllocationImpl(const std::string &id, C *target, bool(C::*alloc)(const T &), void(C::*dealloc)(const T &))
Definition: Device_impl.h:163
Definition: Device_impl.h:106
std::string _devMgr_ior
Definition: Device_impl.h:141
Definition: Device_impl.h:108
const CF::DeviceManager_ptr getDeviceManager() const
CF::DeviceManager_ptr _deviceManager
Definition: Device_impl.h:114