本文整理汇总了C++中Catalog类的典型用法代码示例。如果您正苦于以下问题:C++ Catalog类的具体用法?C++ Catalog怎么用?C++ Catalog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Catalog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[])
{
title("Testing Display package", '=');
std::cout << "\n";
Catalog cat; // defaults to path = ".";
if (argc >= 2)
{
cat.changePath(argv[1]);
}
Display display(argc, argv, cat);
display.showCommandLine(false);
if (display.parseCommandLine())
std::cout << "\n commandline parse succeeded";
if (display.optionEnabled(display.s))
std::cout << "\n s option enabled";
if (display.optionEnabled(display.a))
std::cout << "\n a option enabled";
if (display.optionEnabled(display.d))
std::cout << "\n d option enabled";
if (display.optionEnabled(display.f))
std::cout << "\n f option enabled with search text \"" << display.searchText() << "\"";
if (display.optionEnabled(display.q))
std::cout << "\n q option enabled";
if (display.optionEnabled(display.c))
std::cout << "\n c option enabled";
if (display.optionEnabled(display.h))
std::cout << "\n h option enabled";
std::cout << "\n";
cat.buildCatalog(display.optionEnabled(display.s));
title("Showing results based on commandline arguments");
display.showResults();
std::cout << "\n\n";
return 0;
}
示例2: GetEditor
void SaveCompCmd::Execute () {
Editor* ed = GetEditor();
ModifStatusVar* modifVar = (ModifStatusVar*)ed->GetState("ModifStatusVar");
CompNameVar* compNameVar = (CompNameVar*) ed->GetState("CompNameVar");
const char* name = (compNameVar == nil) ? nil : compNameVar->GetName();
if (name == nil) {
SaveCompAsCmd saveCompAs(ed);
saveCompAs.Execute();
} else if (modifVar == nil || modifVar->GetModifStatus()) {
Catalog* catalog = unidraw->GetCatalog();
Component* comp;
if (catalog->Retrieve(name, comp) && catalog->Save(comp, name)) {
if (modifVar != nil) modifVar->SetModifStatus(false);
unidraw->ClearHistory(comp);
} else {
char title[CHARBUFSIZE];
const char* reason = !Writable(comp) ? "(File not writable.)" : "";
sprintf(title, "Couldn't save! %s", reason);
char subtitle[CHARBUFSIZE];
const char* domain = unidraw->GetCatalog()->GetAttribute("domain");
domain = (domain == nil) ? "component" : domain;
sprintf(subtitle, "Save this %s as:", domain);
Style* s = new Style(Session::instance()->style());
s->attribute("caption", title);
s->attribute("subcaption", subtitle);
s->attribute("open", "Save");
/* BUG: style s is never used!!!! */
SaveCompAsCmd saveCompAs(ed);
saveCompAs.Execute();
}
}
}
示例3: init_poc_environment
static void init_poc_environment() {
Environment::getInstance(true);
sleep(1);
ResourceManagerMaster* rmms =
Environment::getInstance()->getResourceManagerMaster();
Catalog* catalog = Environment::getInstance()->getCatalog();
TableDescriptor* table_1 = new TableDescriptor(
"cj",
Environment::getInstance()->getCatalog()->allocate_unique_table_id());
table_1->addAttribute("row_id", data_type(t_u_long)); // 0
table_1->addAttribute("trade_date", data_type(t_int));
table_1->addAttribute("order_no", data_type(t_u_long));
table_1->addAttribute("sec_code", data_type(t_int));
table_1->addAttribute("trade_dir", data_type(t_int));
table_1->addAttribute("order_type", data_type(t_int)); // 5
vector<ColumnOffset> cj_proj0_index;
cj_proj0_index.push_back(0);
cj_proj0_index.push_back(1);
cj_proj0_index.push_back(2);
cj_proj0_index.push_back(3);
cj_proj0_index.push_back(4);
cj_proj0_index.push_back(5);
const int partition_key_index_1 = 2;
table_1->createHashPartitionedProjection(cj_proj0_index, "order_no",
1); // G0
catalog->add_table(table_1);
for (unsigned i = 0;
i < table_1->getProjectoin(0)->getPartitioner()->getNumberOfPartitions();
i++) {
catalog->getTable(0)->getProjectoin(0)->getPartitioner()->RegisterPartition(
i, 2);
}
}
示例4: InitViewer
void FrameKit::InitViewer () {
Catalog* catalog = unidraw->GetCatalog();
const char* page_w = catalog->GetAttribute(page_width_attrib);
const char* page_h = catalog->GetAttribute(page_height_attrib);
const char* page_cols = catalog->GetAttribute(page_cols_attrib);
const char* page_rows = catalog->GetAttribute(page_rows_attrib);
const char* x_incr = catalog->GetAttribute(grid_x_incr);
const char* y_incr = catalog->GetAttribute(grid_y_incr);
GraphicView* view = (GraphicView*)((FrameEditor*)_ed)->_comp->Create(COMPONENT_VIEW);
((FrameEditor*)_ed)->_comp->Attach(view);
view->Update();
Style* style = Session::instance()->style();
boolean bookgeom = style->value_is_on("bookgeom");
float w = bookgeom ? 700 : Math::round(atof(page_w) * ivinches);
float h = bookgeom ? 906 : Math::round(atof(page_h) * ivinches);
if (page_cols && page_rows) {
int ncols = atoi(page_cols);
int nrows = atoi(page_rows);
if (ncols>0 && nrows>0) {
w = ncols;
h = nrows;
}
}
OverlayPage* page = new OverlayPage(w, h);
Grid* grid = new Grid(w, h, atof(x_incr), atof(y_incr));
grid->Visibility(false);
if (!bookgeom)
((FrameEditor*)_ed)->_viewer = new FrameViewer(_ed, view, page, grid);
else
((FrameEditor*)_ed)->_viewer = new FrameViewer(_ed, view, page, grid, (int) h+1, (int) w+1, Rotated);
}
示例5: exc
void
IsotropicSphereModel::doGenerate(Catalog& catalog)
{
if (catalog.getType() != _catType)
{
std::stringstream ss;
ss << "Generate failed. Model '" << ModelMapper::instance()->getKey(getType())
<< "'. Provided catalog type doesn't match requested one.";
Exception exc(type::EXCEPTION_WARNING + type::EXCEPTION_MOD_NO_PREFIX,
ss.str(), PRETTY_FUNCTION);
throw exc;
}
for (std::size_t i = 0; i < getNumberOfEntries(); ++i)
{
CatalogEntryGrbcat* entry = createEntry();
entry->getCoordFlag() = 0.0;
entry->getCoodinates().getX0() = _time(getGenerator());
entry->getCoodinates().getX1() = 1.0;
entry->getCoodinates().getX2() = _phi(getGenerator());
entry->getCoodinates().getX3() = _theta(getGenerator());
catalog.getEntries().push_back(entry);
}
}
示例6: Write
void EditorComp::Write (ostream& out) {
Catalog* catalog = unidraw->GetCatalog();
catalog->WriteStateVar(_viewerVar, out);
catalog->WriteStateVar(_keymap, out);
catalog->WriteStateVar(_selection, out);
catalog->WriteComponent(_igrcomps, out);
catalog->WriteStateVar(_curCtrlVar, out);
MonoSceneClass::Write(out);
}
示例7: Read
void EditorComp::Read (istream& in) {
Catalog* catalog = unidraw->GetCatalog();
float version = catalog->FileVersion();
delete _curCtrlVar;
delete _keymap;
delete _selection;
delete _viewerVar;
_viewerVar = (MemberNameVar*) catalog->ReadStateVar(in);
_keymap = (MemberNameVar*) catalog->ReadStateVar(in);
_selection = (MemberNameVar*) catalog->ReadStateVar(in);
if (version > 1.05) {
delete _igrcomps;
_igrcomps = (IGraphicComps*) catalog->ReadComponent(in);
} else {
MemberNameVar* gmember = (MemberNameVar*) catalog->ReadStateVar(in);
if (gmember != nil) {
*_igrcomps->GetMemberNameVar() = *gmember;
}
delete gmember;
}
_curCtrlVar = (ButtonStateVar*) catalog->ReadStateVar(in);
if (version < 1.05) {
MemberSharedName* keynamer = _keymap->GetMemberSharedName();
SubclassNameVar* kvar = keynamer->GetSubclass();
kvar->SetBaseClass("KeyMap");
kvar->SetName("KeyMap");
MemberSharedName* snamer = _selection->GetMemberSharedName();
SubclassNameVar* selvar = snamer->GetSubclass();
selvar->SetBaseClass("Selection");
selvar->SetName("Selection");
_curCtrlVar->HideSetting();
ButtonSharedName* bsnamer = _curCtrlVar->GetButtonSharedName();
SubclassNameVar* svar = bsnamer->GetSubclass();
svar->SetBaseClass("ControlState");
svar->SetName("ControlState");
}
MonoSceneClass::Read(in);
}
示例8: editExistingQuarter
void Schedule::editExistingQuarter(int pos, const Catalog &catalog)
{
int choice;
string courseName;
short courseQuarters;
do
{
cout << endl;
quarters[pos].show();
cout << "\n\nEdit Quarter Menu\n";
cout << "0. Done\n";
cout << "1. Add course.\n";
cout << "2. Remove course.\n";
cout << "\nYour choice: ";
cin >> choice;
cin.ignore(100, '\n');
if(choice == 1 || choice == 2)
{
cout << "Course name: ";
getline(cin, courseName);
}
switch(choice)
{
case 0: break;
case 1:
courseQuarters = catalog.getQuarters(courseName);
cout << courseName << endl;
if(!quarters[pos].checkQuarter(courseQuarters))
{
cout << courseName << "is not offered that quarter.\n";
break;
} // if not offered that this quarter.
if(!findCourse(courseName))
quarters[pos] += courseName;
break;
case 2: quarters[pos] -= courseName; break;
default: cout << "Choice must be between 0 and 2.\n";
} // switch
} while(choice != 0);
} // editExistingQuarter()
示例9: listObjects
void DataManipulationForm::listObjects(QComboBox *combo, vector<ObjectType> obj_types, const QString &schema)
{
Catalog catalog;
Connection conn=Connection(tmpl_conn_params);
try
{
attribs_map objects;
QStringList items;
int idx=0, count=0;
catalog.setConnection(conn);
catalog.setFilter(Catalog::LIST_ALL_OBJS);
combo->blockSignals(true);
combo->clear();
for(auto &obj_type : obj_types)
{
objects=catalog.getObjectsNames(obj_type, schema);
for(auto &attr : objects)
items.push_back(attr.second);
items.sort();
combo->addItems(items);
count+=items.size();
items.clear();
for(; idx < count; idx++)
{
combo->setItemIcon(idx, QPixmap(QString(":/icones/icones/") + BaseObject::getSchemaName(obj_type) + QString(".png")));
combo->setItemData(idx, obj_type);
}
idx=count;
}
if(combo->count()==0)
combo->insertItem(0, trUtf8("No objects found"));
else
combo->insertItem(0, trUtf8("Found %1 object(s)").arg(combo->count()));
combo->setCurrentIndex(0);
combo->blockSignals(false);
catalog.closeConnection();
}
catch(Exception &e)
{
catalog.closeConnection();
throw Exception(e.getErrorMessage(), e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e);
}
}
示例10: readCatalog
// reads the input file and creates the catalog; throws a runtime_error if the file cannot be opened
void readCatalog(Catalog & catalog, const string & fileName) throw(runtime_error){
ifstream infile;
infile.open(fileName);
if (!infile.is_open()){
throw runtime_error("File could not be opened");
}
string line = "";
while (getline(infile, line)){
vector<string> tokens;
stringstream ss(line);
string tmp = "";
while (getline(ss, tmp, ':')){
tokens.push_back(tmp);
}
ItemInfo item(tokens[1], stod(tokens[2], NULL), stod(tokens[3], NULL));
catalog.insert(make_pair(tokens[0], item));
}
}
示例11: Read
void BitmapGraphic::Read (istream& in) {
Catalog* catalog = unidraw->GetCatalog();
char* fg_name;
FillBg(catalog->ReadBgFilled(in));
SetBrush(catalog->ReadBrush(in));
PSColor* fg = catalog->ReadColor(in);
PSColor* bg = catalog->ReadColor(in);
SetColors(fg, bg);
SetFont(catalog->ReadFont(in));
SetPattern(catalog->ReadPattern(in));
Transformer* t = catalog->ReadTransformer(in);
SetTransformer(t);
Unref(t);
fg_name = catalog->ReadString(in);
Init(fg_name);
delete fg_name;
}
示例12: TRACE
void
CorrelationTimeArcGrbcat::filterEntries(Catalog& catalog,
std::vector<CatalogEntry*>& entries)
{
if (!checkCatalog(catalog))
{
// TODO Exception
return;
}
for (CatalogEntry* entry : catalog.getEntries())
{
CatalogEntryGrbcat* entryGrbcat = static_cast<CatalogEntryGrbcat*>(entry);
if (entryGrbcat->getCoordFlag() != -1 &&
entryGrbcat->getCoodinates().getCoorType() == type::EQUATORIAL_J2000 &&
entryGrbcat->getCoodinates().getDateType() == type::MODIFIED_JULIAN_DATE &&
entryGrbcat->getCoodinates().getTimeMJD() != 0.0)
{
entries.push_back(entryGrbcat);
}
}
TRACE("filterEntries size = " << entries.size());
}
示例13: jetPlusIsoTrack
//--------------------------------------------------------------------------------------------------
void jetPlusIsoTrack(const char *fileset = "",
const char *dataset = "s8-wm-id9",
const char *book = "mit/filler/006",
const char *catalogDir = "/home/mitprod/catalog",
Int_t nEvents = -1)
{
TString skimName("jetPlusIsoTrack");
using namespace mithep;
gDebugMask = Debug::kAnalysis;
gDebugLevel = 1;
//------------------------------------------------------------------------------------------------
// organize selection
//------------------------------------------------------------------------------------------------
const char *jetInput = Names::gkSC5JetBrn;
const char *gsfTracks = "GsfTracks";
const Double_t jetPtMin = 30;
const Double_t trackPtMin = 10;
JetIDMod *jetId = new JetIDMod;
jetId->SetInputName (jetInput);
jetId->SetUseCorrection(kFALSE);
jetId->SetPtCut (jetPtMin);
JetPlusIsoTrackSelMod *selMod = new JetPlusIsoTrackSelMod;
selMod->SetTrackPtMin(trackPtMin);
selMod->SetJetColName(jetId->GetOutputName());
selMod->SetTrackerTrackColName(Names::gkTrackBrn);
selMod->SetGsfTrackColName(gsfTracks);
//------------------------------------------------------------------------------------------------
// link modules together
//------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------
// organize output
//------------------------------------------------------------------------------------------------
OutputMod *outMod = new OutputMod;
outMod->Keep("*");
selMod->Add(outMod);
TString rootFile = skimName;
if (TString(fileset) != TString(""))
rootFile += TString("_") + TString(fileset);
printf("\nRoot output: %s\n\n",rootFile.Data());
outMod->SetFileName(rootFile);
outMod->SetPathName(".");
//------------------------------------------------------------------------------------------------
// set up analysis
//------------------------------------------------------------------------------------------------
Analysis *ana = new Analysis;
ana->AddSuperModule(jetId);
ana->AddSuperModule(selMod);
if (nEvents>0)
ana->SetProcessNEvents(nEvents);
//------------------------------------------------------------------------------------------------
// organize input
//------------------------------------------------------------------------------------------------
printf("\nRely on Catalog: %s\n",catalogDir);
printf(" -> Book: %s Dataset: %s Fileset: %s <-\n\n",book,dataset,fileset);
Catalog *c = new Catalog(catalogDir);
Dataset *d = c->FindDataset(book,dataset,fileset);
ana->AddDataset(d);
//------------------------------------------------------------------------------------------------
// run the analysis after successful initialisation
//------------------------------------------------------------------------------------------------
ana->Run(kFALSE);
}
示例14: strcmp
void FrameKit::InitLayout(OverlayKit* kit, const char* name) {
FrameEditor* ed = (FrameEditor*) kit->GetEditor();
Catalog* catalog = unidraw->GetCatalog();
const char* stripped_string = catalog->GetAttribute("stripped");
boolean stripped_flag = stripped_string ? strcmp(stripped_string, "true")==0 : false;
if (ed->GetWindow() == nil) {
TextObserver* mousedoc_observer = new TextObserver(ed->MouseDocObservable(), "");
WidgetKit& wk = *WidgetKit::instance();
const LayoutKit& layout = *LayoutKit::instance();
PolyGlyph* topbox = layout.vbox();
Glyph* menus = kit->MakeMenus();
Glyph* states = kit->MakeStates();
Glyph* toolbar = kit->MakeToolbar();
if (stripped_flag) {
Target* viewer =
new Target(new Frame(ed->Interior()), TargetPrimitiveHit);
ed->body(viewer);
topbox->append(ed);
} else {
if (states)
menus->append(states);
Target* viewer =
new Target(new Frame(kit->Interior()), TargetPrimitiveHit);
Catalog* catalog = unidraw->GetCatalog();
if (const char* toolbarloca = catalog->GetAttribute("toolbarloc")) {
if (strcmp(toolbarloca, "r") == 0)
toolbar->prepend(layout.vcenter(viewer));
else /* if (strcmp(toolbarloca, "l") == 0) */
toolbar->append(layout.vcenter(viewer));
} else
toolbar->append(layout.vcenter(viewer));
menus->append(toolbar);
Style* style = Session::instance()->style();
boolean bookgeom = style->value_is_on("bookgeom");
ed->body(menus);
ed->GetKeyMap()->Execute(CODE_SELECT);
topbox->append(ed);
if (!bookgeom) {
boolean set_flag = kit->set_button_flag();
boolean clr_flag = kit->clr_button_flag();
EivTextEditor* texteditor = nil;
if(!set_flag && !clr_flag) {
texteditor = new ComTextEditor(wk.style(), ed->comterp());
}
else
texteditor = new EivTextEditor(wk.style());
((FrameEditor*)ed)->_texteditor = texteditor;
Button* set = set_flag ?
wk.push_button("Set", new ActionCallback(FrameEditor)
((FrameEditor*)ed, &FrameEditor::SetText)) :
nil;
Button* clear = clr_flag ?
wk.push_button("Clear", new ActionCallback(FrameEditor)
((FrameEditor*)ed, &FrameEditor::ClearText)) :
nil;
Glyph* buttonbox = nil;
if (set && !clear) {
buttonbox =
layout.vbox(layout.hcenter(set));
} else if (!set && clear) {
buttonbox =
layout.vbox(layout.hcenter(clear));
} else if (set && clear) {
buttonbox =
layout.vbox(
layout.hcenter(set),
layout.vspace(10),
layout.hcenter(clear)
);
}
if (buttonbox) {
topbox->append(
wk.outset_frame(
layout.hbox(
layout.vcenter(
layout.margin(
buttonbox,
10
)
),
layout.vcenter(texteditor)
)
)
);
} else {
topbox->append(
wk.outset_frame(
layout.hbox(
layout.vcenter(
layout.margin(
layout.vbox(
#if 0
wk.label("type help"),
//.........这里部分代码省略.........
示例15: runSCNtupler
void runSCNtupler(const char *fileset,
const char *skim,
const char *dataset,
const char *book,
const char *catalogDir,
const char *outputName,
int nevents)
{
gDebugMask = Debug::kAnalysis; // debug message category
gDebugLevel = 1; // higher level allows more messages to print
// Set some useful flags
Bool_t isData = kTRUE; // is Data? kTRUE or kFALSE
Bool_t skipHLTFail = 1; // skip events that fail the HLT? 0 or 1 (generally 1 for data, 0 for MC)
Int_t useGen = 0; // use generator info? (see above)
Int_t fsrmode = 0; // fsr mode? related to what generator was used for MC (generally 0)
cout << "isData: " << isData << " useGen: " << useGen << " fsrmode: " << fsrmode << " skipHLTFail: " << skipHLTFail << endl;
// muon kinematics
const Double_t muPtMin = 20;
const Double_t muPtMax = 7000;
const Double_t muEtaMin = -3;
const Double_t muEtaMax = 3;
// electron kinematics
const Double_t eleEtMin = 20;
const Double_t eleEtMax = 7000;
const Double_t eleEtaMin = -3;
const Double_t eleEtaMax = 3;
// jet requirements
const Double_t jetPtMin = 20;
// SC requirements
const Double_t scEtMin = 20;
// good PV requirements
const UInt_t minNTracksFit = 0;
const Double_t minNdof = 4;
const Double_t maxAbsZ = 24;
const Double_t maxRho = 2;
//
// setup analysis object
//
Bool_t caching = kFALSE; // set this to true if you want to use file caching on t3
Analysis *ana = new Analysis;
ana->SetUseHLT(kTRUE);
if(nevents>0)
ana->SetProcessNEvents(nevents);
printf("\nRely on Catalog: %s\n",catalogDir);
printf(" -> Book: %s Dataset: %s Fileset: %s <-\n\n",book,dataset,fileset);
Catalog *c = new Catalog(catalogDir);
TString skimdataset = TString(dataset)+TString("/")+TString(skim);
Dataset *d = NULL;
TString bookstr = book;
if (TString(skim).CompareTo("noskim") == 0)
d = c->FindDataset(bookstr,dataset,fileset,caching);
else
d = c->FindDataset(bookstr,skimdataset.Data(),fileset,caching);
ana->AddDataset(d);
//
// setup ntupler module
//
SCNtuplerMod *mymod = new SCNtuplerMod;
mymod->SetOutputName(outputName); // output ntuple file name
mymod->SetIsData(isData); // toggle data specific or MC specific procedures
mymod->SetUseGen(useGen); // use generator info
mymod->SetSkipIfHLTFail(skipHLTFail); // skip to next event if no HLT accept
mymod->SetFSRMode(fsrmode);
mymod->SetMuPtMin(muPtMin);
mymod->SetMuPtMax(muPtMax);
mymod->SetMuEtaMin(muEtaMin);
mymod->SetMuEtaMax(muEtaMax);
mymod->SetEleEtMin(eleEtMin);
mymod->SetEleEtMax(eleEtMax);
mymod->SetEleEtaMin(eleEtaMin);
mymod->SetEleEtaMax(eleEtaMax);
mymod->SetJetPtMin(jetPtMin);
mymod->SetSCEtMin(scEtMin);
mymod->SetMinNTracksFit(minNTracksFit);
mymod->SetMinNdof(minNdof);
mymod->SetMaxAbsZ(maxAbsZ);
mymod->SetMaxRho(maxRho);
// Jet corrections
char* PATH = getenv("CMSSW_BASE"); assert(PATH);
TString path(TString::Format("%s/src/MitPhysics/data/", PATH));
mymod->AddJetCorr(path + "Summer13_V1_MC_L1FastJet_AK5PF.txt");
mymod->AddJetCorr(path + "Summer13_V1_MC_L2Relative_AK5PF.txt");
mymod->AddJetCorr(path + "Summer13_V1_MC_L3Absolute_AK5PF.txt");
if(isData) {
//.........这里部分代码省略.........