void WikiTractsPages::createTracts_addTractLines( int level , XmlBrainTract& tract , StringList& lines ) {
	// tract info
	String sname = "TRACT";
	if( !tract.index.isEmpty() )
		sname += " " + tract.index;

	String s = String( " " ).replicate( level + 1 ) + "* " + wm -> getWikiLink( tract.link , sname ) + ": " + wm -> getWikiBold( tract.name );
	if( !tract.synonyms.isEmpty() )
		s += " (" + tract.synonyms + ")";
	s += "; " + tract.function;
	if( !tract.notes.isEmpty() )
		s += " (" + tract.notes + ")";
	if( !tract.source.isEmpty() )
		s += "; path: {" + tract.source + "} -> {" + tract.target + "}";
	lines.add( s );

	if( !tract.imgsrc.isEmpty() ) {
		s = String( " " ).replicate( level + 2 ) + "* " + wm -> getImageWikiLink( tract.imgsrc , tract.imgheight );
		lines.add( s );
	}

	// tracts paths
	for( int k = 0; k < tract.paths.count(); k++ ) {
		XmlBrainTractPath& path = tract.paths.getClassRefByIndex( k );
		createTracts_addTractPathLines( level + 1 , path , lines );
	}

	// child tract
	for( int k = 0; k < tract.childs.count(); k++ ) {
		XmlBrainTract& child = tract.childs.getClassRefByIndex( k );
		createTracts_addTractLines( level + 1 , child , lines );
	}
}
Example #2
0
void WikiAreaPages::createAreaPages_createAreaCircuitTableLine( MindLocalCircuitDef *circuit , StringList& lines ) {
	String line;
	if( circuit == NULL ) {
		line = "|| *ID* || *Name* || *Regions* ||";
		lines.add( line );
		return;
	}

	line = "|| " + circuit -> getId() + " || " + circuit -> getName() + " || ";
	MapStringToClass<MindRegionDef>& regions = circuit -> getRegions();

	String id;
	String list;
	for( int k = 0; k < regions.count(); k++ ) {
		id = regions.getKeyByIndex( k );

		if( k > 0 )
			list += ", ";

		list += wm -> getRegionReference( id );
	}

	line += list + " ||";
	lines.add( line );
}
Example #3
0
bool TestReplPack::RemoveObjFromContainer ( )
{
    ReplRegistry& RegObj = ReplRegistry::getInstance();
    ReplHashStrContainer* pReplHashStrContainer2 = ( ReplHashStrContainer* ) RegObj.get ( 2 );

    if ( pReplHashStrContainer2 == NULL )
        return false;

    replHashStrNodeList& NodeList = replHashStrNodeList::getInstance ();
    DLinkQueue theNodeQueue;
    NodeList.getNodeList ( theNodeQueue );
    pReplHashStrContainer2->addNodeList ( &theNodeQueue );
    Replicable* pUser26 = pReplHashStrContainer2->removeObj ( "Yuan S. Feng26", 0 );
    Replicable* pUser27 = pReplHashStrContainer2->removeObj ( "Yuan S. Fing27", 0 );
    Replicable* pUser28 = pReplHashStrContainer2->removeObj ( "Yuan S. Yong28", 0 );
    Replicable* pUser29 = pReplHashStrContainer2->removeObj ( "Yuan S. Ming29", 0 );
    pReplHashStrContainer2->removeNodeList();
    pReplHashStrContainer2->addAndUpdateObj ( pUser26 );
    pReplHashStrContainer2->addAndUpdateObj ( pUser27 );
    pReplHashStrContainer2->addAndUpdateObj ( pUser28 );
    pReplHashStrContainer2->addAndUpdateObj ( pUser29 );
    StringList theStringList;
    theStringList.add ( "Yuan S. Feng26" );
    theStringList.add ( "Yuan S. Fing27" );
    theStringList.add ( "Yuan S. Yong28" );
    theStringList.add ( "Yuan S. Ming29" );
    ReplSender& SendObj = ReplSender::getInstance ( );
    SendObj.sendMutiReplPack ( 2, &theStringList, &theNodeQueue, 70 );
    return true;
}
void WikiNerveSpecPages::addNerveList( int level , XmlNerveInfo& nerve , StringList& lines ) {
	// item string
	String s = String( " " ).replicate( level + 2 ) + "* *" + nerve.name + "*";
	if( !nerve.synonyms.isEmpty() )
		s += " (" + nerve.synonyms + ")";
	if( !nerve.origin.isEmpty() )
		s += "; ORIGIN={" + nerve.origin + "}";
	if( !nerve.branches.isEmpty() )
		s += "; BRANCHES={" + nerve.branches + "}";
	if( !nerve.distribution.isEmpty() )
		s += "; DISTRIBUTION={" + nerve.distribution + "}";
	if( !nerve.modality.isEmpty() )
		s += "; MODALITY={" + nerve.modality + "}";
	
	String muscles = getNerveDivision_muscles( nerve.name );
	if( !muscles.isEmpty() )
		s += "; MUSCLES={" + muscles + "}";

	if( nerve.fibers.count() > 0 )
		s += "; FIBERS={" + getNerveDivision_fibers( nerve.fibers ) + "}";
	if( nerve.rootNerves.count() > 0 )
		s += "; NERVES={" + getNerveDivision_rootNerves( nerve.rootNerves ) + "}";

	lines.add( s );

	// image
	if( !nerve.imgsrc.isEmpty() ) {
		s = String( " " ).replicate( level + 3 ) + "* " + wm -> getImageWikiLink( nerve.imgsrc , nerve.imgheight );
		lines.add( s );
	}

	// childs
	for( int k = 0; k < nerve.childs.count(); k++ )
		addNerveList( level + 1 , nerve.childs.getClassRefByIndex( k ) , lines );
}
void WikiTractsPages::createTracts_addTractTableLines( MapStringToClass<XmlBrainTractSet>& tractsets , StringList& lines ) {
	lines.add( "*Tracts overview*:" );
	lines.add( "|| *Tract* || *Name* || *Function* ||" );
	for( int k = 0; k < tractsets.count(); k++ ) {
		XmlBrainTractSet& one = tractsets.getClassRefByIndex( k );
		createTracts_addTractSetTableLines( one , lines );
	}
}
Example #6
0
void
Test::testTermEditDistance()
{
    { // Test blueprint.
        TermEditDistanceBlueprint prototype;
        {
            EXPECT_TRUE(assertCreateInstance(prototype, "termEditDistance"));

            StringList params, in, out;
            FT_SETUP_FAIL(prototype, params);
            FT_SETUP_FAIL(prototype, params.add("foo"));
            FT_SETUP_FAIL(prototype, params.add("0"));

            FtIndexEnvironment ie;
            ie.getBuilder().addField(FieldType::INDEX, CollectionType::SINGLE, "foo");
            ie.getBuilder().addField(FieldType::INDEX, CollectionType::ARRAY, "afoo");
            ie.getBuilder().addField(FieldType::INDEX, CollectionType::WEIGHTEDSET, "wfoo");
            FT_SETUP_FAIL(prototype, ie, params.clear());
            FT_SETUP_OK  (prototype, ie, params.add("foo"), in.add("fieldLength(foo)"), out.add("out").add("del").add("ins").add("sub"));
            FT_SETUP_FAIL(prototype, ie, params.add("afoo"));
            FT_SETUP_FAIL(prototype, ie, params.add("wfoo"));
            FT_SETUP_FAIL(prototype, ie, params.add("0"));
        }

        {
            FT_DUMP_EMPTY(_factory, "termEditDistance");
            FtIndexEnvironment ie;
            ie.getBuilder().addField(FieldType::ATTRIBUTE, CollectionType::SINGLE, "foo");
            ie.getBuilder().addField(FieldType::INDEX, CollectionType::ARRAY, "abar");
            ie.getBuilder().addField(FieldType::INDEX, CollectionType::WEIGHTEDSET, "wbar");
            FT_DUMP_EMPTY(_factory, "termEditDistance", ie); // must be a single-value index field

            StringList dump;
#ifdef VISIT_BETA_FEATURES
            ie.getBuilder().addField(FieldType::INDEX, CollectionType::SINGLE, "bar");
            vespalib::string bn = "termEditDistance(bar)";
            dump.add(bn + ".out");
            dump.add(bn + ".del");
            dump.add(bn + ".ins");
            dump.add(bn + ".sub");
#endif
            FT_DUMP(_factory, "termEditDistance", ie, dump);
        }
    }

    { // Test executor.
        assertTermEditDistance("abcde", "abcde", 0, 0, 0);
        assertTermEditDistance("abcde", "abcd.", 0, 0, 1);
        assertTermEditDistance("abcde", ".bcd.", 0, 0, 2);
        assertTermEditDistance("abcde", ".bc..", 0, 0, 3);
        assertTermEditDistance("abcde", "..c..", 0, 0, 4);
        assertTermEditDistance("abcd" , "..c..", 0, 1, 3);
        assertTermEditDistance("abc",   "..c..", 0, 2, 2);
        assertTermEditDistance("ab",    "..b..", 0, 3, 1);
        assertTermEditDistance("a",     "..a..", 0, 4, 0);
    }
}
void WikiTractsPages::createNeurons_addEndings( XmlBrainEndingSet& set , StringList& lines ) {
	lines.add( "*" + set.name + "*:" );
	lines.add( "" );
	String s = wm -> getImageWikiLink( set.imgsrc , set.imgheight );
	lines.add( s );
	lines.add( "" );

	for( int k = 0; k < set.childs.count(); k++ )
		createNeurons_addEndingItem( 0 , set.childs.getClassRefByIndex( k ) , lines );
	
	lines.add( "" );
}
void WikiTractsPages::createTracts_addTractSetLines( XmlBrainTractSet& ts , StringList& lines ) {
	lines.add( "TRACT SET: *" + ts.name + "*" );
	lines.add( "" );
	String s = wm -> getImageWikiLink( ts.imgsrc , ts.imgheight );
	lines.add( s );
	lines.add( "" );

	for( int k = 0; k < ts.tracts.count(); k++ ) {
		XmlBrainTract& tract = ts.tracts.getClassRefByIndex( k );
		createTracts_addTractLines( 0 , tract , lines );
	}
}
void WikiTractsPages::createTracts_addTractSetLinks( XmlBrainTractSet& ts , StringList& lines ) {
	lines.add( "" );
	lines.add( "== " + ts.name + " ==" );      //ts.name gives the value from xml file
	lines.add( "" );
	String indexValue = wm -> getTractPageLink( ts.id );
	lines.add( "TRACT SET: " + wm -> getWikiLink( indexValue , ts.name ) );      //ts.name gives the value from xml file

	lines.add( "" );
	for( int k = 0; k < ts.tracts.count(); k++ ) {
		XmlBrainTract& tract = ts.tracts.getClassRefByIndex( k );
		createTracts_addTractLinks( 0 , tract , lines );
	}
}
Example #10
0
void WikiAreaPages::createAreaPages_getCircuitLines( XmlCircuitInfo& info , StringList& lines ) {
	String ref;
	if( info.reference.equals( "UNKNOWN" ) )
		ref = "(unknown reference)";
	else
		ref = "- see [" + info.reference + " Reference]";

	lines.add( "  * [" + info.image + " " + info.name + "] " + ref );
	lines.add( "" );

	lines.add( wm -> getImageWikiLink( info.image , info.imageHeight , info.imageWidth ) );
	lines.add( "" );
}
Example #11
0
int main(){
    LDAPConnection *lc=new LDAPConnection("192.168.3.128",389);
    std::cout << "----------------------doing bind...." <<  std::endl;
    try{
        lc->bind("uid=admin,dc=home,dc=local" , "secret");
        std::cout << lc->getHost() << std::endl;
        StringList tmp;
        tmp.add("subschemasubentry");
        LDAPSearchResults* entries = lc->search("", 
                        LDAPConnection::SEARCH_BASE,
                        "(objectClass=*)",
                        tmp );
        LDAPEntry* rootDse = entries->getNext();
        std::string schemabase="cn=subschema";

        if(rootDse){
            const LDAPAttribute* schemaAttr = rootDse->getAttributes()->getAttributeByName("subschemaSubentry");
            schemabase = *(schemaAttr->getValues().begin());   
        }
        StringList attrs;
        attrs.add("objectClasses");
        attrs.add("attributeTypes");
        entries = lc->search(schemabase, LDAPConnection::SEARCH_BASE, "(objectClass=*)",
                        attrs);
        if (entries != 0){
            LDAPEntry* entry = entries->getNext();
            if(entry != 0){
                const LDAPAttribute* oc = entry->getAttributes()->getAttributeByName("objectClasses");
                LDAPSchema schema;
                schema.setObjectClasses((oc->getValues()));
                LDAPObjClass test = schema.getObjectClassByName("inetOrgPerson");
                std::cout << test.getDesc() << std::endl;
//                StringList mustAttr = test.getMay();
//                for( StringList::const_iterator i = mustAttr.begin(); i != mustAttr.end(); i++ ){
//                    std::cout << *i << std::endl;
//                }
                StringList sup = test.getSup();
                for( StringList::const_iterator i = sup.begin(); i != sup.end(); i++ ){
                    std::cout << *i << std::endl;
                }
            }
        }
        
        lc->unbind();
        delete lc;
   }catch (LDAPException e){
        std::cout << "---------------- caught Exception ---------"<< std::endl;
        std::cout << e << std::endl;
    }

}
Example #12
0
void WikiAreaPages::createAreaPages_createRegionTableSection( MindArea *area , MindLocalCircuitDef& circuit , StringList& lines ) {
	// heading
	String s = createAreaPages_getRegionTableRow( NULL );
	lines.add( s );

	// regions
	MindAreaDef *areaDef = area -> getMindAreaDef();
	MapStringToClass<MindRegionDef>& regionMap = circuit.getRegions();
	for( int k = 0; k < regionMap.count(); k++ ) {
		MindRegionDef *region = regionMap.getClassByIndex( k );
		s = createAreaPages_getRegionTableRow( region );
		lines.add( s );
	}
}
Example #13
0
StringList ArrayList::GetStringList(const string& lName)
{
    //Look for ann array list whose first item is a string with lName and second item is a stringlist, i.e. {{string, {string string string}}
    StringList aList;
    for(u_int i = 0; i < Count(); i++)
    {
        ArrayListItemBase* listPtr = const_cast<ArrayListItemBase*>(mList[i]);

        //Check for a list which first element is a string, i.e. a {{string}, {string, string}} list
        if(dynamic_cast< ArrayListItem<ArrayList> *>(listPtr))
        {
            ArrayList list = (ArrayList) *(dynamic_cast< ArrayListItem<ArrayList> *>(listPtr));
            if(list.Count())
            {
                ArrayListItemBase* anItem = &list[0];
                if(dynamic_cast<ArrayListItem<string>*>(anItem))
                {
                    string str = (string) *dynamic_cast<ArrayListItem<string>*>(anItem);

                    if(str == lName && list.Count() > 1)
                    {
                        ArrayListItemBase* anItem = &list[1];
                        if(dynamic_cast<ArrayListItem<StringList> *>(anItem))
                        {
                            //This is a stringList
                            StringList  list = (StringList) *(dynamic_cast<ArrayListItem<StringList>*>(anItem));
                            for(int i = 0; i < list.Count(); i++)
                            {
                                string str = list[i];
                                aList.add(str);
                            }
                        }
                        if(dynamic_cast<ArrayListItem<ArrayList> *>(anItem))
                        {
                            //Assume this list only contains strings!
                            ArrayList  list = (ArrayList) *(dynamic_cast<ArrayListItem<ArrayList>*>(anItem));
                            for(int i = 0; i < list.Count(); i++)
                            {
                                string str = list.GetString(i);
                                aList.add(str);
                            }
                        }

                    }
                }
            }
        }
    }
    return aList;
}
Example #14
0
StringList *StringTool::parseMatchPattern(const char *pPattern)
{
    char *pBegin;
    char ch;
    StringList *pList = new StringList();
    if (!pList)
        return NULL;
    char achBuf[2048];
    pBegin = achBuf;
    *pBegin++ = 0;
    while ((ch = *pPattern++))
    {
        switch (ch)
        {
        case '*':
        case '?':
            if (pBegin - 1 != achBuf)
                pList->add(achBuf, pBegin - achBuf);
            pBegin = achBuf;
            while (1)
            {
                *pBegin++ = ch;
                if (*pPattern != ch)
                    break;
                ++pPattern;

            }
            if (ch == '*')
                pList->add(achBuf, 1);
            else
                pList->add(achBuf, pBegin - achBuf);
            pBegin = achBuf;
            *pBegin++ = 0;
            break;

        case '\\':
            ch = *pPattern++;
        //fall through
        default:
            if (ch)
                *pBegin++ = ch;
            break;

        }
    }
    if (pBegin - 1 != achBuf)
        pList->add(achBuf, pBegin - achBuf);
    return pList;
}
Example #15
0
void WikiTractsPages::createTracts_addTractSetTableLines( XmlBrainTractSet& ts , StringList& lines ) {
	lines.add( "|| *" + ts.name + "* || || ||" );
	for( int k = 0; k < ts.tracts.count(); k++ ) {
		XmlBrainTract& tract = ts.tracts.getClassRefByIndex( k );
		createTracts_addTractTableLines( 0 , tract , lines );
	}
}
Example #16
0
//search max tid from IP of inlist, and IP list with max tid
uint64_t LcReplGroup::getClientsMaxTid(const StringList &inlist, int idx, uint64_t myTid, StringList &outlist)
{
    HashStringMap< LcNodeInfo *>::iterator hitr;
    StringList::const_iterator itr;
    const char* pSockAddr;
    for ( itr = inlist.begin(); itr != inlist.end(); itr++ )
    {
        pSockAddr = ( *itr )->c_str();
        LS_DBG_M("LcReplGroup::getClientsMaxTid, addr:%s", pSockAddr);
        hitr = getNodeInfoMgr()->getNodeInfoMap().find(pSockAddr);
        assert(hitr != NULL);
        LcNodeInfo *pStatus = hitr.second();
        uint64_t currTid =  pStatus->getCurrTid(idx);
        if (currTid >  myTid)
        {
            LS_DBG_M( "node[%d] priority %lld > myTid %lld", currTid, myTid);
            return currTid;
        }
        else if (currTid == myTid)
        {
            outlist.add(pSockAddr);
        }
    }
    return myTid;
}
Example #17
0
void WikiTractsPages::createNeurons_addEndingItem( int level , XmlBrainEnding& ending , StringList& lines ) {
	String s = String( " " ).replicate( level + 1 ) + "* *" + ending.name + "*";
	if( !ending.id.isEmpty() )
		s += " (" + ending.id + ")";
	if( !ending.function.isEmpty() ) {
		s += ": " + ending.function;
		if( !ending.notes.isEmpty() )
			s += " (" + ending.notes + ")";
	}

	if( ending.fibers.count() > 0 )
		s += "; FIBERS={" + ending.fibers.combine( "; " ) + "}";

	if( ending.tracts.count() > 0 ) {
		String ts;
		for( int k = 0; k < ending.tracts.count(); k++ ) {
			XmlBrainTract& tract = ending.tracts.getClassRefByIndex( k );
			if( k > 0 )
				ts += "; ";
			ts += tract.name;
		}

		s += "; TRACTS={" + ts + "}";
	}

	lines.add( s );

	for( int k = 0; k < ending.childs.count(); k++ )
		createNeurons_addEndingItem( level + 1 , ending.childs.getClassRefByIndex( k ) , lines );
}
void NerveTool::addSingleChain( StringList& fibersinfo , String type , ClassList<StringList>& chain , int from , int to ) {
	StringList mids;
	for( int k = from + 1; k < to; k++ )
		mids.add( chain.getRef( k ).get( 0 ) );

	addFiberItem( fibersinfo , type , chain.getRef( from ).get( 0 ) , chain.getRef( to ).get( 0 ) , mids );
}
Example #19
0
vector<string> Ldap::getPools() {
	vector<string> result;

	StringList attribs;
    attribs.add("ou");

    vector<AttributeMap> ous = search(string("ou=Rechenzentrum,ou=UniFreiburg,")
                .append("ou=RIPM,dc=uni-freiburg,dc=de"),
                LDAP_SCOPE_SUBTREE,
                string("(&(!(ou=Rechenzentrum))(ou=*))"),
                attribs
               );

    for(vector<AttributeMap>::iterator
    		it= ous.begin();
			it!=ous.end();
			it++)
    {
    	if(! (*it)["ou"].empty())
    	{
    		result.push_back( (*it)["ou"] );
    	}
    }

    return result;
}
Example #20
0
void WikiMainPage::execute() {
	bool createMainPage = wm -> checkCreateMainPages();
	if( createMainPage == false ) {
		logger.logInfo( "skip creating main page" );
		return;
	}

	String wikiDir = wm -> getWikiPath();
	String wikiPage = wm -> getMainPage();

	// get sorted circuit list
	MindService *ms = MindService::getService();
	MindMap *mm  = ms -> getMindMap();
	ClassList<MindGlobalCircuitDef>& circuitList = mm -> getMindGlobalCircuits();
	MapStringToClass<MindGlobalCircuitDef> circuitMap;
	for( int k = 0; k < circuitList.count(); k++ ) {
		MindGlobalCircuitDef *cd = circuitList.get( k );
		circuitMap.add( cd -> getName() , cd );
	}

	// collect model circuit section lines
	StringList lines;
	for( int k = 0; k < circuitMap.count(); k++ ) {
		MindGlobalCircuitDef *cd = circuitMap.getClassByIndex( k );
		String name = cd -> getName();
		String id = cd -> getId();

		lines.add( "  * [" + id + " " + name + "]" );
	}

	String sectionName = "Circuits";
	wm -> updateFileSection( wikiDir , wikiPage , sectionName , lines );
}
RoadRunnerData convertCAPIResultData(RRCDataPtr    result)
{
    RoadRunnerData resultData;

    StringList colNames;
    //Copy column names
    for(int i = 0; i < result->CSize; i++)
    {
        colNames.add(result->ColumnHeaders[i]);
    }

    resultData.setColumnNames(colNames);

    //Then the data
    int index = 0;
    resultData.allocate(result->RSize, result->CSize);

    for(int j = 0; j < result->RSize; j++)
    {
        for(int i = 0; i < result->CSize; i++)
        {
            resultData(j,i) = result->Data[index++];
        }
    }

    return resultData;
}
Example #22
0
String WikiAreaPages::createAreaPages_getCircuitKey( MindArea *area , XmlCircuitInfo& info ) {
	// get circuit regions
	StringList comps;
	wm -> circuitsxml.getCircuitComponents( info , comps );

	// check circuit mentions area regions
	StringList compUsed;
	for( int k = 0; k < comps.count(); k++ ) {
		String comp = comps.get( k );
		String region = wm -> hmindxml.getMappedRegion( comp );
		if( !region.isEmpty() )
			if( area -> getMindAreaDef() -> findRegion( region ) != NULL )
				compUsed.add( region );
	}

	if( compUsed.count() == 0 )
		return( "" );

	// make key
	compUsed.sort();
	char l_buf[ 10 ];
	sprintf( l_buf , "%3.3d" , compUsed.count() );

	String key = l_buf;
	for( int k = 0; k < compUsed.count(); k++ )
		key += "." + compUsed.get( k );

	// ensure unique
	key += "." + info.id;
	return( key );
}
void StringListContainer::Add(const string& item)
{
    StringList list;
    list.add(item);
    Add(list);

}
void NerveTool::addFiberItem( StringList& fibersinfo , String type , String from , String to , StringList& mids ) {
	String s = "<fibers type=\"" + type + "\" src=\"" + from + "\" dst=\"" + to + "\">";
	for( int k = 0; k < mids.count(); k++ )
		s += "<mid id=\"" + mids.get( k ) + "\"/>";

	s += "</fibers>";
	fibersinfo.add( s );
}
Example #25
0
void plainconf::loadDirectory(const char *pPath, const char *pPattern)
{
    DIR *pDir = opendir(pPath);

    if (!pDir)
    {
        logToMem(LOG_LEVEL_ERR, "Failed to open directory [%s].", pPath);
        return ;
    }

    struct dirent *dir_ent;

    char str[4096] = {0};
    strcpy(str, pPath);
    strcatchr(str, '/', 4096);
    int offset = strlen(str);
    StringList AllEntries;

    while ((dir_ent = readdir(pDir)))
    {
        const char *pName = dir_ent->d_name;

        if ((strcmp(pName, ".") == 0) ||
            (strcmp(pName, "..") == 0) ||
            (*(pName + strlen(pName) - 1) == '~'))
            continue;

        if (pPattern)
        {
            //Beside the unmatch, also must exclude *,v which was created by rcs
            if(fnmatch(pPattern, pName, FNM_PATHNAME) != 0
                || fnmatch("*,v", pName, FNM_PATHNAME) == 0)
                continue;
        }

        strcpy(str + offset, pName);
        struct stat st;
        if (stat(str, &st) == 0)
        {
            if (S_ISDIR(st.st_mode)
                || pPattern
                || fnmatch("*.conf", pName, FNM_PATHNAME) == 0)
                AllEntries.add(str);
        }
    }
    closedir(pDir);
    AllEntries.sort();

    StringList::iterator iter;
    for (iter = AllEntries.begin(); iter != AllEntries.end(); ++iter)
    {
        const char *pName = (*iter)->c_str();
        logToMem(LOG_LEVEL_INFO, "Processing config file: %s", pName);
        loadConfFile(pName);
    }
}
Example #26
0
void WikiAreaPages::createAreaPages_addInternalConnectionTableLine( MindArea *area , MindLocalCircuitDef& circuit , MindLocalCircuitConnectionDef *link , StringList& lines ) {
	String line;
	String value1;
	if( link == NULL ) {
		// add heading
		lines.add( "" );
		line = "|| *Source Region* || *Target Region* || *Type* || *Reference* ||";
		lines.add( line );
		wm -> clearRepeats1( value1 );
		return;
	}

	// table row
	String reference = wm -> findReference( link );
	value1 = wm -> getRegionReference( link -> getSrcRegion() );
	wm -> clearRepeats1( value1 );
	line = "|| " + value1 + " || " + wm -> getRegionReference( link -> getDstRegion() ) + " || " + 
		link -> getTypeName() + " || " + reference + " ||" ;
	lines.add( line );
}
Example #27
0
void WikiAreaPages::createAreaPages_addInternalConnections( MindArea *area , MindLocalCircuitDef& circuit , StringList& lines , MapStringToClass<MindLocalCircuitConnectionDef>& connections ) {
	if( connections.count() == 0 ) {
		lines.add( "  * no connections" );
		return;
	}

	createAreaPages_addInternalConnectionTableLine( area , circuit , NULL , lines );
	for( int k = 0; k < connections.count(); k++ ) {
		MindLocalCircuitConnectionDef *c = connections.getClassByIndex( k );
		createAreaPages_addInternalConnectionTableLine( area , circuit , c , lines );
	}
}
Example #28
0
void WikiAreaPages::createAreaPages_createConnectivityTableSection( MindArea *area , MindLocalCircuitDef& circuit , StringList& lines ) {
	MapStringToClass<MindLocalCircuitConnectionDef> connections;

	if( !area -> isTargetArea() ) {
		// internal connections
		lines.add( "" );
		lines.add( "*Internal Region Connections:*" );
		createAreaPages_getInternalConnections( area , circuit , connections );
		createAreaPages_addInternalConnections( area , circuit , lines , connections );
	}

	// external connections - in
	lines.add( "" );
	lines.add( "*External Inbound Region Connections:*" );
	MapStringToClass<MindLocalCircuitConnectionDef> connectionsInputs;
	createAreaPages_getExternalConnections( area , circuit , connectionsInputs , true );
	createAreaPages_addExternalConnections( area , circuit , lines , connectionsInputs , true );

	// external connections - out
	lines.add( "" );
	lines.add( "*External Outbound Region Connections:*" );
	MapStringToClass<MindLocalCircuitConnectionDef> connectionsOutputs;
	createAreaPages_getExternalConnections( area , circuit , connectionsOutputs , false );
	createAreaPages_addExternalConnections( area , circuit , lines , connectionsOutputs , false );

	// create dot file
	createDotFile( area , circuit , connections , connectionsInputs , connectionsOutputs );
}
Example #29
0
void WikiAreaPages::createAreaPages_createCircuitsAndReferencesTableSection( String wikiDir , MindArea *area ) {
	// skip circuits for target areas - will be in region pages
	if( area -> isTargetArea() )
		return;

	// collect circuits which reference any of area regions
	MindService *ms = MindService::getService();

	StringList circuits;
	wm -> circuitsxml.getCircuitList( circuits );

	MapStringToString circuitKeys;
	for( int k = 0; k < circuits.count(); k++ ) {
		String circuitId = circuits.get( k );
		XmlCircuitInfo& info = wm -> circuitsxml.getCircuitInfo( circuitId );

		String key = createAreaPages_getCircuitKey( area , info );
		if( key.isEmpty() )
			continue;

		circuitKeys.add( key , circuitId );
	}

	// add circuits section - sorted by relevance
	StringList lines;
	for( int k = circuitKeys.count() - 1; k >= 0; k-- ) {
		String circuitId = circuitKeys.getClassByIndex( k );
		XmlCircuitInfo& info = wm -> circuitsxml.getCircuitInfo( circuitId );
		createAreaPages_getCircuitLines( info , lines );
	}

	String sectionName = "Thirdparty Circuits";
	String wikiPage = wm -> getAreaPage( area -> getAreaId() );
	wm -> updateFileSection( wikiDir , wikiPage , sectionName , lines );
	lines.clear();

	// add unique and sorted references - sorted by relevance
	MapStringToClass<MindArea> refs;
	for( int k = circuitKeys.count() - 1; k >= 0; k-- ) {
		String circuitId = circuitKeys.getClassByIndex( k );
		XmlCircuitInfo& info = wm -> circuitsxml.getCircuitInfo( circuitId );

		if( !info.reference.equals( "UNKNOWN" ) )
			if( refs.get( info.reference ) == NULL ) {
				refs.add( info.reference , area );
				lines.add( String( "  * " ) + info.reference );
			}
	}

	sectionName = "References";
	wm -> updateFileSection( wikiDir , wikiPage , sectionName , lines );
}
char* rrp_cc getNamesFromParameterList(RRParametersHandle handle)
{
    start_try
        Parameters* paras = castToParameters(handle);    
        StringList aList;
        for(int i = 0; i < paras->count(); i++)
        {
            aList.add((*paras)[i]->getName());
        }
        return createText(aList.AsString().c_str());

    catch_ptr_macro
}