本文整理汇总了C++中cf::Properties::length方法的典型用法代码示例。如果您正苦于以下问题:C++ Properties::length方法的具体用法?C++ Properties::length怎么用?C++ Properties::length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cf::Properties
的用法示例。
在下文中一共展示了Properties::length方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: configure
void amplifier_i::configure(const CF::Properties& props) throw (CORBA::SystemException, CF::PropertySet::InvalidConfiguration, CF::PropertySet::PartialConfiguration)
{
static int init = 0;
std::cout << "Component -AMPLIFIER" << std::endl;
std::cout << " Props length = " << props.length() << std::endl;
if (init == 0) {
if ( props.length() <= 0 ) {
std::cout << "amplifier: configure called with invalid props.length() - " << props.length() << std::endl;
return;
}
propertySet.length(props.length());
for (unsigned int i=0; i < props.length(); i++) {
propertySet[i].id = CORBA::string_dup(props[i].id);
propertySet[i].value = props[i].value;
}
init++;
}
for (unsigned int i=0; i < props.length(); i++) {
if (strcmp(props[i].id, "DCE:06b88d4f-dd38-44e6-bc49-82db0eba5bc6") == 0) {
CORBA::Float simple_temp;
props[i].value >>= simple_temp;
simple_0_value = simple_temp;
for (unsigned int j=0; j < propertySet.length(); j++ ) {
if ( strcmp(propertySet[j].id, props[i].id) == 0 ) {
propertySet[j].value = props[i].value;
break;
}
}
}
else if (strcmp(props[i].id, "DCE:df91b1a8-9c83-44b4-bf2c-0dbeacb2b6f4") == 0) {
示例2: configure
void Channel_i::configure(const CF::Properties& props)
throw (CORBA::SystemException,
CF::PropertySet::InvalidConfiguration,
CF::PropertySet::PartialConfiguration)
{
static int init = 0;
DEBUG(3, Channel, "configure() invoked")
if (init == 0) {
if ( props.length() <= 0 ) {
std::cout << "Channel: configure called with invalid props.length() - " << props.length() << std::endl;
return;
}
propertySet.length(props.length());
for (unsigned int i=0; i < props.length(); i++) {
std::cout << "Property Id : " << props[i].id << std::endl;
propertySet[i].id = CORBA::string_dup(props[i].id);
propertySet[i].value = props[i].value;
}
init = 1;
}
for (unsigned int i=0; i < props.length(); i++) {
if (strcmp(props[i].id, "DCE:1d91b55a-2fcb-4d2d-ad7b-1ee58c32cad8") == 0) {
//The number of samples per symbol
CORBA::Short simple_temp;
props[i].value >>= simple_temp;
Ns = simple_temp;
for (unsigned int j=0; j < propertySet.length(); j++ ) {
if ( strcmp(propertySet[j].id, props[i].id) == 0 ) {
propertySet[j].value = props[i].value;
break;
}
}
} else if (strcmp(props[i].id, "DCE:eddc66ce-8a82-11dd-ae05-0016769e497b") == 0) {
示例3: allocateDevice
bool AllocationManager_impl::allocateDevice(const CF::Properties& requestedProperties, ossie::DeviceNode& node, CF::Properties& allocatedProperties, const std::vector<std::string>& processorDeps, const std::vector<ossie::SPD::NameVersionPair>& osDeps)
{
if (!ossie::corba::objectExists(node.device)) {
LOG_WARN(AllocationManager_impl, "Not using device for uses_device allocation " << node.identifier << " because it no longer exists");
return false;
}
try {
if (node.device->usageState() == CF::Device::BUSY) {
return false;
}
} catch ( ... ) {
// bad device reference or device in an unusable state
LOG_WARN(AllocationManager_impl, "Unable to verify state of device " << node.identifier);
return false;
}
LOG_TRACE(AllocationManager_impl, "Allocating against device " << node.identifier);
// Determine whether or not the device in question has the required matching properties
CF::Properties allocProps;
if (!checkDeviceMatching(node.prf, allocProps, requestedProperties, processorDeps, osDeps)) {
LOG_TRACE(AllocationManager_impl, "Matching failed");
return false;
}
// If there are no external properties to allocate, the allocation is
// already successful
if (allocProps.length() == 0) {
LOG_TRACE(AllocationManager_impl, "Allocation requires no capacity from device");
return true;
}
// If there are duplicates in the allocation sequence, break up the allocation into multiple calls
std::vector<CF::Properties> allocations;
partitionProperties(allocProps, allocations);
LOG_TRACE(AllocationManager_impl, "Allocating " << allocProps.length() << " properties ("
<< allocations.size() << " calls)");
try {
if (!this->completeAllocations(node.device, allocations)) {
LOG_TRACE(AllocationManager_impl, "Device lacks sufficient capacity");
return false;
}
} catch (const CF::Device::InvalidCapacity& e) {
LOG_TRACE(AllocationManager_impl, "Device reported invalid capacity");
return false;
} catch (const CF::Device::InsufficientCapacity& e) {
LOG_TRACE(AllocationManager_impl, "Device reported insufficient capacity");
return false;
}
// Transfer ownership of the allocated properties to the caller
ossie::corba::move(allocatedProperties, allocProps);
LOG_TRACE(AllocationManager_impl, "Allocation successful");
return true;
}
示例4: testMemberCallbacks
void TestCppsoftpkgDeps::testMemberCallbacks (CF::Properties& testValues)
{
// Set up notification to call `this->propertyChanged()` when any of the
// test values are changed via `configure()`.
LOG_DEBUG(TestCppsoftpkgDeps, "Setting up " << testValues.length() << " member function callback(s)");
for (CORBA::ULong ii = 0; ii < testValues.length(); ++ii) {
const std::string id = static_cast<const char*>(testValues[ii].id);
setPropertyChangeListener(id, this, &TestCppsoftpkgDeps::propertyChanged);
}
testCallbacks(testValues);
}
示例5: parseUsesDevices
void SPDImplementation::parseUsesDevices(TiXmlElement *elem)
{
DEBUG(4, SPDImplementation, "In parseUsesDevices.");
TiXmlElement *uses = elem->FirstChildElement("usesdevice");
for (; uses; uses = uses->NextSiblingElement("usesdevice")) {
const char *id = uses->Attribute("id");
const char *type = uses->Attribute("type");
CF::Properties props;
unsigned int i(0);
TiXmlElement *prop = uses->FirstChildElement("propertyref");
for (; prop; prop = prop->NextSiblingElement("propertyref")) {
const char *refid = prop->Attribute("refid");
const char *value = prop->Attribute("value");
props.length(i+1);
props[i].id = CORBA::string_dup (refid);
props[i].value <<= value;
i++;
}
usesDevice.push_back(new SPDUsesDevice (id, type, props));
}
}
示例6: getModTime
static time_t getModTime (const CF::Properties& properties)
{
CORBA::ULongLong modTime = 0;
for (CORBA::ULong ii = 0; ii < properties.length(); ++ii) {
if (strcmp(properties[ii].id, "MODIFIED_TIME") == 0) {
properties[ii].value >>= modTime;
}
}
示例7: validate
void AudioTestSource_i::validate(CF::Properties property, CF::Properties& validProps, CF::Properties& invalidProps)
{
for (CORBA::ULong ii = 0; ii < property.length (); ++ii) {
std::string id((const char*)property[ii].id);
// Certian properties cannot be set while the component is running
if (_started) {
if (id == "sample-rate") {
LOG_WARN(AudioTestSource_i, "'sample-rate' cannot be changed while component is running.")
CORBA::ULong count = invalidProps.length();
invalidProps.length(count + 1);
invalidProps[count].id = property[ii].id;
invalidProps[count].value = property[ii].value;
} else if (id == "is-live") {
LOG_WARN(AudioTestSource_i, "'is-live' cannot be changed while component is running.")
CORBA::ULong count = invalidProps.length();
invalidProps.length(count + 1);
invalidProps[count].id = property[ii].id;
invalidProps[count].value = property[ii].value;
} else if (id == "stream_id") {
LOG_WARN(AudioTestSource_i, "'is-stream_id' cannot be changed while component is running.")
CORBA::ULong count = invalidProps.length();
invalidProps.length(count + 1);
invalidProps[count].id = property[ii].id;
invalidProps[count].value = property[ii].value;
}
}
}
}
示例8: query
void AutomaticGainControl_i::query(CF::Properties & configProperties)
throw (CORBA::SystemException, CF::UnknownProperties)
{
if (configProperties.length () == 0) {
configProperties.length (propertySet.length ());
for (unsigned int i = 0; i < propertySet.length (); i++) {
configProperties[i].id = CORBA::string_dup (propertySet[i].id);
configProperties[i].value = propertySet[i].value;
}
return ;
} else {
for (unsigned int i = 0; i < configProperties.length(); i++) {
for (unsigned int j=0; j < propertySet.length(); j++) {
if ( strcmp(configProperties[i].id, propertySet[j].id) == 0 ) {
configProperties[i].value = propertySet[j].value;
}
}
}
}
}
示例9: configure
void AutomaticGainControl_i::configure(const CF::Properties& props) throw (CORBA::SystemException, CF::PropertySet::InvalidConfiguration, CF::PropertySet::PartialConfiguration)
{
static int init = 0;
CORBA::Float simple_temp;
DEBUG(3, AutomaticGainControl, "configure() invoked")
DEBUG(3, AutomaticGainControl, "props length : " << props.length())
if (init == 0) {
if ( props.length() <= 0 ) {
std::cout << "AutomaticGainControl: configure called with invalid props.length() - " << props.length() << std::endl;
return;
}
propertySet.length(props.length());
for (unsigned int i=0; i < props.length(); i++) {
propertySet[i].id = CORBA::string_dup(props[i].id);
propertySet[i].value = props[i].value;
}
init++;
}
for (unsigned int i=0; i < props.length(); i++) {
std::cout << "Property Id : " << props[i].id << std::endl;
if (strcmp(props[i].id, "DCE:aaf97fa0-d184-4d88-9954-3a1334c73d6d") == 0) {
// energy_lo
props[i].value >>= simple_temp;
omni_mutex_lock oml(accessPrivateData);
energy_lo = simple_temp;
// Update value of this property in propertySet also
for (unsigned int j=0; j < propertySet.length(); j++ ) {
if ( strcmp(propertySet[j].id, props[i].id) == 0 ) {
propertySet[j].value = props[i].value;
break;
}
}
DEBUG(3, AutomaticGainControl, "prop (energy_lo): " << simple_temp)
} else if (strcmp(props[i].id, "DCE:346e17c9-6678-483a-bffb-1909c64bddc0") == 0) {
示例10: query
void writeBytestoFile_i::query( CF::Properties & configProperties ) throw (CORBA::SystemException, CF::UnknownProperties)
{
if( configProperties.length() == 0 )
{
configProperties.length( propertySet.length() );
for( int i = 0; i < propertySet.length(); i++ )
{
configProperties[i].id = CORBA::string_dup( propertySet[i].id );
configProperties[i].value = propertySet[i].value;
}
return;
} else {
for( int i = 0; i < configProperties.length(); i++ ) {
for( int j = 0; j < propertySet.length(); j++ ) {
if( strcmp(configProperties[i].id, propertySet[j].id) == 0 ) {
configProperties[i].value = propertySet[j].value;
}
}
}
} // end if-else
}
示例11: partitionProperties
void AllocationManager_impl::partitionProperties(const CF::Properties& properties, std::vector<CF::Properties>& outProps)
{
std::set<std::string> identifiers;
size_t start = 0;
for (size_t index = 0; index < properties.length(); ++index) {
const std::string propertyID(properties[index].id);
if (identifiers.count(propertyID) > 0) {
// Duplicate property, partition at this point
outProps.push_back(ossie::corba::slice(properties, start, index));
start = index;
identifiers.clear();
}
identifiers.insert(propertyID);
}
// Copy remaining partition
if (start < properties.length()) {
outProps.push_back(ossie::corba::slice(properties, start));
}
}
示例12:
void
PropertySet_impl::configure (const CF::Properties & configProperties)
throw (CORBA::SystemException, CF::PropertySet::InvalidConfiguration,
CF::PropertySet::PartialConfiguration)
{
if (propertySet.length () == 0)
{
propertySet.length (configProperties.length ());
for (unsigned int i = 0; i < configProperties.length (); i++)
{
propertySet[i].id = CORBA::string_dup (configProperties[i].id);
propertySet[i].value = configProperties[i].value;
CORBA::Short len = -1;
propertySet[i].value >>= len;
}
return;
}
示例13: checkDeviceMatching
bool AllocationManager_impl::checkDeviceMatching(ossie::Properties& prf, CF::Properties& externalProperties, const CF::Properties& dependencyProperties, const std::vector<std::string>& processorDeps, const std::vector<ossie::SPD::NameVersionPair>& osDeps)
{
// Check for a matching processor, which only happens in deployment
if (!processorDeps.empty()) {
if (!ossie::checkProcessor(processorDeps, prf.getAllocationProperties())) {
LOG_TRACE(AllocationManager_impl, "Device did not match requested processor");
return false;
} else {
LOG_TRACE(AllocationManager_impl, "Matched processor name");
}
}
// Likewise, check for OS name/version
if (!osDeps.empty()) {
if (!ossie::checkOs(osDeps, prf.getAllocationProperties())) {
LOG_TRACE(AllocationManager_impl, "Device did not match requested OS name/version");
return false;
} else {
LOG_TRACE(AllocationManager_impl, "Matched OS name/version");
}
}
int matches = 0;
for (unsigned int index = 0; index < dependencyProperties.length(); ++index) {
const CF::DataType& dependency = dependencyProperties[index];
const std::string propId(dependency.id);
const ossie::Property* property = prf.getAllocationProperty(propId);
if (!property) {
LOG_TRACE(AllocationManager_impl, "Device has no property " << propId);
return false;
} else if (property->isExternal()) {
// Collect properties with an action of "external" for a later
// allocateCapacity() call
LOG_TRACE(AllocationManager_impl, "Adding external property " << propId);
ossie::corba::push_back(externalProperties, ossie::convertDataTypeToPropertyType(dependency, property));
} else {
// Evaluate matching properties right now
if (!checkMatchingProperty(property, dependency)) {
return false;
} else {
++matches;
}
}
}
LOG_TRACE(AllocationManager_impl, "Matched " << matches << " properties");
return true;
}
示例14:
void
amplifier_i::query (CF::Properties & configProperties)
throw (CORBA::SystemException, CF::UnknownProperties)
{
// for queries of zero length, return all id/value pairs in propertySet
if (configProperties.length () == 0) {
configProperties.length (propertySet.length ());
for (unsigned int i = 0; i < propertySet.length (); i++) {
configProperties[i].id = CORBA::string_dup (propertySet[i].id);
configProperties[i].value = propertySet[i].value;
}
return ;
} else {
for (unsigned int i = 0; i < configProperties.length(); i++) {
for (unsigned int j=0; j < propertySet.length(); j++) {
if ( strcmp(configProperties[i].id, propertySet[j].id) == 0 ) {
configProperties[i].value = propertySet[j].value;
}
}
}
}
}
示例15: getCombinedProperty
CORBA::ULongLong FileManager_impl::getCombinedProperty (const char* propId)
{
CORBA::ULongLong totalSize = 0;
for (MountList::iterator mount = mountedFileSystems.begin(); mount != mountedFileSystems.end(); ++mount) {
CF::Properties props;
props.length(1);
props[0].id = propId;
mount->fs->query(props);
CORBA::ULongLong fsSize;
props[0].value >>= fsSize;
totalSize += fsSize;
}
return totalSize;
}