/// static functions for the suite template<class T> static OfxStatus propGetN(OfxPropertySetHandle properties, const char *property, int count, typename T::APIType *values) { # ifdef OFX_DEBUG_PROPERTIES std::cout << "OFX: propGetN - " << properties << ' ' << property << "[0.." << count-1 << "] = ..."; # endif try { Set *thisSet = reinterpret_cast<Set*>(properties); if(!thisSet || !thisSet->verifyMagic()) { # ifdef OFX_DEBUG_PROPERTIES std::cout << ' ' << StatStr(kOfxStatErrBadHandle) << std::endl; # endif return kOfxStatErrBadHandle; } PropertyTemplate<T> *prop = 0; if(!thisSet->fetchTypedProperty(property, prop, true)) { # ifdef OFX_DEBUG_PROPERTIES std::cout << ' ' << StatStr(kOfxStatErrUnknown) << std::endl; # endif return kOfxStatErrUnknown; } prop->getValueN(values, count); # ifdef OFX_DEBUG_PROPERTIES for (int i = 0; i < count; ++i) { if (i != 0) { std::cout << ','; } std::cout << values[i]; } std::cout << ' ' << StatStr(kOfxStatOK) << std::endl; # endif } catch (const Exception& e) { # ifdef OFX_DEBUG_PROPERTIES std::cout << ' ' << StatStr(e.getStatus()) << std::endl; # endif return e.getStatus(); } catch (...) { # ifdef OFX_DEBUG_PROPERTIES std::cout << ' ' << StatStr(kOfxStatErrUnknown) << std::endl; # endif return kOfxStatErrUnknown; } return kOfxStatOK; }
PluginHandle *ImageEffectPlugin::getPluginHandle() { if(!_pluginHandle.get()) { _pluginHandle.reset(new OFX::Host::PluginHandle(this, _pc.getHost())); OfxPlugin *op = _pluginHandle->getOfxPlugin(); if (!op) { _pluginHandle.reset(0); return 0; } OfxStatus stat; try { # ifdef OFX_DEBUG_ACTIONS std::cout << "OFX: "<<(void*)op<<"->"<<kOfxActionLoad<<"()"<<std::endl; # endif stat = op->mainEntry(kOfxActionLoad, 0, 0, 0); # ifdef OFX_DEBUG_ACTIONS std::cout << "OFX: "<<(void*)op<<"->"<<kOfxActionLoad<<"()->"<<StatStr(stat)<<std::endl; # endif } CatchAllSetStatus(stat, gImageEffectHost, op, kOfxActionLoad); if (stat != kOfxStatOK && stat != kOfxStatReplyDefault) { _pluginHandle.reset(0); return 0; } try { # ifdef OFX_DEBUG_ACTIONS std::cout << "OFX: "<<(void*)op<<"->"<<kOfxActionDescribe<<"()"<<std::endl; # endif stat = op->mainEntry(kOfxActionDescribe, getDescriptor().getHandle(), 0, 0); # ifdef OFX_DEBUG_ACTIONS std::cout << "OFX: "<<(void*)op<<"->"<<kOfxActionDescribe<<"()->"<<StatStr(stat)<<std::endl; # endif } CatchAllSetStatus(stat, gImageEffectHost, op, kOfxActionDescribe); if (stat != kOfxStatOK && stat != kOfxStatReplyDefault) { _pluginHandle.reset(0); return 0; } }
/// static functions for the suite template<class T> static OfxStatus propGet(OfxPropertySetHandle properties, const char *property, int index, typename T::APIType *value) { # ifdef OFX_DEBUG_PROPERTIES std::cout << "OFX: propGet - " << properties << ' ' << property << "[" << index << "] = ..."; # endif try { Set *thisSet = reinterpret_cast<Set*>(properties); if(!thisSet || !thisSet->verifyMagic()) { # ifdef OFX_DEBUG_PROPERTIES std::cout << ' ' << StatStr(kOfxStatErrBadHandle) << std::endl; # endif return kOfxStatErrBadHandle; } PropertyTemplate<T> *prop = 0; if(!thisSet->fetchTypedProperty(property, prop, true)) { # ifdef OFX_DEBUG_PROPERTIES std::cout << ' ' << StatStr(kOfxStatErrUnknown) << std::endl; # endif return kOfxStatErrUnknown; } *value = castToAPIType(prop->getValue(index)); # ifdef OFX_DEBUG_PROPERTIES std::cout << *value << ' ' << StatStr(kOfxStatOK) << std::endl; # endif } catch (const Exception& e) { # ifdef OFX_DEBUG_PROPERTIES std::cout << ' ' << StatStr(e.getStatus()) << std::endl; # endif return e.getStatus(); } catch (...) { # ifdef OFX_DEBUG_PROPERTIES std::cout << ' ' << StatStr(kOfxStatErrUnknown) << std::endl; # endif return kOfxStatErrUnknown; } return kOfxStatOK; }
void printmyjobs(const user* u) { while (u != NULL) { if (!strcmp(me,u->name)) { const job * j=u->jobs; if (j != NULL) { heading_fill("Job No |state CPU RAM STARTING IN"); } while (j != NULL) { printf("%i | %c %3i %5.2fGB",j->number,StatStr( j),j->corecount,(double)j->ramrequested/1024.0/1024.0); if (j->state==Q || j-> state==S) //if job queued then call showstart to print the start time for the job (based on reported runtimes, job likely to start even earlier than this { char* command = malloc(1024); if (j -> arrayid == -1) { sprintf(command,"showstart %i | grep start | tr -s ' ' | cut -d ' ' -f4",j->number); //get time to start } else { sprintf(command,"showstart %i-%i | grep start | tr -s ' ' | cut -d ' ' -f4",j->number,j->arrayid); //get time to start } FILE* pout=popen(command,"r"); if (pout) { char* datebuffer = malloc(100);//100 characters should be enough char * s = fgets(datebuffer,100,pout); //TODO: the strchr on the next line might return null - need tto check if (s) { strchr(datebuffer,'\n')[0]=0; //cut adds an extra newline - annoying printf(" %11s\n",datebuffer); } else { printf("error with showstart\n"); } free(datebuffer); } else {printf("unable to run showstart");} free(command); } else {printf("\n");} j=j->usernext; } } u=u->next; } }
/// static functions for the suite static OfxStatus propReset(OfxPropertySetHandle properties, const char *property) { # ifdef OFX_DEBUG_PROPERTIES std::cout << "OFX: propReset - " << properties << ' ' << property << " ..."; # endif try { Set *thisSet = reinterpret_cast<Set*>(properties); if(!thisSet || !thisSet->verifyMagic()) { # ifdef OFX_DEBUG_PROPERTIES std::cout << ' ' << StatStr(kOfxStatErrBadHandle) << std::endl; # endif return kOfxStatErrBadHandle; } Property *prop = thisSet->fetchProperty(property, false); if(!prop) { # ifdef OFX_DEBUG_PROPERTIES std::cout << ' ' << StatStr(kOfxStatErrUnknown) << std::endl; # endif return kOfxStatErrUnknown; } prop->reset(); # ifdef OFX_DEBUG_PROPERTIES std::cout << ' ' << StatStr(kOfxStatOK) << std::endl; # endif } catch (const Exception& e) { # ifdef OFX_DEBUG_PROPERTIES std::cout << ' ' << StatStr(e.getStatus()) << std::endl; # endif return e.getStatus(); } catch (...) { # ifdef OFX_DEBUG_PROPERTIES std::cout << ' ' << StatStr(kOfxStatErrUnknown) << std::endl; # endif return kOfxStatErrUnknown; } return kOfxStatOK; }
/// static functions for the suite static OfxStatus propGetDimension(OfxPropertySetHandle properties, const char *property, int *count) { # ifdef OFX_DEBUG_PROPERTIES std::cout << "OFX: propGetDimension - " << properties << ' ' << property << " ..."; # endif if (!properties) { # ifdef OFX_DEBUG_PROPERTIES std::cout << ' ' << StatStr(kOfxStatErrBadHandle) << std::endl; # endif return kOfxStatErrBadHandle; } try { Set *thisSet = reinterpret_cast<Set*>(properties); Property *prop = thisSet->fetchProperty(property, true); if(!prop) { # ifdef OFX_DEBUG_PROPERTIES std::cout << "unknown property\n"; # endif return kOfxStatErrUnknown; } *count = prop->getDimension(); # ifdef OFX_DEBUG_PROPERTIES std::cout << *count << ' ' << StatStr(kOfxStatOK) << std::endl; # endif return kOfxStatOK; } catch (const Exception& e) { # ifdef OFX_DEBUG_PROPERTIES std::cout << ' ' << StatStr(e.getStatus()) << std::endl; # endif return e.getStatus(); } catch (...) { # ifdef OFX_DEBUG_PROPERTIES std::cout << ' ' << StatStr(kOfxStatErrUnknown) << std::endl; # endif return kOfxStatErrUnknown; } }