本文整理汇总了C++中ClassList类的典型用法代码示例。如果您正苦于以下问题:C++ ClassList类的具体用法?C++ ClassList怎么用?C++ ClassList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ClassList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createAreaPages_getExternalConnections
void WikiAreaPages::createAreaPages_getExternalConnections( MindArea *area , MindLocalCircuitDef& circuit , MapStringToClass<MindLocalCircuitConnectionDef>& connections , bool isin ) {
ClassList<MindLocalCircuitConnectionDef> links;
circuit.getExternalConnections( links , isin );
MindService *ms = MindService::getService();
for( int k = 0; k < links.count(); k++ ) {
MindLocalCircuitConnectionDef *c = links.get( k );
// ignore secondary
if( !c -> isPrimary() )
continue;
String key;
if( isin == false ) {
MindRegion *region = ms -> getMindRegion( c -> getDstRegion() );
key = region -> getArea() -> getAreaId() + "#" + c -> getSrcRegion() + "#" + c -> getDstRegion() + "#1";
if( connections.get( key ) == NULL )
connections.add( key , c );
}
else {
MindRegion *region = ms -> getMindRegion( c -> getSrcRegion() );
key = region -> getArea() -> getAreaId() + "#" + c -> getDstRegion() + "#" + c -> getSrcRegion() + "#2";
if( connections.get( key ) == NULL )
connections.add( key , c );
}
}
}
示例2: addSingleChain
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 );
}
示例3: output_nerve
void NerveTool::output_nerve( FILE *sout , ClassList<Nerve>& nn , int k ) {
Nerve& n = nn.getRef( k );
bool hasChilds = false;
int upLevelCount = 0;
if( nn.count() > ( k + 1 ) ) {
Nerve& nx = nn.getRef( k + 1 );
if( nx.level > n.level )
hasChilds = true;
else
upLevelCount = n.level - nx.level;
}
else
upLevelCount = n.level;
String tabs = String( "\t" ).replicate( 2 + n.level );
String s = tabs + "<element name=\"" + n.name + "\"";
if( !n.synonyms.isEmpty() )
s += "\n" + tabs + "\tsynonyms=\"" + n.synonyms + "\"";
if( !n.origin.isEmpty() )
s += "\n" + tabs + "\torigin=\"" + n.origin + "\"";
if( !n.distribution.isEmpty() )
s += "\n" + tabs + "\tdistribution=\"" + n.distribution + "\"";
if( !n.imginfo.isEmpty() )
s += "\n" + tabs + "\t" + n.imginfo;
if( !n.modality.isEmpty() )
s += "\n" + tabs + "\tmodality=\"" + n.modality + "\"";
if( n.fibers.isEmpty() ) {
if( hasChilds )
s +="\n" + tabs + "\t>\n";
else
s +="\n" + tabs + "\t/>\n";
}
else {
s += "\n" + tabs + "\t>";
String fibersinfo;
for( int z = 0; z < n.fibersinfo.count(); z++ )
fibersinfo += tabs + "\t" + n.fibersinfo.get( z ) + "\n";
s += "\n" + fibersinfo;
if( !hasChilds )
s += tabs + "</element>\n";
}
for( int z = 1; z <= upLevelCount; z++ ) {
tabs = String( "\t" ).replicate( 2 + n.level - z );
s += tabs + "</element>\n";
}
if( ( n.level == 0 && hasChilds == false ) || ( n.level > 0 && ( n.level - upLevelCount ) == 0 ) )
s += "\n";
fprintf( sout , "%s" , ( const char * )s );
}
示例4: typedefMap
static void typedefMap( QMap<QString, QString> & map, ClassDom klass )
{
const TypeAliasList aliasList = klass->typeAliasList();
for( TypeAliasList::ConstIterator it=aliasList.begin(); it!=aliasList.end(); ++it )
map[ ( *it )->name() ] = ( *it )->type();
const ClassList classList = klass->classList();
for( ClassList::ConstIterator it=classList.begin(); it!=classList.end(); ++it )
typedefMap( map, *it );
}
示例5: testClasses
void HierarchyTest::testClasses()
{
ClassList classes;
classes << new Class("Aligator", project);
classes << new Class("Beaver", project);
classes << new Class("Crocodile", project);
QCOMPARE(project->findMembers<Class*>().size(), 3);
QCOMPARE(project->findMembers<Class*>().toSet(), classes.toSet());
}
示例6: getNerveDivision_fibers
String WikiNerveSpecPages::getNerveDivision_fibers( ClassList<XmlNerveFiberInfo>& fibers ) {
String s;
for( int k = 0; k < fibers.count(); k++ ) {
XmlNerveFiberInfo& fiber = fibers.getRef( k );
if( k > 0 )
s += "; ";
s += fiber.type + ":" + getNerveDivision_fiberchain( fiber );
}
return( s );
}
示例7:
ThreadPoolFixedTaskListItem::ThreadPoolFixedTaskListItem( String p_name , int p_threadPoolItem , ClassList<ThreadPoolTask>& p_tasks )
: ThreadPoolItem( p_name , p_threadPoolItem ) {
currentTask = 0;
// assign task list
for( int k = 0; k < p_tasks.count(); k++ ) {
ThreadPoolTask *task = p_tasks.get( k );
task -> thread = this;
tasks.add( task );
}
}
示例8: deleteLattice
void ClassLattice::deleteLattice( void )
//--------------------------------------
{
ClassList * list;
list = _flatClasses;
for( int i = list->count(); i > 0; i -= 1 ) {
delete (*list)[ i - 1 ];
}
delete list;
}
示例9: typeNameList
static void typeNameList( QStringList & path, QStringList & lst, ClassDom klass )
{
path.push_back( klass->name() );
lst << path.join( "::" );
const ClassList classList = klass->classList();
for( ClassList::ConstIterator it=classList.begin(); it!=classList.end(); ++it )
typeNameList( path, lst, *it );
path.pop_back();
}
示例10: float
// create derivaton perceptron
NN *NNRegressionFactory::createDerivationPerceptron( NNVariables *vars , NN *p , NNSamples *pSamples , int sensorFrom , int sensorTo , float ( *targetFunction )( NN *p ) )
{
int nDerivationSensors = sensorTo - sensorFrom + 1;
ASSERT( nDerivationSensors > 0 );
// create perceptron - sensors are the same, targets are required derivatives of target function by given sensor
int nSrcSensors = p -> getNSensors();
int nSrcTargets = p -> getNTargets();
int nDstTargets = nDerivationSensors;
int hiddenLayerSize = ( nDstTargets + nSrcSensors ) / 2;
// variables
// sensors are the same
ClassList<NNVariable> sensors;
for( int k = 0; k < p -> getNSensors(); k++ )
sensors.add( p -> getSensorVariable( k ) );
// targets are derivatives - owned by NN variables
ClassList<NNVariable> targets;
for( int k1 = sensorFrom; k1 <= sensorTo; k1++ )
for( int k = 0; k < p -> getNSensors(); k++ )
targets.add( vars -> addCommonNumberDerivative() );
NN *pd = createDefaultPerceptron( String( p -> getId() ) + "#D" , sensors , targets , hiddenLayerSize );
// create main strategy
String instance;
const char *pInstance = p -> getInstance();
if( pInstance != NULL && *pInstance != 0 )
instance = String( pInstance ) + "::derivative";
NNStrategyBackPropagation *psBPd = createDefaultStrategy( instance , pd );
// populate derivation samples - in the same points as training set
NNSamples pdSamples( nSrcSensors , nDstTargets );
for( int m = 0; m < pSamples -> count(); m++ )
{
NNSample *sample = pSamples -> getByPos( m );
NNSample *sampleD = pdSamples.add();
sampleD -> setSensors( sample -> getSensors() );
getDerivatives( p , sensorFrom , sensorTo , sample , sampleD -> getTargets() , targetFunction );
}
// learn derivative perceptron
bool res = psBPd -> learn( &pdSamples , NULL , NULL );
ASSERT( res );
return( pd );
}
示例11: createAreaPages_getInternalConnections
void WikiAreaPages::createAreaPages_getInternalConnections( MindArea *area , MindLocalCircuitDef& circuit , MapStringToClass<MindLocalCircuitConnectionDef>& connections ) {
ClassList<MindLocalCircuitConnectionDef> links;
circuit.getInternalConnections( links );
for( int k = 0; k < links.count(); k++ ) {
MindLocalCircuitConnectionDef *c = links.get( k );
// ignore secondary
if( !c -> isPrimary() )
continue;
String key = c -> getSrcRegion() + "#" + c -> getDstRegion();
if( connections.get( key ) == NULL )
connections.add( key , c );
}
}
示例12: ASSERTMSG
void ThreadPool::create( ClassList<ThreadPoolTask>& tasks ) {
if( !runEnabled ) {
logger.logInfo( "ignore threadPool=" + name + ", runEnabled=false" );
return;
}
int nTasks = tasks.count();
if( nThreads > nTasks )
nThreads = nTasks;
ASSERTMSG( nThreads >= 1 , "nThreads is invalid" );
int nWhole = nTasks / nThreads;
int nPart = nTasks % nThreads;
// split objects by threads
int nFrom = 0;
for( int k = 0; k < nThreads; k++ ) {
// calculate number of objects for thread
int n = nWhole;
if( nPart ) {
n++;
nPart--;
}
// create list of thread tasks
ClassList<ThreadPoolTask> threadTasks;
threadTasks.allocate( n );
for( int j = 0; j < n; j++ ) {
ThreadPoolTask *task = tasks.get( nFrom + j );
task -> pool = this;
threadTasks.add( task );
}
// create thread (suspended) and add to the pool
String threadName = name + "#" + k;
ThreadPoolItem *thread = new ThreadPoolFixedTaskListItem( threadName , k , threadTasks );
threads.add( thread );
// configure thread
nFrom += n;
}
logger.logInfo( String( "threadpool created: name=" ) + name + ", nThreads=" + nThreads + ", nTasks=" + nTasks );
}
示例13: findClass
int findClass( ClassList& list, ClassLattice * node )
//---------------------------------------------------
{
for( int i = list.count(); i > 0; i -= 1 ) {
if( list[ i - 1 ] && list[ i - 1 ]->isEqual( node ) ) {
return i - 1;
}
}
return -1;
}
示例14: clear
void NNSamples::deserialize( Object *parent , SerializeObject& so )
{
clear();
nSizeIn = so.getPropInt( "nSizeIn" );
nSizeOut = so.getPropInt( "nSizeOut" );
ClassList<NNSample> va;
so.getPropObjectList( ( ClassList<Object>& )va , "sampleList" , true );
for( int k = 0; k < va.count(); k++ )
{
NNSample *sample = va.get( k );
data.add( sample -> getId() , sample );
}
limitType = ( LimitType )so.getPropInt( "limitType" );
maxSize = so.getPropInt( "maxSize" );
}
示例15: collectClassMembers
void
CodeVisitor::collectClassMembers(const ClassDefPtr& p, MemberInfoList& allMembers, bool inherited)
{
ClassList bases = p->bases();
if(!bases.empty() && !bases.front()->isInterface())
{
collectClassMembers(bases.front(), allMembers, true);
}
DataMemberList members = p->dataMembers();
for(DataMemberList::iterator q = members.begin(); q != members.end(); ++q)
{
MemberInfo m;
m.fixedName = fixIdent((*q)->name());
m.inherited = inherited;
m.dataMember = *q;
allMembers.push_back(m);
}
}