Inserter &Inserter::operator <<(objc::PropertyDeclaration &propertyDeclaration) { DescriptionCreator creator; std::string des; des = creator(propertyDeclaration); unsigned delta = des.length(); objc::ClassInterface classIntr = _file->getClassInterface(currentClass()); unsigned pos = classIntr.addPropertyDeclaration(propertyDeclaration, delta); _bufor->setPos(pos - 1); if(_bufor->getChar() != '\n'){ ++(*_bufor); _bufor->put('\n'); propertyDeclaration.setStartPos(pos + 1); propertyDeclaration.setEndPos( propertyDeclaration.endPos() + 1); } else { ++(*_bufor); } _bufor->put(des); if(_bufor->getChar() != '\n') _bufor->put('\n'); return *this; }
Inserter &Inserter::operator <<(objc::SynthesizedVariable &synthesizedVariable) { DescriptionCreator creator; std::string des; des = creator(synthesizedVariable); unsigned pos = _file->getClassImplementation(currentClass()).addSynthesizedVariable(synthesizedVariable, des.length()); _bufor->setPos(pos); _bufor->put(des); _bufor->put(",\n "); return *this; }
Inserter &Inserter::operator <<(objc::SynthesizeBlock &block) { DescriptionCreator creator; std::string des; des = creator(block); unsigned pos = _file->getClassImplementation(currentClass()).putSynthesizedBlock(block, des.length()); _bufor->setPos(pos); _bufor->put(des); _bufor->put('\n'); return *this; }
Inserter &Inserter::operator <<(objc::MethodDefinition &definition) { DescriptionCreator creator; std::string des; des = creator(definition); unsigned delta = des.length(); // ++delta; objc::ClassImplementation classImpl = _file->getClassImplementation(currentClass()); unsigned pos = classImpl.addDefinition(definition, delta); _bufor->setPos(pos); _bufor->put(des); _bufor->put('\n'); return *this; }
// // Method that caches certain profile registration information. Specifically, // information pertaining to the ElementConformsToProfofile association // implementation is kept here. // void InteropProvider::cacheProfileRegistrationInfo() { Array<CIMInstance> instances; Array<CIMInstance> providerCapabilitiesInstances; // Clear existing cache profileIds.clear(); conformingElements.clear(); elementNamespaces.clear(); // Retrieve all of the provider profile registration info Array<CIMName> propList; propList.append(CAPABILITIES_PROPERTY_PROVIDERMODULENAME); propList.append(CAPABILITIES_PROPERTY_PROVIDERNAME); propList.append(PROFILECAPABILITIES_PROPERTY_PROFILEVERSION); propList.append(PROFILECAPABILITIES_PROPERTY_REGISTEREDPROFILE); propList.append(PROFILECAPABILITIES_PROPERTY_OTHERREGISTEREDPROFILE); propList.append(PROFILECAPABILITIES_PROPERTY_OTHERPROFILEORGANIZATION); propList.append(PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS); Array<CIMInstance> providerProfileInstances = enumProviderProfileCapabilityInstances( true, false, false, false, CIMPropertyList(propList)); CIMClass elementConformsClass = repository->getClass( PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE, false, true, false); CIMClass registeredProfileClass = repository->getClass( PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE, false, true, false); Array<CIMInstance> capabilities; // Loop through the provider profile info to determine what profiles are // supported by what providers, and to build the ElementConformsToProfile // associations. for (Uint32 i = 0, n = providerProfileInstances.size(); i < n; ++i) { CIMInstance & currentProfileInstance = providerProfileInstances[i]; String moduleName = getRequiredValue<String>(currentProfileInstance, CAPABILITIES_PROPERTY_PROVIDERMODULENAME); String providerName = getRequiredValue<String>(currentProfileInstance, CAPABILITIES_PROPERTY_PROVIDERNAME); String profileName; Uint16 profileOrganization = 0; String profileVersion; String organizationName; Array<String> profileNames; // Not going to use this info Array<String> profileVersions; // Not going to use this info Array<Uint16> profileOrganizations; // Not going to use this info Array<String> profileOrganizationNames; // Not going to use this info Array<String> providerModuleNames; // Not going to use this info Array<String> providerNames; // Not going to use this info String profileId = extractProfileInfo(currentProfileInstance, profileCapabilitiesClass, registeredProfileClass, profileName, profileVersion, profileOrganization, organizationName, profileNames, profileVersions, profileOrganizations, profileOrganizationNames, providerModuleNames, providerNames, true); Uint32 propIndex = currentProfileInstance.findProperty( PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS); Array<CIMName> elementPropArray; elementPropArray.append( ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD); elementPropArray.append( ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT); CIMPropertyList elementPropList(elementPropArray); Array<CIMName> conformingElementsForProfile; Array<CIMNamespaceName> elementNamespacesForProfile; Array<String> elementClasses; currentProfileInstance.getProperty(propIndex).getValue().get( elementClasses); //if (propIndex == PEG_NOT_FOUND) if (elementClasses.size() == 0) { // Get the namespaces in which this provider operates and trim down // the list of capabilities instaces to just those that are related // to this one. if (capabilities.size() == 0) { Array<CIMName> capPropList; capPropList.append( PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME); capPropList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME); capPropList.append(PROVIDERCAPABILITIES_PROPERTY_NAMESPACES); capPropList.append(PROVIDERCAPABILITIES_PROPERTY_CLASSNAME); capabilities = repository->enumerateInstancesForClass( PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, false, false, false); } Array<CIMInstance> capabilitiesForProvider; Array<CIMNamespaceName> namespacesForProvider; Array<CIMNameArray> subclassesForNamespace; for (Uint32 j = 0, m = capabilities.size(); j < m; ++j) { CIMInstance & currentInstance = capabilities[j]; String curModuleName = getRequiredValue<String>( currentInstance, CAPABILITIES_PROPERTY_PROVIDERMODULENAME); String curProviderName = getRequiredValue<String>( currentInstance, CAPABILITIES_PROPERTY_PROVIDERNAME); if (curModuleName == moduleName && curProviderName == providerName) { CIMName currentClass(getRequiredValue<String>( currentInstance, PROVIDERCAPABILITIES_PROPERTY_CLASSNAME)); capabilitiesForProvider.append(currentInstance); StringArray curNamespaces = getRequiredValue<StringArray>(currentInstance, PROVIDERCAPABILITIES_PROPERTY_NAMESPACES); Sint32 z = 0; Sint32 y = curNamespaces.size(); // If one of the namespaces is Interop, then continue bool interopNamespaceFound = false; for (; z < y; ++z) { if (CIMNamespaceName(curNamespaces[z]) == PEGASUS_NAMESPACENAME_INTEROP) { interopNamespaceFound = true; break; } } if (interopNamespaceFound) continue; // See if the current namespaces are already listed for (Sint32 w = 0; w < y; ++w) { Sint32 foundIndex = -1; CIMNamespaceName curNamespace = curNamespaces[w]; Uint32 k = 0; Uint32 x = namespacesForProvider.size(); for (; k < x; ++k) { if (curNamespace == namespacesForProvider[k]) { foundIndex = (Sint32)k; break; } } if (foundIndex == -1) { // Get all the subclasses of // ElementConformsToProfile in the namespace and // cache them. foundIndex = namespacesForProvider.size(); Array<CIMName> subClasses = repository->enumerateClassNames(curNamespace, PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE, true); subClasses.append( PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE ); namespacesForProvider.append(curNamespace); subclassesForNamespace.append(subClasses); } // Now search to see if the current class is one of the // subclasses in this namespace, and finally, if it is // add it to the list Array<CIMName> & subClasses = subclassesForNamespace[foundIndex]; for (k = 0, x = subClasses.size(); k < x; ++k) { if (subClasses[k] == currentClass) { String dynamicElement = PEGASUS_DYNAMIC + currentClass.getString(); conformingElementsForProfile.append( dynamicElement); elementNamespacesForProfile.append( curNamespace); } } } } } } else { //Array<String> elementClasses; //currentProfileInstance.getProperty(propIndex).getValue().get( // elementClasses); for (Uint32 j = 0, m = elementClasses.size(); j < m; ++j) { CIMName elementClass(elementClasses[j]); Array<String> searchNamespaces = findProviderNamespacesForElement( moduleName, providerName, elementClass, repository, providerCapabilitiesInstances); Uint32 k = 0; Uint32 x = searchNamespaces.size(); for (; k < x; ++k) { conformingElementsForProfile.append(elementClass); elementNamespacesForProfile.append(searchNamespaces[k]); } } } Sint32 foundIndex = -1; for (Sint32 j = 0, m = profileIds.size(); j < m; ++j) { if (profileIds[j] == profileId) { foundIndex = j; break; } } if (foundIndex >= 0) { // Append the results to already existing entries conformingElements[foundIndex].appendArray( conformingElementsForProfile); elementNamespaces[foundIndex].appendArray( elementNamespacesForProfile); } else { profileIds.append(profileId); conformingElements.append(conformingElementsForProfile); elementNamespaces.append(elementNamespacesForProfile); } } }