35 #ifndef _DBW_MKZ_CAN_PLATFORM_MAP_H
36 #define _DBW_MKZ_CAN_PLATFORM_MAP_H
54 PlatformMap(
const std::vector<PlatformVersion> &vec) {
55 for (
size_t i = 0; i < vec.size(); i++) {
62 void insert(
const PlatformVersion &
x) {
66 for (Map::const_iterator it_p =
map.begin(); it_p !=
map.end(); it_p++) {
67 const MapM &map_m = it_p->second;
68 MapM::const_iterator it_m = map_m.find(m);
69 if (it_m != map_m.end()) {
73 return ModuleVersion();
76 MapP::const_iterator it_p =
map.find(p);
77 if (it_p !=
map.end()) {
78 const MapM &map_m = it_p->second;
79 MapM::const_iterator it_m = map_m.find(m);
80 if (it_m != map_m.end()) {
84 return ModuleVersion();
86 ModuleVersion
findModule(
const PlatformVersion &
x)
const {
90 for (Map::const_iterator it_p =
map.begin(); it_p !=
map.end(); it_p++) {
91 const MapM &map_m = it_p->second;
92 MapM::const_iterator it_m = map_m.find(m);
93 if (it_m != map_m.end()) {
94 return PlatformVersion(it_p->first, it_m->first, it_m->second);
97 return PlatformVersion();
99 PlatformVersion
findPlatform(
const PlatformVersion &
x)
const {
103 typedef std::map<Module, ModuleVersion>
MapM;
104 typedef std::map<Platform, MapM>
MapP;
109 static bool operator< (
const PlatformVersion&
x,
const PlatformMap& map) {
return x < map.findModule(
x); }
110 static bool operator> (
const PlatformVersion&
x,
const PlatformMap& map) {
return x > map.findModule(
x); }
111 static bool operator<=(
const PlatformVersion&
x,
const PlatformMap& map) {
return x <= map.findModule(
x); }
112 static bool operator>=(
const PlatformVersion&
x,
const PlatformMap& map) {
return x >= map.findModule(
x); }
113 static bool operator==(
const PlatformVersion&
x,
const PlatformMap& map) {
return x == map.findModule(
x); }
114 static bool operator!=(
const PlatformVersion&
x,
const PlatformMap& map) {
return x != map.findModule(
x); }
118 #endif // _DBW_MKZ_CAN_PLATFORM_MAP_H