本文整理汇总了C++中Initialise函数的典型用法代码示例。如果您正苦于以下问题:C++ Initialise函数的具体用法?C++ Initialise怎么用?C++ Initialise使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Initialise函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Initialise
CMOOSDBHTTPServer::CMOOSDBHTTPServer(long lDBPort, long lWebServerPort)
{
Initialise(lDBPort, lWebServerPort);
}
开发者ID:themoos,项目名称:core-moos,代码行数:4,代码来源:MOOSDBHTTPServer.cpp
示例2: Initialise
BoundedArray<T>::BoundedArray(unsigned int _numElements)
{
Initialise( _numElements );
}
开发者ID:gene9,项目名称:Darwinia-and-Multiwinia-Source-Code,代码行数:4,代码来源:bounded_array.cpp
示例3: Initialise
CSystemTray::CSystemTray()
{
Initialise();
}
开发者ID:xiaoyiqingz,项目名称:PropertyDlg,代码行数:4,代码来源:SystemTray.cpp
示例4: Initialise
Point::Point()
{
Initialise();
}
开发者ID:haddow64,项目名称:Bezier-Curve,代码行数:4,代码来源:CP.cpp
示例5: MoveHeroTo
void MoveHeroTo(int row, int column) // Ћогика движени¤ геро¤
{
unsigned char destinationCell = levelData[row][column];
bool canMoveToCell = false; // √ерой не может пройти в ¤чейку
switch (destinationCell)
{
// —вободна¤ ¤чейка
case ' ':
{
canMoveToCell = true; // √ерой может пройти в ¤чейку
break;
}
// ячейка-выход с ключом
case symbolExitKey:
{
if (isKey)
{
// ѕереход на следующий уровень
++level;
if (level < levelCount)
Initialise();
else
isGameActive = false;
}
isKey = false;
break;
}
// ячейка-выход с расставленными ¤щиками
case symbolBoxExit:
{
if (filledBoxArea == boxAreaCount)
{
// ѕереход на следующий уровень
++level;
if (level < 15)
Initialise();
else
isGameActive = false;
}
break;
}
// ячейка-выход
case symbolExit:
{
if (collectedCrystals == crystalsCount)
{
// ѕереход на следующий уровень
++level;
if (level < levelCount)
Initialise();
else
isGameActive = false;
}
break;
}
// ячейка-мина
case symbolMine:
{
Initialise();
break;
}
// ячейка-кристалл
case symbolCrystal:
{
canMoveToCell = true;
collectedCrystals++;
break;
}
// ячейка-ключ
case symbolKey:
{
canMoveToCell = true;
isKey = true;
break;
}
// ячейка места дл¤ ¤щика
case symbolBoxArea:
{
canMoveToCell = true;
break;
}
// ячейка-¤щик
case symbolBox:
{
// –асчЄт направлени¤ движени¤ геро¤:
int heroDirectionR = row - heroRow;
int heroDirectionC = column - heroColumn;
//.........这里部分代码省略.........
开发者ID:sibsutis-team,项目名称:Sokoban_Game,代码行数:101,代码来源:Hero_Movement.cpp
示例6: DEBUGFDEVICE
void MathPluginManagement::ProcessSwitchProperties(Telescope* pTelescope, const char *name, ISState *states, char *names[], int n)
{
DEBUGFDEVICE(pTelescope->getDeviceName(), INDI::Logger::DBG_DEBUG, "ProcessSwitchProperties - name(%s)", name);
if (strcmp(name, AlignmentSubsystemMathPluginsV.name) == 0)
{
int CurrentPlugin = IUFindOnSwitchIndex(&AlignmentSubsystemMathPluginsV);
IUUpdateSwitch(&AlignmentSubsystemMathPluginsV, states, names, n);
AlignmentSubsystemMathPluginsV.s = IPS_OK; // Assume OK for the time being
int NewPlugin = IUFindOnSwitchIndex(&AlignmentSubsystemMathPluginsV);
if (NewPlugin != CurrentPlugin)
{
// New plugin requested
// Unload old plugin if required
if (0 != CurrentPlugin)
{
typedef void Destroy_t(MathPlugin *);
Destroy_t* Destroy = (Destroy_t*)dlsym(LoadedMathPluginHandle, "Destroy");
if (NULL != Destroy)
{
Destroy(pLoadedMathPlugin);
pLoadedMathPlugin = NULL;
if (0 == dlclose(LoadedMathPluginHandle))
{
LoadedMathPluginHandle = NULL;
}
else
{
IDLog("MathPluginManagement - dlclose failed on loaded plugin - %s\n", dlerror());
AlignmentSubsystemMathPluginsV.s = IPS_ALERT;
}
}
else
{
IDLog("MathPluginManagement - cannot get Destroy function - %s\n", dlerror());
AlignmentSubsystemMathPluginsV.s = IPS_ALERT;
}
}
// Load the requested plugin if required
if (0 != NewPlugin)
{
std::string PluginPath(MathPluginFiles[NewPlugin - 1]);
if (NULL != (LoadedMathPluginHandle = dlopen(PluginPath.c_str(), RTLD_NOW)))
{
typedef MathPlugin* Create_t();
Create_t* Create = (Create_t*)dlsym(LoadedMathPluginHandle, "Create");
if (NULL != Create)
{
pLoadedMathPlugin = Create();
IUSaveText(&AlignmentSubsystemCurrentMathPlugin, PluginPath.c_str());
}
else
{
IDLog("MathPluginManagement - cannot get Create function - %s\n", dlerror());
AlignmentSubsystemMathPluginsV.s = IPS_ALERT;
}
}
else
{
IDLog("MathPluginManagement - cannot load plugin %s error %s\n", PluginPath.c_str(), dlerror());
AlignmentSubsystemMathPluginsV.s = IPS_ALERT;
}
}
else
{
// It is in built plugin just set up the pointers
pLoadedMathPlugin = &BuiltInPlugin;
}
}
// Update client
IDSetSwitch(&AlignmentSubsystemMathPluginsV, NULL);
}
else if (strcmp(name, AlignmentSubsystemMathPluginInitialiseV.name) == 0)
{
AlignmentSubsystemMathPluginInitialiseV.s = IPS_OK;
IUResetSwitch(&AlignmentSubsystemMathPluginInitialiseV);
// Update client display
IDSetSwitch(&AlignmentSubsystemMathPluginInitialiseV, NULL);
// Initialise or reinitialise the current math plugin
Initialise(CurrentInMemoryDatabase);
}
else if (strcmp(name, AlignmentSubsystemActiveV.name) == 0)
{
AlignmentSubsystemActiveV.s=IPS_OK;
if (0 == IUUpdateSwitch(&AlignmentSubsystemActiveV, states, names, n))
// Update client
IDSetSwitch(&AlignmentSubsystemActiveV, NULL);
}
}
开发者ID:LabAixBidouille,项目名称:Indi,代码行数:91,代码来源:MathPluginManagement.cpp
示例7: Initialise
DataIndices::DataIndices( const unsigned& x, const unsigned& y, const unsigned& z ) {
Initialise( x, y, z );
}
开发者ID:mikbitz,项目名称:MadHPC,代码行数:3,代码来源:DataIndices.cpp
示例8: Initialise
CSensorDataFilter::CSensorDataFilter()
{
Initialise();
}
开发者ID:ifreecarve,项目名称:SGMOOS,代码行数:4,代码来源:SensorDataFilter.cpp
示例9: Initialise
CColourPopup::CColourPopup()
{
Initialise();
}
开发者ID:BackupTheBerlios,项目名称:iris-svn,代码行数:4,代码来源:ColourPopup.cpp
示例10: main
int main(int argc, char *argv[])
{
char *datafn, *s;
int nSeg;
void Initialise(void);
void LoadFile(char *fn);
void EstimateModel(void);
void SaveModel(char *outfn);
if(InitShell(argc,argv,hinit_version,hinit_vc_id)<SUCCESS)
HError(2100,"HInit: InitShell failed");
InitMem(); InitLabel();
InitMath(); InitSigP();
InitWave(); InitAudio();
InitVQ(); InitModel();
if(InitParm()<SUCCESS)
HError(2100,"HInit: InitParm failed");
InitTrain(); InitUtil();
if (!InfoPrinted() && NumArgs() == 0)
ReportUsage();
if (NumArgs() == 0) Exit(0);
SetConfParms();
CreateHMMSet(&hset,&gstack,FALSE);
while (NextArg() == SWITCHARG) {
s = GetSwtArg();
if (strlen(s)!=1)
HError(2119,"HInit: Bad switch %s; must be single letter",s);
switch(s[0]){
case 'e':
epsilon = GetChkedFlt(0.0,1.0,s); break;
case 'g':
ignOutVec = FALSE; break;
case 'i':
maxIter = GetChkedInt(0,100,s); break;
case 'l':
if (NextArg() != STRINGARG)
HError(2119,"HInit: Segment label expected");
segLab = GetStrArg();
break;
case 'm':
minSeg = GetChkedInt(1,1000,s); break;
case 'n':
newModel = FALSE; break;
case 'o':
outfn = GetStrArg();
break;
case 'u':
SetuFlags(); break;
case 'v':
minVar = GetChkedFlt(0.0,10.0,s); break;
case 'w':
mixWeightFloor = MINMIX * GetChkedFlt(0.0,100000.0,s);
break;
case 'B':
saveBinary = TRUE;
break;
case 'F':
if (NextArg() != STRINGARG)
HError(2119,"HInit: Data File format expected");
if((dff = Str2Format(GetStrArg())) == ALIEN)
HError(-2189,"HInit: Warning ALIEN Data file format set");
break;
case 'G':
if (NextArg() != STRINGARG)
HError(2119,"HInit: Label File format expected");
if((lff = Str2Format(GetStrArg())) == ALIEN)
HError(-2189,"HInit: Warning ALIEN Label file format set");
break;
case 'H':
if (NextArg() != STRINGARG)
HError(2119,"HInit: HMM macro file name expected");
AddMMF(&hset,GetStrArg());
break;
case 'I':
if (NextArg() != STRINGARG)
HError(2119,"HInit: MLF file name expected");
LoadMasterFile(GetStrArg());
break;
case 'L':
if (NextArg()!=STRINGARG)
HError(2119,"HInit: Label file directory expected");
labDir = GetStrArg(); break;
case 'M':
if (NextArg()!=STRINGARG)
HError(2119,"HInit: Output macro file directory expected");
outDir = GetStrArg();
break;
case 'T':
if (NextArg() != INTARG)
HError(2119,"HInit: Trace value expected");
trace = GetChkedInt(0,01777,s);
break;
case 'X':
if (NextArg()!=STRINGARG)
HError(2119,"HInit: Label file extension expected");
labExt = GetStrArg(); break;
default:
HError(2119,"HInit: Unknown switch %s",s);
//.........这里部分代码省略.........
开发者ID:nlphacker,项目名称:OpenSpeech,代码行数:101,代码来源:HInit.c
示例11: Initialise
Logger::Logger()
{
Initialise();
}
开发者ID:shanewfx,项目名称:BDK,代码行数:4,代码来源:log.cpp
示例12: main
int main(int argc, char *argv[])
{
MPI_Comm CommWorld;
int rank;
int procCount;
int procToWatch;
Dictionary* dictionary;
ExtensionManager_Register* extensionMgr_Register;
Topology* nTopology;
ElementLayout* eLayout;
NodeLayout* nLayout;
MeshDecomp* decomp;
MeshLayout* ml;
Mesh* mesh;
Stream* stream;
/* Initialise MPI, get world info */
MPI_Init(&argc, &argv);
MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
MPI_Comm_size(CommWorld, &procCount);
MPI_Comm_rank(CommWorld, &rank);
Base_Init( &argc, &argv );
DiscretisationGeometry_Init( &argc, &argv );
DiscretisationShape_Init( &argc, &argv );
DiscretisationMesh_Init( &argc, &argv );
stream = Journal_Register (Info_Type, "myStream");
procToWatch = argc >= 2 ? atoi(argv[1]) : 0;
dictionary = Dictionary_New();
Dictionary_Add( dictionary, "rank", Dictionary_Entry_Value_FromUnsignedInt( rank ) );
Dictionary_Add( dictionary, "numProcessors", Dictionary_Entry_Value_FromUnsignedInt( procCount ) );
Dictionary_Add( dictionary, "meshSizeI", Dictionary_Entry_Value_FromUnsignedInt( 7 ) );
Dictionary_Add( dictionary, "meshSizeJ", Dictionary_Entry_Value_FromUnsignedInt( 7 ) );
Dictionary_Add( dictionary, "meshSizeK", Dictionary_Entry_Value_FromUnsignedInt( 7 ) );
Dictionary_Add( dictionary, "allowUnusedCPUs", Dictionary_Entry_Value_FromBool( False ) );
Dictionary_Add( dictionary, "allowPartitionOnNode", Dictionary_Entry_Value_FromBool( True ) );
Dictionary_Add( dictionary, "allowUnbalancing", Dictionary_Entry_Value_FromBool( False ) );
Dictionary_Add( dictionary, "shadowDepth", Dictionary_Entry_Value_FromUnsignedInt( 1 ) );
nTopology = (Topology*)IJK6Topology_New( "IJK6Topology", dictionary );
eLayout = (ElementLayout*)ParallelPipedHexaEL_New( "PPHexaEL", 3, dictionary );
nLayout = (NodeLayout*)CornerNL_New( "CornerNL", dictionary, eLayout, nTopology );
decomp = (MeshDecomp*)HexaMD_New( "HexaMD", dictionary, MPI_COMM_WORLD, eLayout, nLayout );
ml = MeshLayout_New( "MeshLayout", eLayout, nLayout, decomp );
extensionMgr_Register = ExtensionManager_Register_New();
mesh = Mesh_New( "Mesh", ml, sizeof(Node), sizeof(Element), extensionMgr_Register, dictionary );
mesh->buildNodeLocalToGlobalMap = True;
mesh->buildNodeDomainToGlobalMap = True;
mesh->buildNodeGlobalToLocalMap = True;
mesh->buildNodeGlobalToDomainMap = True;
mesh->buildNodeNeighbourTbl = True;
mesh->buildNodeElementTbl = True;
mesh->buildElementLocalToGlobalMap = True;
mesh->buildElementDomainToGlobalMap = True;
mesh->buildElementGlobalToDomainMap = True;
mesh->buildElementGlobalToLocalMap = True;
mesh->buildElementNeighbourTbl = True;
mesh->buildElementNodeTbl = True;
Build( mesh, 0, False );
Initialise(mesh, 0, False );
if (rank == procToWatch)
{
Node_Index currElementNodesCount=0;
Node_Index* currElementNodes = NULL;
Element_Index element_dI = 0;
Node_Index refNode_eI = 0;
Node_Index node_Diagonal = 0;
Node_Index node_Diagonal_gI = 0;
// only use this while setting up the test
//Print(mesh, stream);
// Some tests involving RegularMeshUtils_GetDiagOppositeAcrossElementNodeIndex()
for (element_dI=0; element_dI < mesh->elementDomainCount; element_dI++) {
currElementNodes = mesh->elementNodeTbl[element_dI];
currElementNodesCount = mesh->elementNodeCountTbl[element_dI];
for (refNode_eI = 0; refNode_eI < currElementNodesCount; refNode_eI++ ) {
node_Diagonal = RegularMeshUtils_GetDiagOppositeAcrossElementNodeIndex(mesh, element_dI,
currElementNodes[refNode_eI]) ;
node_Diagonal_gI = Mesh_NodeMapDomainToGlobal( mesh, node_Diagonal );
//print message stating: Element #, curr node #, diag opp node #
printf("Element #: %d, Current Node #: %d, Diagonal Node #: %d, (%d) \n",
element_dI, currElementNodes[refNode_eI], node_Diagonal, node_Diagonal_gI);
}
//.........这里部分代码省略.........
开发者ID:bmi-forum,项目名称:bmi-pyre,代码行数:101,代码来源:testRegularMeshUtils.c
示例13: tDigitalDataManager
//.........这里部分代码省略.........
&m_DigitalDataConfig,
SIGNAL(SimulatorEnabledChanged(bool)),
m_pNMEA0183,
SLOT(SetSimulatorEnabled(bool)) );
Connect(
&m_DigitalDataConfig,
SIGNAL(LocalTimeOffsetChanged(int)),
m_pNMEA0183,
SLOT(SetLocalTimeOffset(int)) );
Connect(
m_pNMEA0183,
SIGNAL(RequestExitAppRestart()),
this,
SIGNAL(RequestExitAppRestart()));
Connect(
m_pNMEA0183,
SIGNAL(RequestExitTestMode()),
this,
SIGNAL(RequestExitTestMode()));
Connect(
m_pNMEA0183,
SIGNAL(RequestExitBurnin()),
this,
SIGNAL(RequestExitBurnin()));
m_pNMEA0183->SetSimulatorEnabled(m_DigitalDataConfig.SimulatorEnabled());
m_pNMEA0183->SetLocalTimeOffset(m_DigitalDataConfig.LocalTimeOffset());
}
{
m_pSimulateDataEngine = new tSimulateDataEngine(*m_pNavigationDataEngine, m_DigitalDataConfig.SailingFeaturesAllowed());
RegisterDataEngine( DATA_ENGINE_SIMULATE, m_pSimulateDataEngine );
QVector<tDataType> simulatedTypes = m_pSimulateDataEngine->SimulatedDataTypes();
m_pActiveDataEngine->SetSimulationTypes(simulatedTypes);
}
{
int numEngines = tDigitalData::NumInstances(DATA_CATEGORY_ENGINE);
int numTanks = tDigitalData::NumInstances(DATA_CATEGORY_FUEL_TANK);
m_pFuelManagementEngine = new tFuelManagementEngine(numEngines, numTanks, *m_pFuelSettings);
Connect(m_pSourceSelection, SIGNAL(NumInstancesChanged(int)), m_pFuelManagementEngine, SLOT(OnNumberInstancesChanged(int)));
RegisterDataEngine( DATA_ENGINE_FUEL_MANAGEMENT, m_pFuelManagementEngine );
RegisterDataEngine( DATA_ENGINE_VESSEL_FUEL_MANAGEMENT, m_pFuelManagementEngine );
}
}
// Connection for tNMEA0183
Connect( m_pNMEA0183, SIGNAL( UtcTimeAndDateUpdated( const tDataId&, const QTime&, const QDate& ) ),
this, SLOT( OnUtcTimeAndDateUpdated(const tDataId&, const QTime&, const QDate& ) ) );
// Connect signal to be notified when a 0183 MOB is received
Connect(m_pNMEA0183, SIGNAL(MOBReceived(const tRCoord&, QString)), this, SIGNAL(MOBReceived(const tRCoord&, QString)));
// Create the virtual device objects
{
char iGpsSource;
if (m_pNMEA0183->GetIGPSSource(&iGpsSource))
{
m_pIGPSVirtualDevice = new tInternalGPSVirtualDevice(
iGpsSource,
m_NDP2k,
*m_pNMEA0183Settings,
*m_pNDP2kDataEngine );
}
if(m_DigitalDataConfig.Ndp2kNavVirtualDeviceAllowed() == true)
{
tNavigationVirtualDevice::tConfig config =
{
tNavigationVirtualDevice::tSailingFeaturesAllowed(m_DigitalDataConfig.SailingFeaturesAllowed())
};
m_pNavigationVirtualDevice = new tNavigationVirtualDevice(
m_NDP2k,
*m_pNavigationDataEngine,
*m_pNDP2kDataEngine,
config);
Connect( &m_DigitalDataConfig, SIGNAL(LocalTimeOffsetChanged(int)), m_pNavigationVirtualDevice, SLOT(SetLocalTimeOffset(int)) );
m_pNavigationVirtualDevice->SetLocalTimeOffset(m_DigitalDataConfig.LocalTimeOffset());
m_pNavigationVirtualDevice->Initialise();
}
// NMEA0183 Virtual Device(s)
QList<char> nmea0183Sources = m_pNMEA0183->Get0183Sources();
if(nmea0183Sources.size() > 0) // Port 1
{
m_pNMEA0183VirtualDevice1 = CreateAndConnectNMEA0183VirtualDevice(nmea0183Sources[0], tNDP2k::TxDeviceNmea0183Port1);
}
if(nmea0183Sources.size() > 1) // Port 2
{
m_pNMEA0183VirtualDevice2 = CreateAndConnectNMEA0183VirtualDevice(nmea0183Sources[1], tNDP2k::TxDeviceNmea0183Port2);
}
}
开发者ID:dulton,项目名称:53_hero,代码行数:101,代码来源:tMFDDigitalDataManager.cpp
示例14: Initialise
Tree::Tree()
{
Initialise();
}
开发者ID:jatin3893,项目名称:CompGraphicsAssignments,代码行数:4,代码来源:Tree.cpp
示例15: main
//.........这里部分代码省略.........
break;
case 'u':
SetuFlags();
break;
case 'v':
MSDthresh = GetChkedFlt(0.0, 1.0, s);
break;
case 'w':
fGVDistWght = GetChkedFlt(0.0, 1000.0, s);
break;
case 'x':
if (NextArg() != STRINGARG)
HError(6601, "HMgeTool: HMM file extension expected");
hmmExt = GetStrArg();
break;
case 'B':
inBinary = TRUE;
break;
case 'G':
mtInfo->nGainStreamIndex = GetChkedInt(1, SMAX, s);
mtInfo->nGainDimIndex = GetChkedInt(1, 1000, s);
if (NextArg() == FLOATARG || NextArg() == INTARG)
mtInfo->fGainWghtComp = GetChkedFlt(-10000.0, 1000000.0, s);
break;
case 'H':
if (NextArg() != STRINGARG)
HError(6601, "HMgeTool: HMM macro file name expected");
mmfFn = GetStrArg();
AddMMF(&hset, mmfFn);
break;
case 'I':
if (NextArg() != STRINGARG)
HError(6601, "HMgeTool: MLF file name expected");
LoadMasterFile(GetStrArg());
break;
case 'J': /* regression class and tree */
if (NextArg() != STRINGARG)
HError(6601, "HMgeTool: HMM regression class/tree file name expected");
s = GetStrArg();
AddMMF(&hset, s);
AddMMF(&orighset, s);
break;
case 'K':
if (NextArg() != STRINGARG)
HError(6601, "HMgeTool: HMM transform file name expected");
xformfn = GetStrArg();
break;
case 'L':
if (NextArg() != STRINGARG)
HError(6601, "HMgeTool: Label file directory expected");
labDir = GetStrArg();
break;
case 'M':
if (NextArg() != STRINGARG)
HError(6601, "HMgeTool: Output macro file directory expected");
outDir = GetStrArg();
break;
case 'T':
trace = GetChkedInt(0, 0100000, s);
break;
case 'X':
if (NextArg() != STRINGARG)
HError(2319, "HMGenS: Label file extension expected");
labExt = GetStrArg();
break;
default:
HError(6601, "HMgeTool: Unknown switch %s", s);
}
}
if (NextArg() != STRINGARG)
HError(6601, "HMgeTool: file name of model list expected");
hmmListFn = GetStrArg();
Initialise();
if (funcType == MGE_EVAL) {
PerformMgeEval();
} else if (funcType == MGE_TRAIN) {
PerformMgeTrain();
if (endIter > 0 && bMgeUpdate) {
/* output HMM files */
ConvDiagC(&hset, TRUE);
SaveHMMSet(&hset, outDir, outExt, NULL, inBinary);
}
} else if (funcType == MGE_ADAPT) {
PerformMgeAdapt();
if (endIter > 0 && bMgeUpdate) {
MakeFN(xformfn, outDir, NULL, fname);
SaveOneXForm(&hset, hset.curXForm, fname, FALSE);
}
}
ResetHeap(&hmmStack);
ResetHeap(&orighmmStack);
ResetHeap(&accStack);
ResetHeap(&genStack);
ResetHeap(&mgeStack);
return 0;
}
开发者ID:nlphacker,项目名称:OpenSpeech,代码行数:101,代码来源:HMgeTool.c
示例16: main
int main(int argc, char *argv[])
{
char *datafn, *s;
int stream = 0;
void Initialise(char *datafn);
void LoadFile(char *fn);
void CalcMeanCov(Sequence seq[], int s);
void ClusterVecs(Sequence seq[], int s);
void WriteVQTable(ClusterSet *cs[], char *fn);
if(InitShell(argc,argv,hquant_version,hquant_vc_id)<SUCCESS)
HError(2500,"HQuant: InitShell failed");
InitMem(); InitLabel();
InitMath(); InitSigP();
InitWave(); InitAudio();
InitVQ(); InitModel();
if(InitParm()<SUCCESS)
HError(2500,"HQuant: InitParm failed");
InitTrain();
if (!InfoPrinted() && NumArgs() == 0)
ReportUsage();
if (NumArgs() == 0) Exit(0);
SetConfParms();
InitStreamVars();
while (NextArg() == SWITCHARG) {
s = GetSwtArg();
if (strlen(s)!=1)
HError(2519,"HQuant: Bad switch %s; must be single letter",s);
switch(s[0]){
case 'd':
if ( ck != NULLC) HError(2519,"HQuant: Specify one of -d or -f, not both");
ck = INVDIAGC;
break;
case 'f':
if ( ck != NULLC) HError(2519,"HQuant: Specify one of -d or -f, not both");
ck = FULLC;
break;
case 'g':
globClustVar = TRUE;
break;
case 'l':
if (NextArg() != STRINGARG)
HError(2519,"HQuant: Segment label expected");
segLab = GetStrArg();
break;
case 'n':
if (NextArg() != INTARG)
HError(2519,"HQuant: Stream number expected");
stream = GetChkedInt(1,SMAX,s);
if (NextArg() != INTARG)
HError(2519,"HQuant: Codebook size expected");
cbSizes[stream]= GetChkedInt(1,32768,s);
break;
case 's':
if (NextArg() != INTARG)
HError(2519,"HQuant: Number of streams expected");
swidth[0] = GetChkedInt(1,SMAX,s);
break;
case 't':
tType = binTree;
break;
case 'w':
if (NextArg() != INTARG)
HError(2519,"HQuant: Stream number expected");
stream = GetChkedInt(1,SMAX,s);
if(swidth[0] < stream) swidth[0] = stream;
widthSet = TRUE;
if (NextArg() != INTARG)
HError(2519,"HQuant: Stream width expected");
swidth[stream]= GetChkedInt(1,256,s);
break;
case 'F':
if (NextArg() != STRINGARG)
HError(2519,"HQuant: Data File format expected");
if((dff = Str2Format(GetStrArg())) == ALIEN)
HError(-2589,"HQuant: Warning ALIEN Data file format set");
break;
case 'G':
if (NextArg() != STRINGARG)
HError(2519,"HQuant: Label File format expected");
if((lff = Str2Format(GetStrArg())) == ALIEN)
HError(-2589,"HQuant: Warning ALIEN Label file format set");
break;
case 'I':
if (NextArg() != STRINGARG)
HError(2519,"HQuant: MLF file name expected");
LoadMasterFile(GetStrArg());
break;
case 'L':
if (NextArg()!=STRINGARG)
HError(2519,"HQuant: Label file directory expected");
labDir = GetStrArg();
break;
case 'T':
if (NextArg() != INTARG)
HError(2519,"HQuant: Trace value expected");
trace = GetChkedInt(0,077,s);
//.........这里部分代码省略.........
开发者ID:nlphacker,项目名称:OpenSpeech,代码行数:101,代码来源:HQuant.c
示例17: extract_paint_session
static std::vector<paint_session> extract_paint_session(const std::string parkFileName)
{
core_init();
gOpenRCT2Headless = true;
auto context = OpenRCT2::CreateContext();
std::vector<paint_session> sessions;
log_info("Starting...");
if (context->Initialise())
{
drawing_engine_init();
if (!context->LoadParkFromFile(parkFileName))
{
log_error("Failed to load park!");
return {};
}
gIntroState = INTRO_STATE_NONE;
gScreenFlags = SCREEN_FLAGS_PLAYING;
int32_t mapSize = gMapSize;
int32_t resolutionWidth = (mapSize * 32 * 2);
int32_t resolutionHeight = (mapSize * 32 * 1);
resolutionWidth += 8;
resolutionHeight += 128;
rct_viewport viewport;
viewport.x = 0;
viewport.y = 0;
viewport.width = resolutionWidth;
viewport.height = resolutionHeight;
viewport.view_width = viewport.width;
viewport.view_height = viewport.height;
viewport.var_11 = 0;
viewport.flags = 0;
int32_t customX = (gMapSize / 2) * 32 + 16;
int32_t customY = (gMapSize / 2) * 32 + 16;
int32_t x = 0, y = 0;
int32_t z = tile_element_height(customX, customY) & 0xFFFF;
x = customY - customX;
y = ((customX + customY) / 2) - z;
viewport.view_x = x - ((viewport.view_width) / 2);
viewport.view_y = y - ((viewport.view_height) / 2);
viewport.zoom = 0;
gCurrentRotation = 0;
// Ensure sprites appear regardless of rotation
reset_all_sprite_quadrant_placements();
rct_drawpixelinfo dpi;
dpi.x = 0;
dpi.y = 0;
dpi.width = resolutionWidth;
dpi.height = resolutionHeight;
dpi.pitch = 0;
dpi.bits = (uint8_t*)malloc(dpi.width * dpi.height);
log_info("Obtaining sprite data...");
viewport_render(&dpi, &viewport, 0, 0, viewport.width, viewport.height, &sessions);
free(dpi.bits);
drawing_engine_dispose();
}
log_info("Got %u paint sessions.", std::size(sessions));
return sessions;
}
开发者ID:OpenRCT2,项目名称:OpenRCT2,代码行数:69,代码来源:BenchSpriteSort.cpp
示例18: On_Execute
//---------------------------------------------------------
bool CGridding_Spline_CSA::On_Execute(void)
{
//-----------------------------------------------------
if( Initialise(m_Points, true) == false )
{
return( false );
}
//-----------------------------------------------------
int i, x, y;
TSG_Point p;
csa *pCSA = csa_create();
csa_setnpmin(pCSA, Parameters("NPMIN") ->asInt());
csa_setnpmax(pCSA, Parameters("NPMAX") ->asInt());
csa_setk (pCSA, Parameters("K") ->asInt());
csa_setnppc (pCSA, Parameters("NPPC") ->asDouble());
//-----------------------------------------------------
point *pSrc = (point *)SG_Malloc(m_Points.Get_Count() * sizeof(point));
for(i=0; i<m_Points.Get_Count() && Set_Progress(i, m_Points.Get_Count()); i++)
{
pSrc[i].x = m_Points[i].x;
pSrc[i].y = m_Points[i].y;
pSrc[i].z = m_Points[i].z;
}
csa_addpoints(pCSA, m_Points.Get_Count(), pSrc);
m_Points.Clear();
//-----------------------------------------------------
point *pDst = (point *)SG_Malloc(m_pGrid->Get_NCells() * sizeof(point));
for(y=0, i=0, p.y=m_pGrid->Get_YMin(); y<m_pGrid->Get_NY() && Set_Progress(y, m_pGrid->Get_NY()); y++, p.y+=m_pGrid->Get_Cellsize())
{
for(x=0, p.x=m_pGrid->Get_XMin(); x<m_pGrid->Get_NX(); x++, p.x+=m_pGrid->Get_Cellsize(), i++)
{
pDst[i].x = p.x;
pDst[i].y = p.y;
}
}
//-----------------------------------------------------
Process_Set_Text(_TL("calculating splines..."));
csa_calculatespline (pCSA);
Process_Set_Text(_TL("approximating points..."));
csa_approximate_points (pCSA, m_pGrid->Get_NCells(), pDst);
//-----------------------------------------------------
for(y=0, i=0; y<m_pGrid->Get_NY() && Set_Progress(y, m_pGrid->Get_NY()); y++)
{
for(x=0; x<m_pGrid->Get_NX(); x++, i++)
{
if( isnan(pDst[i].z) )
{
m_pGrid->Set_NoData(x, y);
}
else
{
m_pGrid->Set_Value(x, y, pDst[i].z);
}
}
}
//-----------------------------------------------------
csa_destroy(pCSA);
SG_Free(pSrc);
SG_Free(pDst);
//-----------------------------------------------------
return( true );
}
开发者ID:johanvdw,项目名称:saga-debian,代码行数:78,代码来源:Gridding_Spline_CSA.cpp
示例19: exit
//load the desktop file or the required template
void Dialog::LoadDesktopFile(QString input)
{
//if we have "-" as 1st char, it means that this is not a desktop file, but a parameter
desktopFileName = input;
if (input.startsWith("-")) {
QMessageBox::critical(this,tr("Error"),tr("The filename cannot start with a \"-\"."));
exit(1);
}
//if proposed file does not exist, than we will create one based on the templates
QFileInfo info(desktopFileName);
if ((info.size() == 0) && (desktopFileName.endsWith(".desktop"))) {
QFile::remove(desktopFileName); //for the copy, we need to remove it
if (desktopType=="link") {
copyTemplate("-link");
} else {
copyTemplate("-app");
}
}
this->setWindowTitle(desktopFileName.section("/",-1));
ui->tabWidget->setCurrentIndex(0); //always start on the file info tab
//Now load the file info and put it into the UI
QString mime = LXDG::findAppMimeForFile(desktopFileName);
QList<QByteArray> fmt = QImageReader::supportedImageFormats();
bool foundimage=false;
for(int i=0; i<fmt.length(); i++){
if(info.suffix().toLower() == QString(fmt[i]).toLower()){foundimage=true; break; }
}
if(foundimage){
ui->label_file_icon->setPixmap( QPixmap(desktopFileName).scaledToHeight(64) );
}else{
ui->label_file_icon->setPixmap( LXDG::findMimeIcon(mime).pixmap(QSize(64,64)) );
}
ui->label_file_mimetype->setText(mime);
QString type;
if(desktopFileName.endsWith(".desktop")){ type = tr("XDG Shortcut"); }
else if(info.isDir()){ type = tr("Directory"); ui->label_file_icon->setPixmap( LXDG::findIcon("folder","").pixmap(QSize(64,64)) ); }
else if(info.isExecutable()){ type = tr("Binary"); }
else{ type = info.suffix().toUpper(); }
if(info.isHidden()){ type = QString(tr("Hidden %1")).arg(type); }
ui->label_file_type->setText(type);
double bytes = info.size();
QStringList lab; lab << "B" << "KB" << "MB" << "GB" << "TB" << "PB";
int i=0;
while(i<lab.length() && bytes>1024){
bytes = bytes/1024;
i++; //next label
}
//convert the size to two decimel places and add the label
QString sz = QString::number( qRound(bytes*100)/100.0 )+lab[i];
ui->label_file_size->setText( sz );
ui->label_file_owner->setText(info.owner());
ui->label_file_group->setText(info.group());
QString perms;
if(info.isReadable() && info.isWritable()){ perms = tr("Read/Write"); }
else if(info.isReadable()){ perms = tr("Read Only"); }
else if(info.isWritable()){ perms = tr("Write Only"); }
else{ perms = tr("No Access"); }
ui->label_file_perms->setText(perms);
ui->label_file_created->setText( info.created().toString(Qt::SystemLocaleLongDate) );
ui->label_file_modified->setText( info.lastModified().toString(Qt::SystemLocaleLongDate) );
//use the standard LXDG object and load the desktop file
bool ok = false;
if(desktopFileName.endsWith(".desktop")){
DF = LXDG::loadDesktopFile(desktopFileName, ok);
}
if( ok ) {
if ((DF.type == XDGDesktop::LINK) && (desktopType!="link" )) {
//we open a desktop type "link" but it was not mentionned by parameters
Dialog::Initialise("-link");
}
ui->lName->setText(DF.name);
ui->lComment->setText(DF.comment);
ui->lCommand->setText(DF.exec);
//in case of "link" desktop, we populate the correct content in lWorkingDir
if (desktopType=="link") {
ui->lWorkingDir->setText(DF.url);
} else {
ui->lWorkingDir->setText(DF.path);
}
if (DF.startupNotify) ui->cbStartupNotification->setChecked(true); else ui->cbStartupNotification->setChecked(false);
if (DF.useTerminal) ui->cbRunInTerminal->setChecked(true); else ui->cbRunInTerminal->setChecked(false);
iconFileName="";
ui->pbIcon->setIcon(LXDG::findIcon(DF.icon,""));
if(!info.isWritable()){ ui->tab_deskedit->setEnabled(false); }
} else {
ui->tabWidget->removeTab(1);
return;
}
//we load the file in memory and will adapt it before saving it to disk
QFile file(desktopFileName);
inMemoryFile="";
if (file.open(QFile::ReadOnly)) {
QTextStream fileData(&file);
inMemoryFile = fileData.readAll();
file.close();
//perform some validation checks
//.........这里部分代码省略.........
开发者ID:beatgammit,项目名称:lumina,代码行数:101,代码来源:dialog.cpp
示例20: monitor
Event::Event( Monitor *p_monitor, struct timeval p_start_time, const std::string &p_cause, const StringSetMap &p_noteSetMap ) :
monitor( p_monitor ),
start_time( p_start_time ),
cause( p_cause ),
noteSetMap( p_noteSetMap )
{
if ( !initialised )
Initialise();
std::string notes;
createNotes( notes );
bool untimedEvent = false;
if ( !start_time.tv_sec )
{
untimedEvent = true;
gettimeofday( &start_time, 0 );
}
static char sql[ZM_SQL_MED_BUFSIZ];
struct tm *stime = localtime( &start_time.tv_sec );
snprintf( sql, sizeof(sql), "insert into Events ( MonitorId, Name, StartTime, Width, Height, Cause, Notes ) values ( %d, 'New Event', from_unixtime( %ld ), %d, %d, '%s', '%s' )", monitor->Id(), start_time.tv_sec, monitor->Width(), monitor->Height(), cause.c_str(), notes.c_str() );
if ( mysql_query( &dbconn, sql ) )
{
Error( "Can't insert event: %s", mysql_error( &dbconn ) );
exit( mysql_errno( &dbconn ) );
}
id = mysql_insert_id( &dbconn );
if ( untimedEvent )
{
Warning( "Event %d has zero time, setting to current", id );
}
end_time.tv_sec = 0;
frames = 0;
alarm_frames = 0;
tot_score = 0;
max_score = 0;
if ( config.use_deep_storage )
{
char *path_ptr = path;
path_ptr += snprintf( path_ptr, sizeof(path), "%s/%d", config.dir_events, monitor->Id() );
int dt_parts[6];
dt_parts[0] = stime->tm_year-100;
dt_parts[1] = stime->tm_mon+1;
dt_parts[2] = stime->tm_mday;
dt_parts[3] = stime->tm_hour;
dt_parts[4] = stime->tm_min;
dt_parts[5] = stime->tm_sec;
char date_path[PATH_MAX] = "";
char time_path[PATH_MAX] = "";
char *time_path_ptr = time_path;
for ( unsigned int i = 0; i < sizeof(dt_parts)/sizeof(*dt_parts); i++ )
{
path_ptr += snprintf( path_ptr, sizeof(path)-(path
|
请发表评论