-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc8ebeb
commit 4c26b56
Showing
6 changed files
with
164 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/******************************************************************************* | ||
This file is part of Set--Based Graph Library. | ||
SBG Library is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
SBG Library is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with SBG Library. If not, see <http://www.gnu.org/licenses/>. | ||
******************************************************************************/ | ||
|
||
#include <sbg/pw_map.hpp> | ||
|
||
namespace SBG { | ||
|
||
namespace LIB { | ||
|
||
// Type definitions ------------------------------------------------------------ | ||
|
||
bool LTMap::operator()(const SBGMap &x, const SBGMap &y) const { return LTInter(x.dom(), y.dom()); } | ||
|
||
std::ostream &operator<<(std::ostream &out, const MapSet &ms) | ||
{ | ||
MapSet aux = ms; | ||
int sz = aux.size(); | ||
|
||
out << "<<"; | ||
if (sz > 0) { | ||
auto it = aux.begin(); | ||
for (int i = 0; i < sz - 1; ++i) { | ||
out << *it << ", "; | ||
++it; | ||
} | ||
out << *it; | ||
} | ||
out << ">>"; | ||
|
||
return out; | ||
} | ||
|
||
// PWMap ----------------------------------------------------------------------- | ||
|
||
PWMap::PWMap() : maps_() {} | ||
PWMap::PWMap(SBGMap sm) : maps_() { maps_ref().insert(sm); } | ||
PWMap::PWMap(MapSet maps) : maps_(maps) {} | ||
|
||
member_imp(PWMap, MapSet, maps); | ||
|
||
// TODO | ||
bool PWMap::operator==(const PWMap &other) const | ||
{ | ||
return true; | ||
} | ||
|
||
std::ostream &operator(std::ostream &out, const PWMap &pw) | ||
{ | ||
out << pw.maps(); | ||
|
||
return out; | ||
} | ||
|
||
// PWMap functions ------------------------------------------------------------- | ||
|
||
} // namespace LIB | ||
|
||
} // namespace SBG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/** @file pw_map.hpp | ||
@brief <b>Piecewise map implementation</b> | ||
<hr> | ||
This file is part of Set--Based Graph Library. | ||
SBG Library is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
SBG Library is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with SBG Library. If not, see <http://www.gnu.org/licenses/>. | ||
******************************************************************************/ | ||
|
||
#ifndef SBG_PWMAP_HPP | ||
#define SBG_PWMAP_HPP | ||
|
||
#include <sbg/map.hpp> | ||
|
||
namespace SBG { | ||
|
||
namespace LIB { | ||
|
||
/** | ||
* @brief Ordered collection of maps. | ||
*/ | ||
|
||
/* @struct LTMap | ||
* | ||
* @brief This function is defined to be used by the MapSet definition. The | ||
* two inputs are disjoint (that's why the operator<, that compares any sort of | ||
* Maps, is not used). | ||
*/ | ||
struct LTMap { | ||
bool operator()(const SBGMap &x, const SBGMap &y) const; | ||
typedef SBGMap first_argument_type; | ||
typedef SBGMap second_argument_type; | ||
typedef bool result_type; | ||
}; | ||
|
||
typedef boost::container::set<SBGMap, LTMap, boost::container::new_allocator<SBGMap>, void> MapSet; | ||
typedef boost::container::set<SBGMap>::iterator MapSetIt; | ||
std::ostream &operator<<(std::ostream &out, const MapSet &ii); | ||
|
||
struct PWMap { | ||
member_class(MapSet, maps); | ||
|
||
PWMap(); | ||
PWMap(SBGMap m); | ||
PWMap(MapSet maps); | ||
|
||
eq_class(PWMap); | ||
}; | ||
std::ostream &operator<<(std::ostream &out, const PWMap &pw); | ||
|
||
/** | ||
* @brief Traditional map operations. | ||
*/ | ||
|
||
} // namespace LIB | ||
|
||
} // namespace SBG | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters