Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
Zipr Toolchain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open Source Software
Zipr Toolchain
Commits
f5f41e77
Commit
f5f41e77
authored
6 years ago
by
Matthew McGill
Browse files
Options
Downloads
Patches
Plain Diff
Interface changes
Former-commit-id: af8d489f959a5fd65773df254be54d6e5d5c74ab
parent
d17ac54d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libIRDB/include/util/IR_Files.hpp
+26
-16
26 additions, 16 deletions
libIRDB/include/util/IR_Files.hpp
with
26 additions
and
16 deletions
libIRDB/include/util/IR_Files.hpp
+
26
−
16
View file @
f5f41e77
#ifndef IR_Files_h
#define IR_Files_h
// TODO: This should really use unordered maps and sets,
// but I was having trouble building with those.
#include
<map>
#include
<utility>
#include
<memory>
#include
<
iterator
>
#include
<
set
>
// If our toolchain use paradigm changes, this class can be extended
// to support adding, removing, writing back, and getting individual file IRs
// in a variant (may require adding more maps).
// *** A toolchain step should NOT delete pointers to any variant, file IR, or file object stored
// in a IRFiles_t object. I have made pointers shared where possible to communicate this. ***
class
IRFiles_t
{
public:
IRFiles_t
()
{};
~
IRFiles_t
();
// add/remove file IRs (have option to write back to DB upon removal)
// If choosing to write back to DB, may throw a database error exception.
// If the write back fails, the FileIR will not be destroyed.
void
AddFileIR
(
FileIR_t
&
);
void
RemoveFileIR
(
FileIR_t
&
,
bool
);
void
RemoveFileIR
(
File_t
&
,
bool
);
// has file IR?
bool
HasFileIR
(
File_t
&
);
bool
HasFileIR
(
FileIR_t
&
);
// Add/remove file IRs.
// Adding file IRs also adds the variant the files belong to.
// Removing file IRs also removes the variant the files belong to.
// When removing file IRs, have the option to write back to the DB.
int
AddFileIRs
(
db_id_t
variant_id
);
int
RemoveFileIRs
(
db_id_t
variant_id
,
bool
write_to_DB
);
// get a variant
std
::
shared_ptr
<
VariantID_t
>
GetVariant
(
db_id_t
variant_id
);
// get file IRs (returns a shared ptr to a set of shared ptrs to file IRs)
std
::
shared_ptr
<
std
::
set
<
std
::
shared_ptr
<
FileIR_t
>>>
GetFileIRs
(
db_id_t
variant_id
);
//
get file IR
FileIR_t
*
GetFileIR
(
File_t
&
);
//
Write back all variants and file IRs stored in this IRFiles_t object.
int
WriteBackAll
(
void
);
private
:
// map for speed of finding if a needed file
// has already been read from the DB
std
::
map
<
File_t
*
,
std
::
shared_ptr
<
FileIR_t
>>
file_IR_map
;
// maps for speed of finding needed file IRs and/or variants
// that have already been read from the DB
std
::
map
<
db_id_t
,
std
::
shared_ptr
<
VariantID_t
>>
variant_map
;
std
::
map
<
db_id_t
,
std
::
shared_ptr
<
std
::
set
<
std
::
shared_ptr
<
FileIR_t
>>>>
file_IRs_map
;
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment