/** Test NewL() */ void CT_BluetoothSynchronousLinkData::DoCmdNewL(const TDesC& aSection) { INFO_PRINTF1(_L("CBluetoothSynchronousLink NewL Call")); DestroyData(); TPtrC socketServName; if(GetStringFromConfig(aSection, KRSocketServ(), socketServName)) { RSocketServ* socketServ=static_cast<RSocketServ*>(GetDataObjectL(socketServName)); TRAPD(err, iData = CBluetoothSynchronousLink::NewL(*this, *socketServ)); if( err!=KErrNone ) { INFO_PRINTF2(_L("CBluetoothSynchronousLink Standard Constructor NewL err=%d" ),err); SetError(err); } } else { ERR_PRINTF2(KLogMissingParameter, &KRSocketServ()); SetBlockResult(EFail); } }
void CT_DataWindowGc::DoCmdnewL(const TDesC& aSection) { DestroyData(); // Get test data for command input parameter(s) CWsScreenDevice* device = NULL; if ( !CT_GraphicsUtil::GetWsScreenDeviceL(*this, aSection, KFldDevice, device) ) { ERR_PRINTF2(KLogMissingParameter, &KFldDevice); SetBlockResult(EFail); } else { INFO_PRINTF1(_L("execute new CWindowGc(CWsScreenDevice)")); TRAPD( err, iWindowGc = new (ELeave) CWindowGc(device) ); if ( err != KErrNone ) { ERR_PRINTF2(KLogError, err); SetError(err); } } }
/** * Process a command read from the ini file * * @param aDataWrapper test step requiring command to be processed * @param aCommand the command to process * @param aSection the entry in the ini file requiring the command to be processed * * @return ETrue if the command is processed */ TBool CT_DataPalette::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/) { TBool retVal = ETrue; if (aCommand == KCmdNewL) { DoCmdNew(aSection); } else if (aCommand == KCmdNewDefaultL) { DoCmdNewDefault(aSection); } else if (aCommand == KCleanup) { DestroyData(); } else { retVal=EFalse; } return retVal; }
/** Creates an instance of CT_DataLinkedTypefaceSpecification class */ void CT_DataLinkedTypefaceSpecification::DoCmdNewL(const TDesC& aSection) { // cleanup if any DestroyData(); // call new operator TPtrC name; if (!GetStringFromConfig(aSection, KFldTypefaceName, name)) { ERR_PRINTF2(KLogMissingParameter, &KFldTypefaceName); SetBlockResult(EFail); } else { INFO_PRINTF1(_L("execute CLinkedTypefaceSpecification::NewLC")); TRAPD(err, iSpec = CLinkedTypefaceSpecification::NewLC(name); CleanupStack::Pop(iSpec)); if (err != KErrNone) { ERR_PRINTF2(KLogError, err); SetError(err); } } }
void CT_DataSdpAgent::DoCmdNewL(const TDesC& aSection) { DestroyData(); TPtrC tBTDevAddrName; TBool foundParameter=EFalse; INFO_PRINTF1(_L("CSdpAgent NewL call")); if( GetStringFromConfig(aSection, KTBTDevAddr(), tBTDevAddrName)) { foundParameter=ETrue; CT_BTDevAddrData* tBTDevAddrData=static_cast<CT_BTDevAddrData*>(GetDataWrapperL(tBTDevAddrName)); const TBTDevAddr* btDevAddr = tBTDevAddrData->GetAddress(); TRAPD(err, iSdpAgent = CSdpAgent::NewL(*this, *btDevAddr)); if(err != KErrNone) { ERR_PRINTF2(_L("CSdpAgent NewL failed with error %d"), err); SetError(err); } } TInt intBtDevAddr=0; if( GetIntFromConfig(aSection, KIntDevAddr(), intBtDevAddr)) { foundParameter=ETrue; const TBTDevAddr btDevAddr(intBtDevAddr); TRAPD(err, iSdpAgent = CSdpAgent::NewL(*this, btDevAddr)); if(err != KErrNone) { ERR_PRINTF2(_L("CSdpAgent NewL failed with error %d"), err); SetError(err); } } if( !foundParameter ) { ERR_PRINTF2(_L("Missing parameter %S"), &KIntDevAddr()); SetBlockResult(EFail); } }
bool FBuildPatchAppManifest::Serialize(FArchive& Ar) { if (Ar.IsLoading()) { DestroyData(); } Data->Serialize(Ar); if (Ar.IsLoading()) { // If we didn't load the version number, we know it was skipped when saving therefore must be // the first UObject version if (Data->ManifestFileVersion == static_cast<uint8>(EBuildPatchAppManifestVersion::Invalid)) { Data->ManifestFileVersion = EBuildPatchAppManifestVersion::StoredAsCompressedUClass; } // Setup internal lookups InitLookups(); } return !Ar.IsError(); }
void CT_DataSdpAgent::SetObjectL(TAny* aAny) { DestroyData(); iSdpAgent = static_cast<CSdpAgent*> (aAny); }
// @TODO LSwift: Perhaps replace FromBlob and ToBlob usage with hexadecimal notation instead bool FBuildPatchAppManifest::DeserializeFromJSON( const FString& JSONInput ) { bool bSuccess = true; TSharedPtr<FJsonObject> JSONManifestObject; TSharedRef<TJsonReader<TCHAR>> Reader = TJsonReaderFactory<TCHAR>::Create(JSONInput); // Clear current data DestroyData(); // Attempt to deserialize JSON if (!FJsonSerializer::Deserialize(Reader, JSONManifestObject) || !JSONManifestObject.IsValid()) { return false; } // Store a list of all data GUID for later use TSet<FGuid> AllDataGuids; // Get the values map TMap<FString, TSharedPtr<FJsonValue>>& JsonValueMap = JSONManifestObject->Values; // Manifest version did not always exist int32 ManifestFileVersionInt = 0; TSharedPtr<FJsonValue> JsonManifestFileVersion = JsonValueMap.FindRef(TEXT("ManifestFileVersion")); if (JsonManifestFileVersion.IsValid() && FromStringBlob(JsonManifestFileVersion->AsString(), ManifestFileVersionInt)) { Data->ManifestFileVersion = static_cast<EBuildPatchAppManifestVersion::Type>(ManifestFileVersionInt); } else { // Then we presume version just before we started outputting the version Data->ManifestFileVersion = static_cast<EBuildPatchAppManifestVersion::Type>(EBuildPatchAppManifestVersion::StartStoringVersion - 1); } // Get the app and version strings TSharedPtr< FJsonValue > JsonAppID = JsonValueMap.FindRef( TEXT("AppID") ); TSharedPtr< FJsonValue > JsonAppNameString = JsonValueMap.FindRef( TEXT("AppNameString") ); TSharedPtr< FJsonValue > JsonBuildVersionString = JsonValueMap.FindRef( TEXT("BuildVersionString") ); TSharedPtr< FJsonValue > JsonLaunchExe = JsonValueMap.FindRef( TEXT("LaunchExeString") ); TSharedPtr< FJsonValue > JsonLaunchCommand = JsonValueMap.FindRef( TEXT("LaunchCommand") ); TSharedPtr< FJsonValue > JsonPrereqName = JsonValueMap.FindRef( TEXT("PrereqName") ); TSharedPtr< FJsonValue > JsonPrereqPath = JsonValueMap.FindRef( TEXT("PrereqPath") ); TSharedPtr< FJsonValue > JsonPrereqArgs = JsonValueMap.FindRef( TEXT("PrereqArgs") ); bSuccess = bSuccess && JsonAppID.IsValid(); if( bSuccess ) { bSuccess = bSuccess && FromStringBlob( JsonAppID->AsString(), Data->AppID ); } bSuccess = bSuccess && JsonAppNameString.IsValid(); if( bSuccess ) { Data->AppName = JsonAppNameString->AsString(); } bSuccess = bSuccess && JsonBuildVersionString.IsValid(); if( bSuccess ) { Data->BuildVersion = JsonBuildVersionString->AsString(); } bSuccess = bSuccess && JsonLaunchExe.IsValid(); if( bSuccess ) { Data->LaunchExe = JsonLaunchExe->AsString(); } bSuccess = bSuccess && JsonLaunchCommand.IsValid(); if( bSuccess ) { Data->LaunchCommand = JsonLaunchCommand->AsString(); } // Get the prerequisites installer info. These are optional entries. Data->PrereqName = JsonPrereqName.IsValid() ? JsonPrereqName->AsString() : FString(); Data->PrereqPath = JsonPrereqPath.IsValid() ? JsonPrereqPath->AsString() : FString(); Data->PrereqArgs = JsonPrereqArgs.IsValid() ? JsonPrereqArgs->AsString() : FString(); // Get the FileManifestList TSharedPtr<FJsonValue> JsonFileManifestList = JsonValueMap.FindRef(TEXT("FileManifestList")); bSuccess = bSuccess && JsonFileManifestList.IsValid(); if( bSuccess ) { TArray<TSharedPtr<FJsonValue>> JsonFileManifestArray = JsonFileManifestList->AsArray(); for (auto JsonFileManifestIt = JsonFileManifestArray.CreateConstIterator(); JsonFileManifestIt && bSuccess; ++JsonFileManifestIt) { TSharedPtr<FJsonObject> JsonFileManifest = (*JsonFileManifestIt)->AsObject(); const int32 FileIndex = Data->FileManifestList.Add(FFileManifestData()); FFileManifestData& FileManifest = Data->FileManifestList[FileIndex]; FileManifest.Filename = JsonFileManifest->GetStringField(TEXT("Filename")); bSuccess = bSuccess && FString::ToBlob(JsonFileManifest->GetStringField(TEXT("FileHash")), FileManifest.FileHash.Hash, FSHA1::DigestSize); TArray<TSharedPtr<FJsonValue>> JsonChunkPartArray = JsonFileManifest->GetArrayField(TEXT("FileChunkParts")); for (auto JsonChunkPartIt = JsonChunkPartArray.CreateConstIterator(); JsonChunkPartIt && bSuccess; ++JsonChunkPartIt) { const int32 ChunkIndex = FileManifest.FileChunkParts.Add(FChunkPartData()); FChunkPartData& FileChunkPart = FileManifest.FileChunkParts[ChunkIndex]; TSharedPtr<FJsonObject> JsonChunkPart = (*JsonChunkPartIt)->AsObject(); bSuccess = bSuccess && FGuid::Parse(JsonChunkPart->GetStringField(TEXT("Guid")), FileChunkPart.Guid); bSuccess = bSuccess && FromStringBlob(JsonChunkPart->GetStringField(TEXT("Offset")), FileChunkPart.Offset); bSuccess = bSuccess && FromStringBlob(JsonChunkPart->GetStringField(TEXT("Size")), FileChunkPart.Size); AllDataGuids.Add(FileChunkPart.Guid); } FileManifest.bIsUnixExecutable = JsonFileManifest->HasField(TEXT("bIsUnixExecutable")) && JsonFileManifest->GetBoolField(TEXT("bIsUnixExecutable")); FileManifest.bIsReadOnly = JsonFileManifest->HasField(TEXT("bIsReadOnly")) && JsonFileManifest->GetBoolField(TEXT("bIsReadOnly")); FileManifest.bIsCompressed = JsonFileManifest->HasField(TEXT("bIsCompressed")) && JsonFileManifest->GetBoolField(TEXT("bIsCompressed")); FileManifest.SymlinkTarget = JsonFileManifest->HasField(TEXT("SymlinkTarget")) ? JsonFileManifest->GetStringField(TEXT("SymlinkTarget")) : TEXT(""); FileManifest.Init(); } } Data->FileManifestList.Sort(); for (auto& FileManifest : Data->FileManifestList) { FileManifestLookup.Add(FileManifest.Filename, &FileManifest); } // For each chunk setup it's info for (const auto& DataGuid : AllDataGuids) { int32 ChunkIndex = Data->ChunkList.Add(FChunkInfoData()); Data->ChunkList[ChunkIndex].Guid = DataGuid; } // Setup chunk info lookup for (auto& ChunkInfo : Data->ChunkList) { ChunkInfoLookup.Add(ChunkInfo.Guid, &ChunkInfo); } // Get the ChunkHashList bool bHasChunkHashList = false; TSharedPtr<FJsonValue> JsonChunkHashList = JsonValueMap.FindRef(TEXT("ChunkHashList")); bSuccess = bSuccess && JsonChunkHashList.IsValid(); if (bSuccess) { TSharedPtr<FJsonObject> JsonChunkHashListObj = JsonChunkHashList->AsObject(); for (auto ChunkHashIt = JsonChunkHashListObj->Values.CreateConstIterator(); ChunkHashIt && bSuccess; ++ChunkHashIt) { FGuid ChunkGuid; uint64 ChunkHash = 0; bSuccess = bSuccess && FGuid::Parse(ChunkHashIt.Key(), ChunkGuid); bSuccess = bSuccess && FromStringBlob(ChunkHashIt.Value()->AsString(), ChunkHash); if (bSuccess && ChunkInfoLookup.Contains(ChunkGuid)) { FChunkInfoData* ChunkInfoData = ChunkInfoLookup[ChunkGuid]; ChunkInfoData->Hash = ChunkHash; bHasChunkHashList = true; } } } // Get the DataGroupList TSharedPtr<FJsonValue> JsonDataGroupList = JsonValueMap.FindRef(TEXT("DataGroupList")); if (JsonDataGroupList.IsValid()) { TSharedPtr<FJsonObject> JsonDataGroupListObj = JsonDataGroupList->AsObject(); for (auto DataGroupIt = JsonDataGroupListObj->Values.CreateConstIterator(); DataGroupIt && bSuccess; ++DataGroupIt) { FGuid DataGuid; uint8 DataGroup = INDEX_NONE; // If the list exists, we must be able to parse it ok otherwise error bSuccess = bSuccess && FGuid::Parse(DataGroupIt.Key(), DataGuid); bSuccess = bSuccess && FromStringBlob(DataGroupIt.Value()->AsString(), DataGroup); if (bSuccess && ChunkInfoLookup.Contains(DataGuid)) { FChunkInfoData* ChunkInfoData = ChunkInfoLookup[DataGuid]; ChunkInfoData->GroupNumber = DataGroup; } } } else if (bSuccess) { // If the list did not exist in the manifest then the grouping is the deprecated crc functionality, as long // as there are no previous parsing errors we can build the group list from the Guids. for (auto& ChunkInfo : Data->ChunkList) { ChunkInfo.GroupNumber = FCrc::MemCrc_DEPRECATED(&ChunkInfo.Guid, sizeof(FGuid)) % 100; } } // Get the ChunkFilesizeList bool bHasChunkFilesizeList = false; TSharedPtr< FJsonValue > JsonChunkFilesizeList = JsonValueMap.FindRef(TEXT("ChunkFilesizeList")); if (JsonChunkFilesizeList.IsValid()) { TSharedPtr< FJsonObject > JsonChunkFilesizeListObj = JsonChunkFilesizeList->AsObject(); for (auto ChunkFilesizeIt = JsonChunkFilesizeListObj->Values.CreateConstIterator(); ChunkFilesizeIt; ++ChunkFilesizeIt) { FGuid ChunkGuid; int64 ChunkSize = 0; if (FGuid::Parse(ChunkFilesizeIt.Key(), ChunkGuid)) { FromStringBlob(ChunkFilesizeIt.Value()->AsString(), ChunkSize); if (ChunkInfoLookup.Contains(ChunkGuid)) { FChunkInfoData* ChunkInfoData = ChunkInfoLookup[ChunkGuid]; ChunkInfoData->FileSize = ChunkSize; bHasChunkFilesizeList = true; } } } } if (bHasChunkFilesizeList == false) { // Missing chunk list, version before we saved them compressed.. Assume chunk size for (FChunkInfoData& ChunkInfo : Data->ChunkList) { ChunkInfo.FileSize = FBuildPatchData::ChunkDataSize; } } // Get the bIsFileData value. The variable will exist in versions of StoresIfChunkOrFileData or later, otherwise the previous method is to check // if ChunkHashList is empty. TSharedPtr<FJsonValue> JsonIsFileData = JsonValueMap.FindRef(TEXT("bIsFileData")); if (JsonIsFileData.IsValid() && JsonIsFileData->Type == EJson::Boolean) { Data->bIsFileData = JsonIsFileData->AsBool(); } else { Data->bIsFileData = !bHasChunkHashList; } // Get the custom fields. This is optional, and should not fail if it does not exist TSharedPtr< FJsonValue > JsonCustomFields = JsonValueMap.FindRef( TEXT( "CustomFields" ) ); if( JsonCustomFields.IsValid() ) { TSharedPtr< FJsonObject > JsonCustomFieldsObj = JsonCustomFields->AsObject(); for( auto CustomFieldIt = JsonCustomFieldsObj->Values.CreateConstIterator(); CustomFieldIt && bSuccess; ++CustomFieldIt ) { Data->CustomFields.Add(FCustomFieldData(CustomFieldIt.Key(), CustomFieldIt.Value()->AsString())); } } CustomFieldLookup.Empty(Data->CustomFields.Num()); for (auto& CustomField : Data->CustomFields) { CustomFieldLookup.Add(CustomField.Key, &CustomField); } // If this is file data, fill out the guid to filename lookup, and chunk file size if (Data->bIsFileData) { for (auto& FileManifest : Data->FileManifestList) { if (FileManifest.FileChunkParts.Num() == 1) { FGuid& Guid = FileManifest.FileChunkParts[0].Guid; FileNameLookup.Add(Guid, &FileManifest.Filename); if (ChunkInfoLookup.Contains(Guid)) { FChunkInfoData* ChunkInfoData = ChunkInfoLookup[Guid]; ChunkInfoData->FileSize = FileManifest.GetFileSize(); } } else { bSuccess = false; } } } // Calculate build size TotalBuildSize = 0; TotalDownloadSize = 0; if (bSuccess) { for (auto& FileManifest : Data->FileManifestList) { TotalBuildSize += FileManifest.GetFileSize(); } for (auto& Chunk : Data->ChunkList) { TotalDownloadSize += Chunk.FileSize; } } // Mark as should be re-saved, client that stores manifests should start using binary bNeedsResaving = true; // Make sure we don't have any half loaded data if( !bSuccess ) { DestroyData(); } return bSuccess; }
void CT_SEIDData::SetObjectL(TAny* aAny) { DestroyData(); iData = static_cast<TSEID*> (aAny); }
CT_SEIDData::~CT_SEIDData() { DestroyData(); }
CT_DataAnimDll::~CT_DataAnimDll() { DestroyData(); }
int main(int argc, char *argv[]){ char inputFile[256], outputFile[256], confFile[256]; int inputFlag = 0, outputFlag = 0, confFlag = 0; FILE* input=NULL; FILE* output=NULL; FILE* config=NULL; srand(time(NULL)); int confNums[5]; int r = 365; int choice; while (1) { static struct option long_options[] = { /* Use flags like so: {"verbose", no_argument, &verbose_flag, 'V'}*/ /* Argument styles: no_argument, required_argument, optional_argument */ {"version", no_argument, 0, 'v'}, {"help", no_argument, 0, 'h'}, {"inputFile", required_argument, 0, 'i'}, {"conf", required_argument, 0, 'c'}, {"output", required_argument, 0, 'o'}, {"rSize", required_argument, 0, 'r'}, {"default", no_argument, 0, 'd'}, {0,0,0,0} }; int option_index = 0; /* Argument parameters: no_argument: " " required_argument: ":" optional_argument: "::" */ choice = getopt_long( argc, argv, "vhi:c:o:r:d", long_options, &option_index); if (choice == -1) break; switch( choice ) { case 'v': printf("beta version\n"); break; case 'h': printf("ussage <executable> –d <inputFile file> –c <configuration file> -o <output file> -I <init fun> -A <assign fun> -U <update fun> --complete\n"); break; case 'd': strcpy(inputFile, "./inputFiles/bio_small_input.dat"); strcpy(outputFile, "./inputFiles/conform.dat"); strcpy(confFile,"./inputFiles/cluster_5.conf" ); inputFlag = 1; outputFlag = 1; confFlag = 1; break; case 'i': strcpy(inputFile, optarg); inputFlag = 1; break; case 'c': strcpy(confFile, optarg); confFlag = 1; break; case 'o': strcpy(outputFile, optarg); outputFlag = 1; break; case 'r': r = atoi(optarg);; break; case '?': /* getopt_long will have already printed an error */ break; default: /* Not sure how to get here... */ return EXIT_FAILURE; } } /* Deal with non-option arguments here */ if ( optind < argc ) { while ( optind < argc ) { } } if ( !inputFlag ) { printf("Give me an input file\n"); scanf("%s", inputFile); } if ( !confFlag ) { printf("Give me an conf file\n"); scanf("%s", confFile); } if ( !outputFlag ) { printf("Give me an output file\n"); scanf("%s", outputFile); } printf("inputFile %s, output %s, confingure %s,r = %d \n",inputFile, outputFile, confFile, r ); if((input=fopen(inputFile,"r")) == NULL){ perror(inputFile); exit(-1); } if((output=fopen(outputFile,"w")) == NULL){ perror(outputFile); exit(-1); } if((config=fopen(confFile,"r")) == NULL){ perror(confFile); exit(-1); } //ReadDataMolecule(NULL, input); SpecifyDatasetMolConf("molecule"); ParseConfig(config,confNums); parseData(input, r); void (*init)() = KMedoidPlusPlusInit; double (*assigment)() = PamAssign; int (*update)() = ClaransUpdate; int kCluster = 19; //int j = 0; int j = 0; init(kCluster); FirstAssignment(); assigment(confNums[1],confNums[2]); j = 0; while(update(assigment,confNums)){ fprintf(output,"Update loop #%d\n",j); printf("Update loop #%d\n",j); j++; } PrintClusters(output); double silhouette=Silhouette(output); fprintf(output, "%d\n%f\n",kCluster,silhouette ); PrintConform(output); data.destroyInput(); DestroyData(); printf("Silhouette: %f\n",silhouette); fclose(input); fclose(output); fclose(config); return 0; }
/** * Constructor. First phase construction */ CT_DataDrawTextExtendedParam::~CT_DataDrawTextExtendedParam() { DestroyData(); }
void CT_DataLinkedTypefaceSpecification::SetObjectL(TAny* aObject) { DestroyData(); iSpec = static_cast<CLinkedTypefaceSpecification*> (aObject); }
void CT_DataLinkedTypefaceSpecification::DoCmdDestructor() { // cleanup if any DestroyData(); }
CT_DataSdpAgent::~CT_DataSdpAgent() { DestroyData(); }
void CT_DataSdpAgent::DoCmdDestructor() { DestroyData(); }
MemoryLeakWarning::~MemoryLeakWarning() { DestroyData(); }
void CT_TCommConfigV02Data::DoCmdDestructor() { DestroyData(); }
void CBKInfEngine:: DefineProcedure( EProcedureTypes procedureType, int lag ) { ///////////////////////////////////////////////////////////////////////// // Selection procedure (smoothing, filtering, ... ///////////////////////////////////////////////////////////////////////// DestroyData(); switch( procedureType ) { case ptFiltering: { PNL_CHECK_FOR_NON_ZERO( lag ); m_Lag = 0; m_CRingJtreeInf.resize( 2 ); m_CRingJtreeInf[0]= CJtreeInfEngine::Copy(m_pPriorSliceJtreeInf); m_CRingJtreeInf[1]= CJtreeInfEngine::Copy(m_p1_5SliceJtreeInf) ; m_ProcedureType = ptFiltering; break; } case ptFixLagSmoothing: { PNL_CHECK_LEFT_BORDER( lag, 0 ); m_Lag = lag; m_CRingJtreeInf.resize( m_Lag+1 ); m_CRingJtreeInf[0] = CJtreeInfEngine::Copy(m_pPriorSliceJtreeInf); int t; for( t = 1; t < lag + 1; t++ ) { m_CRingJtreeInf[t] = CJtreeInfEngine::Copy(m_p1_5SliceJtreeInf); } m_CRingDistrOnSep.resize(lag); m_ProcedureType = procedureType; break; } case ptSmoothing: case ptViterbi: { PNL_CHECK_LEFT_BORDER( lag, 1 ); m_Lag = lag; m_CRingJtreeInf.resize(lag); m_CRingJtreeInf[0] = CJtreeInfEngine::Copy(m_pPriorSliceJtreeInf); int t; for( t = 1; t < lag; t++ ) { m_CRingJtreeInf[t] = CJtreeInfEngine::Copy(m_p1_5SliceJtreeInf); } m_CRingDistrOnSep.resize(lag-1); m_ProcedureType = procedureType; break; } default: { PNL_THROW( CInconsistentType, "incorrect type of inference procedure" ); } } int i; for( i = 0; i < m_CRingDistrOnSep.size(); i++ ) { m_CRingDistrOnSep[i].resize(GetNumOfClusters()); } // initialize iterator for the jtree inferences sequence m_JTreeInfIter = m_CRingJtreeInf.begin(); m_CDistrOnSepIter = m_CRingDistrOnSep.begin(); m_CurrentTime = 0; }
/** * Destructor. */ CT_DataLinkedTypefaceSpecification::~CT_DataLinkedTypefaceSpecification() { DestroyData(); }
int main(int argc, char **argv) #endif { char fname[256]; char defname[] = "game.dat"; Boolean b_play; int dir; int inch; int num_step; int num; unsigned char steplog[MaxSteps]; #ifdef ENABLE_DL char buf[10]; struct high_record high; while (1) { num = 0; clear(); ansimore2("game/worker/welcome", false, 0, 0); while (num <= 0 || num > MAXDATA) { buf[0]=0; getdata(5, 61, "", buf, 5, 1, NULL, true); if (buf[0] == 0) return 0; num = atoi(buf); } sprintf(fname, "game/worker/%s.%d", defname, num); clear(); #else { if (argc > 2) { sprintf(fname, "%s/%s.%s", argv[1], defname, argv[2]); num=atoi(argv[2]); } else if (2 == argc) { if (strlen(argv[1]) > 255) exit(1); sprintf(fname, "%s.%s", defname, argv[1]); num=atoi(argv[1]); } else { strcpy(fname, defname); num==-1; } #endif num_step=0; load_highrecord(num, &high, -1); if (TRUE == InitData(fname)) { if (TRUE == InitPad()) { b_play = TRUE; DrawPad(); update_endline1(&high,num_step); inch = 0; while (b_play) { if (inch) { showdiff(); cleardiff(); move(scr_lns-1, scr_cols - 1); refresh(); } if (wingame()) { int newrecord; char buf[100]; newrecord=0; if (num_step<high.shortest||high.shortest==0) newrecord=load_highrecord(num, &high, num_step); clear(); move(12,15); prints("祝贺你,你成功的完成了这一关"); move(13,15); if (newrecord==1) { sprintf(buf,"你也创造了本关使用步数的纪录(%d步)!好厉害~",num_step); } else if (newrecord!=0) { sprintf(buf,"你也创造了本关使用步数的纪录(%d步)!",num_step); prints(buf); move(14,15); sprintf(buf,"不过,让点创纪录机会给别人吧~你都有%d个记录了:P\n",newrecord); } else { sprintf(buf,"你用了%d步,纪录是%d步。",num_step,high.shortest); } prints(buf); move(23, 0); clrtoeol(); prints("\x1b[m \x1b[5;1;33m按任何键继续 ..\x1b[m"); igetkey(); break; } if (num_step>MaxSteps) { char askbuf[100]; clear(); sprintf(askbuf,"你已经用了%d步还没有成功,重来么?(Y/N)",num_step); getdata(12,0,askbuf,buf,2,1,NULL,true); if (toupper(buf[0])=='N') break; b_play = InitPad(); DrawPad(); num_step=0; } inch = igetkey(); if ((' ' == inch)||(inch == '\n')||(inch=='\r')) break; dir = NullDir; switch (inch) { case 'i': case 'I': case KEY_UP: dir = North; break; case 'j': case 'J': case KEY_LEFT: dir = West; break; case 'l': case 'L': case KEY_RIGHT: dir = East; break; case 'k': case 'K': case KEY_DOWN: dir = South; break; case 12: // Ctrl-L case 'R': // Ctrl-L clear(); DrawPad(); break; case '\t': b_play = InitPad(); DrawPad(); num_step=0; update_endline1(&high,num_step); break; case Ctrl('H'): case '\177': case KEY_DEL: if (num_step!=0) { num_step--; regretmove(steplog[num_step]); update_endline1(&high,num_step); } break; default: break; } if (NullDir != dir) { int ret; if ((ret=workermove(dir))!=0) { if (ret==2) steplog[num_step]=dir+8; else steplog[num_step]=dir; num_step++; update_endline1(&high,num_step); } } } } DestroyPad(); } DestroyData(); } return 0; }
void CT_DataDrawTextExtendedParam::DoCmd_destructor() { DestroyData(); CT_DataDrawTextParam::DoCmd_destructor(); }
CActiveSocketShutdown::~CActiveSocketShutdown() { DestroyData(); }
void CT_DataDrawTextExtendedParam::SetObjectL(TAny* aAny) { DestroyData(); iDrawTextExtendedParam=static_cast<CGraphicsContext::TDrawTextExtendedParam*>(aAny); }
void CActiveSocketShutdown::ExecuteL(RSocket::TShutdown aHow, const TInt aAsyncErrorIndex) { DestroyData(); iSocket.Shutdown(aHow, iStatus); Activate( aAsyncErrorIndex ); }
CActiveSocketConnect::~CActiveSocketConnect() { DestroyData(); }
TBool CT_SEIDData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/) { TBool ret = ETrue; if ( aCommand==KCmdnew ) { DoCmdnewL(aSection); } else if ( aCommand==KCmdSEID ) { DoCmdSEID(aSection); } else if ( aCommand==KCmdPacketValue ) { DoCmdPacketValue(aSection); } else if ( aCommand==KCmdIsValid ) { DoCmdIsValid(aSection); } else if ( aCommand==KCmdSet ) { DoCmdSet(aSection); } else if ( aCommand==KCmdCompare ) { DoCmdCompareL(aSection); } else if ( aCommand==KCmdNegativeCompare ) { DoCmdNegativeCompareL(aSection); } else if ( aCommand==KCmd_Spare ) { DoCmd_Spare(aSection); } else if ( aCommand==KCmdFromPacketL ) { DoCmdFromPacketL(aSection); } else if ( aCommand==KCmdReset ) { DoCmdReset(aSection); } else if ( aCommand==KCmdIsLocal ) { DoCmdIsLocal(aSection); } else if ( aCommand==KCmdValue ) { DoCmdValue(aSection); } else if ( aCommand==KCmdDestructor ) { DestroyData(); } else { ret=EFalse; } return ret; }
void CT_DataAnimDll::SetObjectL(TAny* aAny) { DestroyData(); iAnimDll = static_cast<RAnimDll*> (aAny); }
/** Test TSEID() */ void CT_SEIDData::DoCmdnewL(const TDesC& aSection) { INFO_PRINTF1(_L("TSEID Constructor Call")); DestroyData(); TBool isTwoParameters=EFalse; TBool isOneParameter=EFalse; TInt seid=0; TBool islocal=EFalse; TInt value=0; TInt dataOK = ETrue; if( GetIntFromConfig(aSection, KFldSeid(), seid) ) { if(GetBoolFromConfig(aSection, KFldIsLocal(), islocal) ) { INFO_PRINTF1(_L("Constructor got 2 parameters.)")); isTwoParameters = ETrue; } else { ERR_PRINTF2(KLogMissingParameter, &KFldIsLocal); dataOK = EFalse; SetBlockResult(EFail); } } else { if( GetIntFromConfig(aSection, KFldValue(), value) ) { INFO_PRINTF1(_L("Constructor got parameter as value")); isOneParameter = ETrue; } } if(dataOK) { TInt err = KErrNone; if(isTwoParameters) { INFO_PRINTF1(_L("Constructor called is TSEID(TUint, TBool)")); TRAP( err, iData = new (ELeave) TSEID(seid,islocal)); } else if(isOneParameter) { INFO_PRINTF1(_L("Constructor called is TSEID(TUint).")); TRAP( err, iData = new (ELeave) TSEID(value)); } else { INFO_PRINTF1(_L("Constructor called is TSEID().")); TRAP( err, iData = new (ELeave) TSEID()); } if ( err!=KErrNone ) { ERR_PRINTF2(KLogError, err); SetError(err); } } }