void HesperisIO::LsChildren(MObjectArray & dst, const int & maxCount, const MObject & oparent) { MFnDagNode ppf(oparent); for(unsigned i = 0; i <ppf.childCount(); i++) { dst.append(ppf.child(i) ); if(dst.length() >= maxCount) return; } }
bool HesperisIO::FindNamedChild(MObject & dst, const std::string & name, MObject & oparent) { if(oparent == MObject::kNullObj) { MItDag itdag(MItDag::kBreadthFirst); oparent = itdag.currentItem(); MGlobal::displayInfo(MFnDagNode(oparent).name() + " as default parent"); } MFnDagNode ppf(oparent); for(unsigned i = 0; i <ppf.childCount(); i++) { MFnDagNode pf(ppf.child(i)); std::string curname = pf.name().asChar(); if(SHelper::isMatched(curname, name)) { dst = ppf.child(i); return true; } } return false; }
JNIEXPORT jlong JNICALL Java_com4j_Native_getObject( JNIEnv* env, jclass __unused__, jstring _fileName, jstring _progId) { HRESULT hr; if(_progId==NULL) { // case 1: just file name IBindCtxPtr pbc; ULONG cEaten; IMonikerPtr pmk; IDispatch* pDisp; hr = CreateBindCtx(NULL,&pbc); if(FAILED(hr)) { error(env,__FILE__,__LINE__,hr,"Failed to CreateBindCtx"); return 0; } hr = MkParseDisplayName(pbc,JString(env,_fileName),&cEaten,&pmk); if(FAILED(hr)) { error(env,__FILE__,__LINE__,hr,"Failed to MkParseDisplayName"); return 0; } hr = BindMoniker(pmk,0,__uuidof(IDispatch),(LPVOID*)&pDisp); if(FAILED(hr)) { error(env,__FILE__,__LINE__,hr,"Failed to bind moniker"); return 0; } return reinterpret_cast<jlong>(pDisp); } JString progId(env,_progId); CLSID clsid; IUnknown* pUnk=NULL; hr = CLSIDFromProgID(progId,&clsid); if(FAILED(hr)) { error(env,__FILE__,__LINE__,hr,"Unrecognized progID"); return 0; } if(_fileName==NULL) { // case 2: just progId hr = GetActiveObject(clsid,NULL,&pUnk); if(FAILED(hr)) { error(env,__FILE__,__LINE__,hr,"Failed to GetActiveObject"); return 0; } return reinterpret_cast<jlong>(pUnk); } // case 3: both file name and progID hr = CoCreateInstance(clsid,NULL,CLSCTX_SERVER,__uuidof(IUnknown),(LPVOID*)&pUnk); if(FAILED(hr)) { error(env,__FILE__,__LINE__,hr,"Failed to create CoCreateInstance"); return 0; } IPersistFilePtr ppf(pUnk); hr = ppf->Load(JString(env,_fileName),0); if(FAILED(hr)) { error(env,__FILE__,__LINE__,hr,"Failed to load from file"); pUnk->Release(); return 0; } return reinterpret_cast<jlong>(pUnk); }
/* * Apply default polyphasefilter on one stream. */ void ppf(vector<double>& output ,unsigned int N, vector<double> input){ vector<double> preWindow; prefilter_window(preWindow, N, input.size()); ppf(output, N, preWindow, input); }