osg::ref_ptr<CommandClassObject> CommandCenter::getClassByName(std::string name, osg::ref_ptr<ParameterBase> p) { ComponentBase* cb = getComponentInfo(name); if (!cb) return NULL; return static_cast<CommandClassInfo*>(cb)->CreateObject(p); }
JNIEXPORT jboolean JNICALL Java_com_sun_media_renderer_video_XLibRenderer_xlibSetComponent(JNIEnv *env, jobject blitter, jobject component) { XWindowAttributes xwa; int error; XlibBlitter *xblitter = (XlibBlitter*) GetIntField(env, blitter, "blitter"); if (xblitter->display) { freeDisplay(*xblitter); } if (xblitter->surface) { (*env)->DeleteGlobalRef(env, xblitter->surface); xblitter->surface = NULL; } if ( jawt == 1 && xblitter->awtObj != 0) { freeJAWT(env, xblitter); xblitter->awtObj = 0; xblitter->drawingSurface = 0; } xblitter->component = component; getComponentInfo(env, xblitter); awtLock(env, xblitter); xblitter->screen = DefaultScreen(xblitter->display); XGetWindowAttributes(xblitter->display, xblitter->xid, &xwa); xblitter->visual = xwa.visual; xblitter->depth = xwa.depth; xblitter->bitsPerPixel = (xwa.depth == 8)? 8 : ((xwa.depth < 24)? 16 : 32); xblitter->gc = XCreateGC(xblitter->display, xblitter->xid, 0, 0); xblitter->shmAvailable = XQueryExtension(xblitter->display, "MIT-SHM", &(xblitter->shmOpcode), &(xblitter->shmComplete), &error); awtUnlock(env, xblitter); return 1; }
bool VsRegistry::registerComponentInfo(const std::string& componentName, const std::string& varName, int componentNumber) { //yes, I should use a std::hash_map for this //first, look for a match and report failure if the name is already registered NamePair foundPair; getComponentInfo(componentName, &foundPair); if (!foundPair.first.empty()) { std::string temp = foundPair.first; int tempIndex = foundPair.second; if ((varName != temp) || (componentNumber != tempIndex)) { VsLog::debugLog() <<"ERROR VsReader::registerComponentInfo() - " <<componentName <<" is already registered to component " <<temp <<" index " <<tempIndex <<std::endl; return false; } else { VsLog::debugLog() <<"VsReader::registerComponentInfo() - received duplicate registration for " <<varName <<" and index " <<componentNumber <<std::endl; VsLog::debugLog() <<"VsReader::registerComponentInfo() - but all info matches, so it should be ok" <<std::endl; return true; } } //Ok, register the new name mapping std::pair<std::string, int> innerPair; innerPair.first = varName; innerPair.second = componentNumber; std::pair<std::string, std::pair<std::string, int> > newPair; newPair.first = componentName; newPair.second = innerPair; componentNames.push_back(newPair); //VsLog::debugLog() <<"newpair.first = " <<newPair.first <<std::endl; //VsLog::debugLog() <<"newpair.second.first = " <<newPair.second.first <<std::endl; //VsLog::debugLog() <<"newpair.second.second = " <<newPair.second.second <<std::endl; VsLog::debugLog() <<"VsReader::registerComponentInfo(" <<componentName <<", " <<varName <<", " <<componentNumber <<") - registration succeeded." <<std::endl; return true; }