int main(int argc, char ** argv) { if(argc < 6) { Huffman::print_usage(); return 1; } bool is_decompression; if(std::string(argv[1]) == "-u") { is_decompression = true; } else if (std::string(argv[1]) == "-c") { is_decompression = false; } else { Huffman::print_usage(); return 1; } char * in; char * out; if((std::string(argv[2]) == "-o") && std::string(argv[4]) == "-f") { in = argv[5]; out = argv[3]; } else if ((std::string(argv[2]) == "-f") && (std::string(argv[4]) == "-o")) { in = argv[3]; out = argv[5]; } else { Huffman::print_usage(); return 1; } try { if(is_decompression) { Decompression archiver(in, out); archiver.decompression(); } else { Compression archiver(in, out); archiver.compression(); } } catch (ExceptionFileNotFound exception) { std::cout << exception.what(); return 1; } catch (ExceptionSameCharactersNotRead exception) { std::cout << exception.what(); return 1; } return 0; }
status_t BMenuField::Archive(BMessage* data, bool deep) const { BArchiver archiver(data); status_t ret = BView::Archive(data, deep); if (ret == B_OK && Label()) ret = data->AddString("_label", Label()); if (ret == B_OK && !IsEnabled()) ret = data->AddBool("_disable", true); if (ret == B_OK) ret = data->AddInt32("_align", Alignment()); if (ret == B_OK) ret = data->AddFloat("_divide", Divider()); if (ret == B_OK && fFixedSizeMB) ret = data->AddBool("be:fixeds", true); bool dmark = false; if (_BMCMenuBar_* menuBar = dynamic_cast<_BMCMenuBar_*>(fMenuBar)) dmark = menuBar->IsPopUpMarkerShown(); data->AddBool("be:dmark", dmark); return archiver.Finish(ret); }
status_t BViewLayoutItem::Archive(BMessage* into, bool deep) const { BArchiver archiver(into); status_t err = BLayoutItem::Archive(into, deep); return archiver.Finish(err); }
status_t BTextControl::TextViewLayoutItem::Archive(BMessage* into, bool deep) const { BArchiver archiver(into); status_t err = BAbstractLayoutItem::Archive(into, deep); if (err == B_OK) err = into->AddRect(kFrameField, fFrame); return archiver.Finish(err); }
status_t BAbstractSpinner::TextViewLayoutItem::Archive(BMessage* into, bool deep) const { BArchiver archiver(into); status_t result = BAbstractLayoutItem::Archive(into, deep); if (result == B_OK) result = into->AddRect(kFrameField, fFrame); return archiver.Finish(result); }
//tries to add a solution in the repository if it is non-dominated //param - the candidate solution to be inserted in the repository bool Repository::add(Solution &candidate){ bool isDominated=false; bool equal=false; int dom; bool enteredArchive=false; if(actualSize==0){ //if the repository is empty, insert the solution insert(candidate); enteredArchive=true; }else{ for(int s=0;s<repositorySize+1;s++){ if(controlSolutions[s]){//if this solution is valid if(!candidate.isEqual(getSolution(s))){ //if the solutions are not equal //verify the dominance relation between two vectors //return 1 if sol1 dominates sol2, -1 if sol2 dominates sol1, 0 if they do not dominate each other, 2 if they are equal if(!strcmp(archiverType, "pbi") || !strcmp(archiverType, "tch") || !strcmp(archiverType, "wcp") || !strcmp(archiverType, "wsum") || !strcmp(archiverType, "r-ideal"))//repositories based on decomposition, if decomposition do not check dominance dom=0; else dom=dominance(candidate.objectiveVector, getSolution(s).objectiveVector, objectiveNumber); if(dom == 1){//if the candidate dominates the solution in the repository exclude(s); }else{ if(dom == -1){//if a solution in the repository dominates the candidate isDominated=true; if(vectorZero(getSolution(s).objectiveVector, objectiveNumber)){ fprintf(stderr, "\nERROR! Trying to insert in the repository a solution whose objectives are all 0\n"); exit(1); } break; } } }else{ //if the solutions are equal, discard the candidate equal=true; break; } } } if(!isDominated && !equal){ //if the solution is non-dominated candidate.dominated=false; if(actualSize<repositorySize){//if the repository is not empty nor full insert(candidate);//insert the solution enteredArchive=true; }else{ //if the repository is full enteredArchive=archiver(candidate); } }else{ candidate.dominated=true; enteredArchive=false; } } return enteredArchive; }
status_t BViewLayoutItem::AllArchived(BMessage* into) const { BArchiver archiver(into); status_t err = BLayoutItem::AllArchived(into); if (err == B_OK) { if (archiver.IsArchived(fView)) err = archiver.AddArchivable(kViewField, fView); else err = B_NAME_NOT_FOUND; } return err; }
void CImportProjectWizard::clickOnValidate() { // Test mandatory fields if(!this->CheckMandatoryFields()) { return; } // Create all directories QString archivePath = ui->archivePathLineEdit->text(); QString projectPath = ui->pathLineEdit->text(); CArchiver archiver(this); archiver.ExtractArchive(archivePath, projectPath); //emit importProjectFile }
status_t BTextControl::AllArchived(BMessage* into) const { BArchiver archiver(into); status_t err = B_OK; if (archiver.IsArchived(fLayoutData->text_view_layout_item)) { err = archiver.AddArchivable(kTextViewItemField, fLayoutData->text_view_layout_item); } if (err == B_OK && archiver.IsArchived(fLayoutData->label_layout_item)) { err = archiver.AddArchivable(kLabelItemField, fLayoutData->label_layout_item); } return err; }
status_t BTextControl::Archive(BMessage *data, bool deep) const { BArchiver archiver(data); status_t ret = BControl::Archive(data, deep); alignment labelAlignment, textAlignment; GetAlignment(&labelAlignment, &textAlignment); if (ret == B_OK) ret = data->AddInt32("_a_label", labelAlignment); if (ret == B_OK) ret = data->AddInt32("_a_text", textAlignment); if (ret == B_OK) ret = data->AddFloat("_divide", Divider()); if (ModificationMessage() && (ret == B_OK)) ret = data->AddMessage("_mod_msg", ModificationMessage()); return archiver.Finish(ret); }
status_t BAbstractSpinner::AllArchived(BMessage* into) const { status_t result; if ((result = BControl::AllArchived(into)) != B_OK) return result; BArchiver archiver(into); BArchivable* textViewItem = fLayoutData->text_view_layout_item; if (archiver.IsArchived(textViewItem)) result = archiver.AddArchivable(kTextViewItemField, textViewItem); if (result != B_OK) return result; BArchivable* labelBarItem = fLayoutData->label_layout_item; if (archiver.IsArchived(labelBarItem)) result = archiver.AddArchivable(kLabelItemField, labelBarItem); return result; }
status_t BMenuField::AllArchived(BMessage* into) const { status_t err; if ((err = BView::AllArchived(into)) != B_OK) return err; BArchiver archiver(into); BArchivable* menuBarItem = fLayoutData->menu_bar_layout_item; if (archiver.IsArchived(menuBarItem)) err = archiver.AddArchivable(kMenuBarItemField, menuBarItem); if (err != B_OK) return err; BArchivable* labelBarItem = fLayoutData->label_layout_item; if (archiver.IsArchived(labelBarItem)) err = archiver.AddArchivable(kLabelItemField, labelBarItem); return err; }
void SaveArchivedObject(const ObjectType& obj, std::ostream& stream) { ArchiverType archiver(stream); archiver.Archive(obj); }
void C_Hom_Doc::ProcessArchive_600(CArchive& Arch) { // Instantiate the function object - it will // automatically detect whether to restore or save Archiver archiver(Arch); // Pass this variable in as the second parameter to archiver if // Converting from an enumerated variable type is necessary. int tempInt; /********* Begin Archiving *********/ // Posture Prediction archiver(Locking_Mode, tempInt); ((GLSkeleton*)GLViews[VIEW_TOP]->getGLInteractive())->setLocking(Locking_Mode); ((GLSkeleton*)GLViews[VIEW_SIDE]->getGLInteractive())->setLocking(Locking_Mode); ((GLSkeleton*)GLViews[VIEW_FRONT]->getGLInteractive())->setLocking(Locking_Mode); archiver(mDescription); this->SetUnits((E_Units)mDescription.Units()); archiver(mAutoTile); archiver(mStatusBar); archiver(Task_Mode, tempInt); // Window Data archiver(mFrontWindowData); archiver(mSideWindowData); archiver(mTopWindowData); archiver(mObliqueWindowData); archiver(mAnimationWindowData); archiver(mStatusResultsWindow); archiver(mMainWindowData); // Oblique view special things, this is annoying. Push these back into views CGLObliqueView* oblique = (CGLObliqueView*)GLViews[VIEW_OBLIQUE]; bool bgActive = oblique->getBackgroundActive(); archiver(bgActive); oblique->setBackgroundActive(bgActive); if(bgActive) { int bgMode = (int)(oblique->getBackgroundMode()); archiver(bgMode); oblique->setBackgroundMode((Picture_Mode)bgMode); COleVariant BGPicture; BGPicture.vt = VT_UNKNOWN; BGPicture.punkVal = oblique->getBackground(); archiver(BGPicture); if(BGPicture.punkVal != oblique->getBackground()) { oblique->setBackground((LPPICTURE)BGPicture.punkVal); } BGPicture.punkVal = 0; float alpha = oblique->getBackgroundAlpha(); archiver(alpha); oblique->setBackgroundAlpha(alpha); } E_Model_Type modelType = oblique->getModelType(); archiver(modelType, tempInt); oblique->setModelType(modelType); E_Hand_Type Hand_Type = task.Get_Left_Hand_Type(); archiver(Hand_Type, tempInt); task.Put_Hand_Type(Hand_Type, Hand_Type); int floorEnabled = oblique->getFloorEnabled(); archiver(floorEnabled); oblique->setFloorEnabled(floorEnabled); /*bool shoesEnabled = oblique->getShoesEnabled(); archiver(shoesEnabled); oblique->setShoesEnabled(shoesEnabled);*/ archiver(GLOblique::backgroundColor[0]); archiver(GLOblique::backgroundColor[1]); archiver(GLOblique::backgroundColor[2]); archiver(GLOblique::skinColor[0]); archiver(GLOblique::skinColor[1]); archiver(GLOblique::skinColor[2]); archiver(GLOblique::handHeldColor[0]); archiver(GLOblique::handHeldColor[1]); archiver(GLOblique::handHeldColor[2]); archiver(GLOblique::handHeldOutlineColor[0]); archiver(GLOblique::handHeldOutlineColor[1]); archiver(GLOblique::handHeldOutlineColor[2]); archiver(GLOblique::maleShirtColor[0]); archiver(GLOblique::maleShirtColor[1]); archiver(GLOblique::maleShirtColor[2]); archiver(GLOblique::malePantsColor[0]); archiver(GLOblique::malePantsColor[1]); archiver(GLOblique::malePantsColor[2]); archiver(GLOblique::femaleShirtColor[0]); archiver(GLOblique::femaleShirtColor[1]); archiver(GLOblique::femaleShirtColor[2]); archiver(GLOblique::femalePantsColor[0]); archiver(GLOblique::femalePantsColor[1]); archiver(GLOblique::femalePantsColor[2]); archiver(mUseNewLightScheme); archiver(mLightIntensity); archiver(Obl_Light_Type_FB); archiver(Obl_Light_Type_LR); archiver(Obl_Light_Type_TB); archiver(oblique->getCamera().focalLength); archiver(oblique->getCamera().distance); archiver(oblique->getCamera().altitude); archiver(oblique->getCamera().azimuth); archiver(oblique->getCamera().horizontalOffset); archiver(oblique->getCamera().verticalOffset); archiver(oblique->getHandHeld().outline); archiver(oblique->getHandHeld().type); archiver(oblique->getHandHeld().depth); archiver(oblique->getHandHeld().height); archiver(Bar_Type, tempInt); archiver(Bar_Width); archiver(Bar_Length); archiver(Bar_Thickness); archiver(Bar_Distance); archiver(Bar_Elevation); archiver(Bar_Azimuth); if(OpenType>699){ archiver(Bar_Pitch);} // Orthoview special things archiver(GLSkeleton::backgroundColor[0]); archiver(GLSkeleton::backgroundColor[1]); archiver(GLSkeleton::backgroundColor[2]); archiver(GLSkeleton::forceColor[0]); archiver(GLSkeleton::forceColor[1]); archiver(GLSkeleton::forceColor[2]); archiver(GLSkeleton::skeletonColor[0]); archiver(GLSkeleton::skeletonColor[1]); archiver(GLSkeleton::skeletonColor[2]); archiver(GLSkeleton::floorColor[0]); archiver(GLSkeleton::floorColor[1]); archiver(GLSkeleton::floorColor[2]); archiver(GLSkeleton::floorOutlineColor[0]); archiver(GLSkeleton::floorOutlineColor[1]); archiver(GLSkeleton::floorOutlineColor[2]); archiver(GLSkeleton::leftJointColor[0]); archiver(GLSkeleton::leftJointColor[1]); archiver(GLSkeleton::leftJointColor[2]); archiver(GLSkeleton::rightJointColor[0]); archiver(GLSkeleton::rightJointColor[1]); archiver(GLSkeleton::rightJointColor[2]); if(OpenType > 699){ archiver(GLSkeleton::GridColor[0]); archiver(GLSkeleton::GridColor[1]); archiver(GLSkeleton::GridColor[2]); } bool showForces = GLSkeleton::getShowForces(); archiver(showForces); GLSkeleton::setShowForces(showForces); if(OpenType > 699){ bool showGrid = GLSkeleton::getShowGrid(); archiver(showGrid); GLSkeleton::setShowGrid(showGrid); double GridSize = GLSkeleton::getGridSize(); archiver(GridSize); GLSkeleton::setGridSize(GridSize); } // Report colors archiver(Report_BG_Red); archiver(Report_BG_Green); archiver(Report_BG_Blue); // This is bad // These are statics so they should be the same for the male and the female hominoids Anthropometry anthro = getAnthropometryRef(); float* stature = anthro.GetHeightPercentiles(); float* weight = anthro.GetWeightPercentiles(); const Factors& mMaleFactors = task.getFactors(); stature[0] = mMaleFactors.mMH95; stature[1] = mMaleFactors.mMH50; stature[2] = mMaleFactors.mMH5; stature[3] = mMaleFactors.mFH95; stature[4] = mMaleFactors.mFH50; stature[5] = mMaleFactors.mFH5; weight[0] = mMaleFactors.mMW95; weight[1] = mMaleFactors.mMW50; weight[2] = mMaleFactors.mMW5; weight[3] = mMaleFactors.mFW95; weight[4] = mMaleFactors.mFW50; weight[5] = mMaleFactors.mFW5; setAnthropometry(anthro); archiver(mReportWDMap[ID_REPORTS_ANALYSIS_SUMMARY]); archiver(mReportWDMap[ID_REPORTS_ANTHROPOMETRY]); archiver(mReportWDMap[ID_REPORTS_BALANCE_STANDING]); archiver(mReportWDMap[ID_REPORTS_BALANCE_SEATED]); archiver(mReportWDMap[ID_REPORTS_FATIGUE]); archiver(mReportWDMap[ID_REPORTS_POSTURE]); archiver(mReportWDMap[ID_REPORTS_JOINT_LOCATIONS]); archiver(mReportWDMap[ID_REPORTS_JOINT_MOMENTS]); archiver(mReportWDMap[ID_REPORTS_JOINT_FORCES]); archiver(mReportWDMap[ID_REPORTS_3D_LOWBACK]); archiver(mReportWDMap[ID_REPORTS_SAGITTAL]); archiver(mReportWDMap[ID_REPORTS_SPINAL]); archiver(mReportWDMap[ID_REPORTS_STRENGTH]); archiver(mReportWDMap[ID_REPORTS_STRENGTH_DIR_VECTORS]); archiver(mReportWDMap[ID_REPORTS_TASK_SUMMARY]); #if defined(SHOULDERDLL) archiver(mReportWDMap[ID_REPORTS_SHOULDERANALYSIS]); #endif archiver(task); // The new static mode is the same as the old dynamic mode, so set static for both TM_ThreeDStatic and TM_ThreeDDynamic switch(Task_Mode) { case TM_ThreeDStatic: OnTaskinput3dstatic(); break; case TM_ThreeDDynamic: OnTaskinput3dstatic(); break; } archiver(limitChoice, tempInt); archiver(lowerPercentileLimit); archiver(upperPercentileLimit); archiver(femaleLowerPercentileLimit); archiver(femaleUpperPercentileLimit); archiver(offsetChoice, tempInt); archiver(offsetCoordinate[0]); archiver(offsetCoordinate[1]); archiver(offsetCoordinate[2]); archiver(jointToBeUsedAsOffset, tempInt); archiver(addOffset); ((StatusBox*)mStatusResultsWindow.mFramePtr->GetActiveView())->UpdatePercentileLimits(); // added 6.0.5 if(OpenType >= 605) { archiver(fixedHandAngles); } if(OpenType >699){ archiver(fixedHeadAngles);} if(OpenType >=605){ archiver(maintainHandAngles);} if(OpenType >699){ archiver(maintainHeadAngles); } }
int main(int argc, const char* argv[]) { Arguments arguments; // // Parse the arguments // for (int i = 1; i < argc; ++i) { if (strcmp(argv[i], "-o") == 0) { i++; if (i == argc) { logError("The output folder is missing."); printUsage(); return EXIT_FAILURE; } arguments.outputFile = std::string(argv[i]); } else if (strncmp(argv[i], "-v", 2) == 0) { printVersion(); return EXIT_SUCCESS; } else if (strncmp(argv[i], "-h", 2) == 0) { printUsage(); return EXIT_SUCCESS; } else { arguments.inputPath = std::string(argv[i]); if (i != argc - 1) { logError("Archiver.exe can't archive more than one path!"); return EXIT_FAILURE; } } } if (arguments.inputPath == "" || arguments.outputFile == "") { logError("Invalid arguments!", arguments.inputPath.c_str()); printUsage(); return EXIT_FAILURE; } // // Check if the input path exists // DWORD dwAttrib = GetFileAttributesA(arguments.inputPath.c_str()); bool exists = ((dwAttrib != INVALID_FILE_ATTRIBUTES) && (dwAttrib & FILE_ATTRIBUTE_DIRECTORY)); if (!exists) { logError("The %s doesn't exists or is not a directory."); return EXIT_FAILURE; } // // Archive the folder // Archiver archiver(arguments); if (!archiver.archive()) { return EXIT_FAILURE; } // If debugger is present, a pause is required to keep the console output // visible. Otherwise the pause is automatic. if (IsDebuggerPresent()) { system("pause"); } return EXIT_SUCCESS; }