本文整理汇总了C++中ProjectConfiguration类的典型用法代码示例。如果您正苦于以下问题:C++ ProjectConfiguration类的具体用法?C++ ProjectConfiguration怎么用?C++ ProjectConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProjectConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load_renderings
void WindowCheckKeyterms::load_renderings()
{
extern Settings *settings;
ustring project = settings->genconfig.project_get();
ProjectConfiguration *projectconfig = settings->projectconfig(project);
ustring versification = projectconfig->versification_get();
ustring keyterm;
keyterms_get_term(keyword_id, keyterm);
vector <ustring> renderings;
vector <bool> wholewords;
vector <bool> casesensitives;
ustring category;
{
ustring dummy1;
vector < Reference > dummy2;
keyterms_get_data(keyword_id, category, dummy1, dummy2);
}
keyterms_retrieve_renderings(project, keyterm, category, renderings, wholewords, casesensitives);
clear_renderings();
GtkTreeIter iter;
for (unsigned int i = 0; i < renderings.size(); i++) {
gtk_tree_store_append(treestore_renderings, &iter, NULL);
bool wholeword = wholewords[i];
bool casesensitive = casesensitives[i];
gtk_tree_store_set(treestore_renderings, &iter, 0, wholeword, 1, casesensitive, 2, renderings[i].c_str(), 3, 1, -1);
}
gtk_tree_store_append(treestore_renderings, &iter, NULL);
gtk_tree_store_set(treestore_renderings, &iter, 0, false, 1, true, 2, enter_new_rendering_here().c_str(), 3, 1, -1);
}
示例2: notes_get_references_from_editor
void notes_get_references_from_editor(GtkTextBuffer * textbuffer, vector < Reference > &references, vector < ustring > &messages)
/*
Gets all references from the notes editor.
Normalizes them.
Produces messages on trouble.
Handles notes that span more than one chapter.
*/
{
// Get all lines from the textbuffer.
vector < ustring > lines;
textbuffer_get_lines(textbuffer, lines);
// When discovering a reference from a user's entry, use previous values,
// so that it becomes quicker for a user to enter new references.
// If Leviticus 10:11 is already there, and the user wishes to add verse
// 12 also, he just enters 12 on a line, and that' it.
Reference previousreference;
for (unsigned int i = 0; i < lines.size(); i++) {
if (!lines[i].empty()) {
// Normalize reference.
Reference reference;
if (reference_discover(previousreference, lines[i], reference)) {
ustring ch1, vs1, ch2, vs2;
if (chapter_span_discover(lines[i], ch1, vs1, ch2, vs2)) {
// We cross the chapter boundaries.
// Store as two or more references,
// the first one going up to the end of the chapter,
// and the second one starting at the next chapter verse 1,
// and any chapter in-between.
extern Settings *settings;
ProjectConfiguration *projectconfig = settings->projectconfig(settings->genconfig.project_get());
Reference ref(reference.book_get(), convert_to_int(ch1), vs1);
ustring lastverse = versification_get_last_verse(projectconfig->versification_get(), reference.book_get(), convert_to_int(ch1));
ref.verse_append("-" + lastverse);
references.push_back(ref);
for (unsigned int ch = convert_to_int(ch1) + 1; ch < convert_to_int(ch2); ch++) {
Reference ref(reference.book_get(), ch, "1");
ustring lastverse = versification_get_last_verse(projectconfig->versification_get(), reference.book_get(), ch);
ref.verse_append("-" + lastverse);
references.push_back(ref);
}
ref.chapter_set(convert_to_int(ch2));
ref.verse_set("1-" + vs2);
references.push_back(ref);
// Store values to discover next reference.
previousreference.book_set(reference.book_get());
previousreference.chapter_set(convert_to_int(ch2));
previousreference.verse_set(vs2);
} else {
// We've a normal reference.
// Store reference.
references.push_back(reference);
// Store values to discover next reference.
previousreference.assign(reference);
}
} else {
messages.push_back(_("Reference ") + lines[i] + _(" is not valid and has been removed."));
}
}
}
}
示例3: gpointer
XeTeXDialog::XeTeXDialog(int dummy)
{
extern Settings *settings;
ProjectConfiguration *projectconfig = settings->projectconfig(settings->genconfig.project_get());
gtkbuilder = gtk_builder_new ();
gtk_builder_add_from_file (gtkbuilder, gw_build_filename (Directories->get_package_data(), "gtkbuilder.xetexdialog.xml").c_str(), NULL);
dialog = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "dialog"));
label_portion = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label_portion"));
button_portion = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "button_portion"));
g_signal_connect((gpointer) button_portion, "clicked", G_CALLBACK(on_button_portion_clicked), gpointer(this));
expander = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "expander"));
gtk_expander_set_expanded(GTK_EXPANDER(expander), settings->session.print_dialog_options_expanded);
label_expander = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label_expander"));
notebook = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "notebook"));
g_signal_connect_after((gpointer) notebook, "switch_page", G_CALLBACK(on_notebook_switch_page), gpointer(this));
label_tab_notes = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label_tab_notes"));
checkbutton_full_references = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "checkbutton_full_references"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_full_references), settings->session.print_references_in_notes_in_full);
// Set widget insensitive since is has not yet been implemented.
gtk_widget_set_sensitive (checkbutton_full_references, false);
label_tab_page = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label_tab_page"));
checkbutton_cropmarks = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "checkbutton_cropmarks"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_cropmarks), settings->session.print_crop_marks);
label_tab_mapping = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label_tab_mapping"));
button_font_mapping_clear = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "button_font_mapping_clear"));
filechooserbutton_font_mapping_file = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "filechooserbutton_font_mapping_file"));
g_signal_connect((gpointer) button_font_mapping_clear, "clicked", G_CALLBACK(on_button_font_mapping_clear_clicked), gpointer(filechooserbutton_font_mapping_file));
if (!projectconfig->xetex_font_mapping_file_get().empty()) {
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filechooserbutton_font_mapping_file), projectconfig->xetex_font_mapping_file_get().c_str());
}
label_tab_engine = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label_tab_engine"));
GSList *shaping_engine_group = NULL;
radiobutton_shaping_engine_generic = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "radiobutton_shaping_engine_generic"));
gtk_radio_button_set_group(GTK_RADIO_BUTTON(radiobutton_shaping_engine_generic), shaping_engine_group);
shaping_engine_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radiobutton_shaping_engine_generic));
radiobutton_shaping_engine_arab = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "radiobutton_shaping_engine_arab"));
gtk_radio_button_set_group(GTK_RADIO_BUTTON(radiobutton_shaping_engine_arab), shaping_engine_group);
shaping_engine_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radiobutton_shaping_engine_arab));
shaping_engine_set (projectconfig->xetex_shaping_engine_get());
InDialogHelp * indialoghelp = new InDialogHelp(dialog, gtkbuilder, NULL, "file/print/project");
cancelbutton = indialoghelp->cancelbutton;
okbutton = indialoghelp->okbutton;
gtk_widget_grab_focus(okbutton);
gtk_widget_grab_default(okbutton);
g_signal_connect((gpointer) okbutton, "clicked", G_CALLBACK(on_okbutton_clicked), gpointer(this));
set_gui();
}
示例4: git_revert_to_internal_repository
void git_revert_to_internal_repository(const ustring & project)
// This reverts the repository to the internal one, if that is not yet the case.
{
// Set in the configuration that we're using a local repository only.
extern Settings *settings;
ProjectConfiguration *projectconfig = settings->projectconfig(project);
projectconfig->git_use_remote_repository_set(false);
}
示例5: ProgressWindow
CheckValidateReferences::CheckValidateReferences(const ustring & project, const vector < unsigned int >&books, bool gui)
/*
It checks on the correctness and existence of the references found in the
text and in the notes.
project: project to check.
books: books to check; if empty it checks them all.
gui: whether to show graphical progressbar.
*/
{
// The variables and settings.
cancelled = false;
myproject = project;
extern Settings *settings;
ProjectConfiguration *projectconfig = settings->projectconfig(project);
versification = projectconfig->versification_get();
language = projectconfig->language_get();
// Get a list of the books to check. If no books were given, take them all.
vector < unsigned int >mybooks(books.begin(), books.end());
if (mybooks.empty())
mybooks = project_get_books(project);
// GUI.
progresswindow = NULL;
if (gui) {
progresswindow = new ProgressWindow(_("Validating references"), true);
progresswindow->set_iterate(0, 1, mybooks.size());
}
// Go through each book.
for (unsigned int bk = 0; bk < mybooks.size(); bk++) {
if (gui) {
progresswindow->iterate();
if (progresswindow->cancel) {
cancelled = true;
return;
}
}
book = mybooks[bk];
// Go through each chapter.
vector < unsigned int >chapters = project_get_chapters(project, book);
for (unsigned int ch = 0; ch < chapters.size(); ch++) {
chapter = chapters[ch];
// Go through each verse.
vector < ustring > verses = project_get_verses(project, book, chapter);
for (unsigned int vs = 0; vs < verses.size(); vs++) {
verse = verses[vs];
// Check the text.
ustring line = project_retrieve_verse(project, book, chapter, verse);
check(line);
}
}
}
}
示例6: on_assistant_apply
void RemoteRepositoryAssistant::on_assistant_apply ()
{
// Configurations.
extern Settings *settings;
ProjectConfiguration *projectconfig = settings->projectconfig(bible);
// Whether to use the remote repository.
bool use_remote_repository = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_use_repository));
if (bible_notes_selector_bible ())
projectconfig->git_use_remote_repository_set(use_remote_repository);
else
settings->genconfig.consultation_notes_git_use_remote_repository_set(use_remote_repository);
// The remote repository URL.
if (bible_notes_selector_bible ())
projectconfig->git_remote_repository_url_set(repository_url_get());
else
settings->genconfig.consultation_notes_git_remote_repository_url_set(repository_url_get());
// If the repository was cloned, move it into place.
if (repository_was_cloned()) {
ustring destination_data_directory;
if (bible_notes_selector_bible ())
destination_data_directory = project_data_directory_project(bible);
else
destination_data_directory = notes_shared_storage_folder ();
unix_rmdir(destination_data_directory);
unix_mv(persistent_clone_directory, destination_data_directory);
// Switch rename detection off.
// This is necessary for the consultation notes, since git has been seen to cause spurious renames.
GwSpawn spawn ("git");
spawn.workingdirectory (destination_data_directory);
spawn.arg ("config");
spawn.arg ("--global");
spawn.arg ("diff.renamelimit");
spawn.arg ("0");
spawn.run ();
}
if (bible_notes_selector_bible ()) {
// Take a snapshot of the whole project.
snapshots_shoot_project (bible);
} else{
// Create the index for the consultation notes.
notes_create_index ();
}
// Show summary.
gtk_assistant_set_current_page (GTK_ASSISTANT (assistant), summary_page_number);
}
示例7: git_upgrade
void git_upgrade ()
// Upgrades the git system.
{
// Go through the projects that have their git repository enabled.
extern Settings * settings;
vector <ustring> projects = projects_get_all ();
for (unsigned int i = 0; i < projects.size(); i++) {
ProjectConfiguration * projectconfig = settings->projectconfig (projects[i]);
ustring git_directory = gw_build_filename (project_data_directory_project (projects[i]), ".git");
if (projectconfig->git_use_remote_repository_get()) {
// At times there's a stale index.lock file that prevents any collaboration.
// This is to be removed.
ustring index_lock = gw_build_filename (git_directory, "index.lock");
if (g_file_test (index_lock.c_str(), G_FILE_TEST_IS_REGULAR)) {
gw_message (_("Cleaning out index lock ") + index_lock);
unix_unlink (index_lock.c_str());
}
// Get the data directory for the project
ustring datadirectory = tiny_project_data_directory_project(projects[i]);
// On most machines git can determine the user's name from the system services.
// On the XO machine, it can't. It is set here manually.
// On more recent versions of git, like version 1.8.3 and younger,
// although git may determine the user's name from the system,
// it still requires it to be set manually.
ustring command;
command = "git config user.email \"";
command.append(g_get_user_name());
command.append("@");
command.append(g_get_host_name());
command.append("\"");
maintenance_register_shell_command (datadirectory, command);
command = "git config user.name \"";
command.append(g_get_real_name());
command.append("\"");
maintenance_register_shell_command (datadirectory, command);
// (Re)initialize the repository. This can be done repeatedly without harm.
// Note that this is done on shutdown.
maintenance_register_shell_command (datadirectory, "git init");
} else {
if (g_file_test (git_directory.c_str(), G_FILE_TEST_IS_DIR)) {
gw_message (_("Cleaning out folder ") + git_directory);
ProgressWindow progresswindow (_("Tidying up project ") + projects[i], false);
progresswindow.set_fraction (0.5);
unix_rmdir (git_directory);
}
}
}
}
示例8: on_okbutton
void XeTeXDialog::on_okbutton()
{
extern Settings *settings;
ProjectConfiguration *projectconfig = settings->projectconfig(settings->genconfig.project_get());
settings->session.print_dialog_options_expanded = gtk_expander_get_expanded(GTK_EXPANDER(expander));
settings->session.print_references_in_notes_in_full = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_full_references));
settings->session.print_crop_marks = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_cropmarks));
gchar * xetex_font_mapping_filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filechooserbutton_font_mapping_file));
if (xetex_font_mapping_filename) {
projectconfig->xetex_font_mapping_file_set(xetex_font_mapping_filename);
g_free (xetex_font_mapping_filename);
} else {
projectconfig->xetex_font_mapping_file_set("");
}
projectconfig->xetex_shaping_engine_set(shaping_engine_get ());
}
示例9: ProgressWindow
CheckChaptersVerses::CheckChaptersVerses(const ustring & project, const vector < unsigned int >&books, bool gui)
/*
It checks the number of chapters per book and the number of verses per chapter.
project: project to check.
books: books to check; if empty it checks them all.
gui: show graphical progressbar.
*/
{
cancelled = false;
myproject = project;
extern Settings *settings;
ProjectConfiguration *projectconfig = settings->projectconfig(project);
myversification = projectconfig->versification_get();
// If no books given, take them all.
vector < unsigned int >mybooks(books.begin(), books.end());
if (mybooks.empty())
mybooks = project_get_books(project);
progresswindow = NULL;
if (gui) {
progresswindow = new ProgressWindow(_("Checking chapters and verses"), true);
progresswindow->set_iterate(0, 1, mybooks.size());
}
for (unsigned int bk = 0; bk < mybooks.size(); bk++) {
if (gui) {
progresswindow->iterate();
progresswindow->set_text(books_id_to_english(mybooks[bk]));
if (progresswindow->cancel) {
cancelled = true;
return;
}
}
first_chapter_found = false;
vector < unsigned int >chapters = project_get_chapters(project, mybooks[bk]);
highest_chapter_get(mybooks[bk]);
for (unsigned int ch = 0; ch < chapters.size(); ch++) {
new_chapter_check(mybooks[bk], chapters[ch]);
vector < ustring > verses;
verses = project_get_verses(project, mybooks[bk], chapters[ch]);
highest_verse_get(mybooks[bk], chapters[ch]);
verses_check(mybooks[bk], chapters[ch], verses);
}
last_chapter_check(mybooks[bk], chapters);
}
}
示例10: notes_display
void notes_display(ustring& note_buffer, vector <unsigned int> ids, unsigned int cursor_id, unsigned int &cursor_offset, bool & stop, unsigned int edited_note_id)
/*
This collect html data for displaying the notes.
It collects data for all the notes that have an id given in ids.
It inserts a html anchor at the start of the note whose id is "cursor_id".
If an "edited_note_id" is given that is not in the list of "ids", then it will display that one too, together with a message.
*/
{
extern Settings *settings;
ProjectConfiguration *projectconfig = settings->projectconfig(settings->genconfig.project_get());
ustring language = projectconfig->language_get();
// Whether to show the text of the reference(s).
bool show_reference_text = settings->genconfig.notes_display_reference_text_get();
// Whether to show the summary only.
bool show_summary = settings->genconfig.notes_display_summary_get();
// See whether to display an extra note, one just edited.
if (edited_note_id) {
set <unsigned int> id_set (ids.begin(), ids.end());
if (id_set.find (edited_note_id) == id_set.end()) {
notes_display_internal(language, show_reference_text, show_summary, note_buffer, edited_note_id,
_("The following note is displayed because it was created or edited. Normally it would not have been displayed."),
cursor_id, cursor_offset);
}
}
// Go through all the notes.
for (unsigned int c = 0; c < ids.size(); c++) {
// Handle possible stop command.
if (stop)
continue;
// Display this note.
notes_display_internal(language, show_reference_text, show_summary, note_buffer, ids[c], NULL, cursor_id, cursor_offset);
}
}
示例11: removeProjectConfiguration
void VcProj::removeProjectConfiguration( const ProjectConfiguration &config )
{
// delete the <ProjectConfiguration> itself
std::string projectConfigurationNodesXPath = "/Project/ItemGroup[@Label=\"ProjectConfigurations\"]/ProjectConfiguration";
pugi::xpath_node_set configurationNodes = mProjDom->select_nodes( projectConfigurationNodesXPath.c_str() );
for( pugi::xpath_node_set::const_iterator it = configurationNodes.begin(); it != configurationNodes.end(); ++it ) {
if( QString( it->node().attribute( "Include" ).value() ) == config.asString() ) {
it->node().parent().remove_child( it->node() );
break;
}
}
// delete all nodes of the form
// Condition="'$(Configuration)|$(Platform)'=='Debug_ANGLE|Win32'"
std::string conditionString = "'$(Configuration)|$(Platform)'=='" + config.asString().toStdString() + "'";
std::string conditionXPath = "//*[@Condition=\"" + conditionString + "\"]";
pugi::xpath_node_set conditionNodes = mProjDom->select_nodes( conditionXPath.c_str() );
for( pugi::xpath_node_set::const_iterator it = conditionNodes.begin(); it != conditionNodes.end(); ++it ) {
it->node().parent().remove_child( it->node() );
}
}
示例12: gtk_tree_selection_selected_foreach
void SelectBooksDialog::on_okbutton()
{
// Get the list of books now selected.
selection.clear();
vector < ustring > books;
gtk_tree_selection_selected_foreach(selectbooks, selection_foreach_function, gpointer(&books));
for (unsigned int i = 0; i < books.size(); i++) {
unsigned int book = books_name_to_id(mylanguage, books[i]);
if (book)
selection.push_back(book);
}
// Also produce a set out of that list.
selectionset.clear();
for (unsigned int i = 0; i < selection.size(); i++) {
selectionset.insert(selection[i]);
}
// If portions are showing, store the values there too.
if (myshowportions) {
// Get books, includes and portions.
vector < ustring > reordered_books;
vector < bool > reordered_includes;
vector < ustring > reordered_portions;
{
vector < ustring > books = listview_get_strings(treeviewbooks);
for (unsigned int i = 0; i < books.size(); i++) {
unsigned int book = books_name_to_id(mylanguage, books[i]);
reordered_books.push_back(books_id_to_english(book));
bool include = (selectionset.find(book) != selectionset.end());
reordered_includes.push_back(include);
}
}
reordered_portions = listview_get_strings(treeviewportions);
// Save books, includes and portions.
extern Settings *settings;
ProjectConfiguration *projectconfig = settings->projectconfig(myproject);
projectconfig->reordered_books_set(reordered_books);
projectconfig->reordered_includes_set(reordered_includes);
projectconfig->reordered_portions_set(reordered_portions);
}
}
示例13: read
void OTQuotations::get(Reference & reference, vector < Reference > &references, vector < ustring > &comments)
/*
Retrieves an Old Testament quotation of a New Testament reference.
This function does a bit more too. If an OT reference is passed, it also looks
up the place in the NT where this is quoted.
reference: The input reference.
references: The output reference: contains the related references.
*/
{
// Read data if we've nothing yet.
if (quotations_nt_order.empty())
read();
// Store the original reference.
references.push_back(reference);
comments.push_back(_("Current one"));
// Remap the references.
extern Settings *settings;
ustring project = settings->genconfig.project_get();
ProjectConfiguration *projectconfig = settings->projectconfig(project, false);
Mapping mapping(projectconfig->versification_get(), reference.book_get());
for (unsigned int i = 0; i < quotations_nt_order.size(); i++) {
mapping.book_change(quotations_nt_order[i].reference.book_get());
mapping.original_to_me(quotations_nt_order[i].reference);
for (unsigned int i2 = 0; i2 < quotations_nt_order[i].referents.size(); i2++) {
mapping.book_change(quotations_nt_order[i].referents[i2].book_get());
mapping.original_to_me(quotations_nt_order[i].referents[i2]);
}
}
// Go through the quotations looking for matching ones.
bool lxx = false;
for (unsigned int i = 0; i < quotations_nt_order.size(); i++) {
// If this is a NT reference, look for the corresponding OT quotations.
if (reference.equals(quotations_nt_order[i].reference)) {
for (unsigned int i2 = 0; i2 < quotations_nt_order[i].referents.size(); i2++) {
references.push_back(quotations_nt_order[i].referents[i2]);
comments.push_back(comment(_("Quotation"), lxx));
}
}
// If this is an OT reference, look for possible other ones in the OT, and the NT place that quotes it.
for (unsigned int i2 = 0; i2 < quotations_nt_order[i].referents.size(); i2++) {
if (reference.equals(quotations_nt_order[i].referents[i2])) {
references.push_back(quotations_nt_order[i].reference);
comments.push_back(_("Quoted here"));
for (unsigned int i3 = 0; i3 < quotations_nt_order[i].referents.size(); i3++) {
if (i3 != i2) {
references.push_back(quotations_nt_order[i].referents[i3]);
comments.push_back(comment(_("Parallel passage"), lxx));
}
}
}
}
}
// If there is only one reference found, that will be the original one.
// That means that no parallel or corresponding references were found.
// Erase that single one in such cases.
if (references.size() == 1) {
references.clear();
comments.clear();
}
}
示例14: findItemDefinitionGroup
pugi::xml_node VcProj::findItemDefinitionGroup( const ProjectConfiguration &projConfig )
{
return findItemDefinitionGroup( projConfig.getConfig(), projConfig.getPlatform() );
}
示例15: main
int main(int argc, char** argv)
{
try {
// init command line parser
util::ProgramOptions::init(argc, argv);
int stack_id = optionStackId.as<int>();
std::string comp_dir = optionComponentDir.as<std::string>();
std::string pg_host = optionPGHost.as<std::string>();
std::string pg_user = optionPGUser.as<std::string>();
std::string pg_pass = optionPGPassword.as<std::string>();
std::string pg_dbase = optionPGDatabase.as<std::string>();
std::cout << "Testing PostgreSQL stores with stack ID " << stack_id << std::endl;
// init logger
logger::LogManager::init();
logger::LogManager::setGlobalLogLevel(logger::Debug);
// create new project configuration
ProjectConfiguration pc;
pc.setBackendType(ProjectConfiguration::PostgreSql);
StackDescription stack;
stack.id = stack_id;
pc.setCatmaidStack(Raw, stack);
pc.setComponentDirectory(comp_dir);
pc.setPostgreSqlHost(pg_host);
pc.setPostgreSqlUser(pg_user);
pc.setPostgreSqlPassword(pg_pass);
pc.setPostgreSqlDatabase(pg_dbase);
PostgreSqlSliceStore sliceStore(pc, Membrane);
// Add first set of slices
boost::shared_ptr<Slice> slice1 = createSlice(10, 0);
boost::shared_ptr<Slice> slice2 = createSlice(10, 1);
boost::shared_ptr<Slice> slice3 = createSlice(10, 2);
Slices slices = Slices();
slices.add(slice1);
slices.add(slice2);
slices.add(slice3);
Block block(0, 0, 0);
sliceStore.associateSlicesToBlock(slices, block);
Blocks blocks;
blocks.add(block);
Blocks missingBlocks;
boost::shared_ptr<Slices> retrievedSlices =
sliceStore.getSlicesByBlocks(blocks, missingBlocks);
// Create conflict set where each slice
ConflictSet conflictSet1;
conflictSet1.addSlice(slice1->hashValue());
conflictSet1.addSlice(slice2->hashValue());
conflictSet1.addSlice(slice3->hashValue());
ConflictSets conflictSets;
conflictSets.add(conflictSet1);
sliceStore.associateConflictSetsToBlock(conflictSets, block);
boost::shared_ptr<ConflictSets> retrievedConflictSets =
sliceStore.getConflictSetsByBlocks(blocks, missingBlocks);
for (const ConflictSet& cs : *retrievedConflictSets) {
std::cout << "ConflictSet hash: " << hash_value(cs);
for (const SliceHash& sh : cs.getSlices()) {
std::cout << " Slice hash: " << sh;
}
std::cout << std::endl;
}
PostgreSqlSegmentStore segmentStore(pc, Membrane);
util::box<unsigned int, 2> segmentBounds(0, 0, 0, 0);
std::vector<double> segmentFeatures;
segmentFeatures.push_back(0.0);
segmentFeatures.push_back(1.0);
segmentFeatures.push_back(2.0);
SegmentDescription segment(0, segmentBounds);
segment.addLeftSlice(slice1->hashValue());
segment.addRightSlice(slice2->hashValue());
segment.setFeatures(segmentFeatures);
boost::shared_ptr<SegmentDescriptions> segments = boost::make_shared<SegmentDescriptions>();
segments->add(segment);
segmentStore.associateSegmentsToBlock(*segments, block);
boost::shared_ptr<SegmentDescriptions> retrievedSegments =
segmentStore.getSegmentsByBlocks(blocks, missingBlocks, false);
} catch (boost::exception& e) {
handleException(e, std::cerr);
}
}