Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
# Conflicts:
#	test/codeblocks/.gitignore
#	test/codeblocks/ETL.depend
#	test/codeblocks/ETL.layout
#	test/test_type_lookup.cpp
  • Loading branch information
jwellbelove committed Sep 19, 2017
1 parent d4c3606 commit 68c964a
Show file tree
Hide file tree
Showing 5 changed files with 305 additions and 4 deletions.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Embedded Template Library
version=9.5.1
version=9.6.0
author= John Wellbelove <john.wellbelove@etlcpp.com>
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
sentence=A C++ template library tailored for embedded systems.
Expand Down
224 changes: 224 additions & 0 deletions src/type_lookup.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,20 @@ namespace etl

STATIC_ASSERT(((unsigned int)value != (unsigned int)UNKNOWN), "Invalid type");
};

//************************************
template <typename T>
static unsigned int get_id_from_type(const T&)
{
return get_id_from_type<T>();
}

//************************************
template <typename T>
static unsigned int get_id_from_type()
{
return id_from_type<T>::value;
}
};

//***************************************************************************
Expand Down Expand Up @@ -254,6 +268,20 @@ namespace etl

STATIC_ASSERT(((unsigned int)value != (unsigned int)UNKNOWN), "Invalid type");
};

//************************************
template <typename T>
static unsigned int get_id_from_type(const T&)
{
return get_id_from_type<T>();
}

//************************************
template <typename T>
static unsigned int get_id_from_type()
{
return id_from_type<T>::value;
}
};

//***************************************************************************
Expand Down Expand Up @@ -340,6 +368,20 @@ namespace etl

STATIC_ASSERT(((unsigned int)value != (unsigned int)UNKNOWN), "Invalid type");
};

//************************************
template <typename T>
static unsigned int get_id_from_type(const T&)
{
return get_id_from_type<T>();
}

//************************************
template <typename T>
static unsigned int get_id_from_type()
{
return id_from_type<T>::value;
}
};

//***************************************************************************
Expand Down Expand Up @@ -423,6 +465,20 @@ namespace etl

STATIC_ASSERT(((unsigned int)value != (unsigned int)UNKNOWN), "Invalid type");
};

//************************************
template <typename T>
static unsigned int get_id_from_type(const T&)
{
return get_id_from_type<T>();
}

//************************************
template <typename T>
static unsigned int get_id_from_type()
{
return id_from_type<T>::value;
}
};

//***************************************************************************
Expand Down Expand Up @@ -504,6 +560,20 @@ namespace etl

STATIC_ASSERT(((unsigned int)value != (unsigned int)UNKNOWN), "Invalid type");
};

//************************************
template <typename T>
static unsigned int get_id_from_type(const T&)
{
return get_id_from_type<T>();
}

//************************************
template <typename T>
static unsigned int get_id_from_type()
{
return id_from_type<T>::value;
}
};

//***************************************************************************
Expand Down Expand Up @@ -581,6 +651,20 @@ namespace etl

STATIC_ASSERT(((unsigned int)value != (unsigned int)UNKNOWN), "Invalid type");
};

//************************************
template <typename T>
static unsigned int get_id_from_type(const T&)
{
return get_id_from_type<T>();
}

//************************************
template <typename T>
static unsigned int get_id_from_type()
{
return id_from_type<T>::value;
}
};

//***************************************************************************
Expand Down Expand Up @@ -655,6 +739,20 @@ namespace etl

STATIC_ASSERT(((unsigned int)value != (unsigned int)UNKNOWN), "Invalid type");
};

//************************************
template <typename T>
static unsigned int get_id_from_type(const T&)
{
return get_id_from_type<T>();
}

//************************************
template <typename T>
static unsigned int get_id_from_type()
{
return id_from_type<T>::value;
}
};

//***************************************************************************
Expand Down Expand Up @@ -726,6 +824,20 @@ namespace etl

STATIC_ASSERT(((unsigned int)value != (unsigned int)UNKNOWN), "Invalid type");
};

//************************************
template <typename T>
static unsigned int get_id_from_type(const T&)
{
return get_id_from_type<T>();
}

//************************************
template <typename T>
static unsigned int get_id_from_type()
{
return id_from_type<T>::value;
}
};

//***************************************************************************
Expand Down Expand Up @@ -795,6 +907,20 @@ namespace etl

STATIC_ASSERT(((unsigned int)value != (unsigned int)UNKNOWN), "Invalid type");
};

//************************************
template <typename T>
static unsigned int get_id_from_type(const T&)
{
return get_id_from_type<T>();
}

//************************************
template <typename T>
static unsigned int get_id_from_type()
{
return id_from_type<T>::value;
}
};

//***************************************************************************
Expand Down Expand Up @@ -859,6 +985,20 @@ namespace etl

STATIC_ASSERT(((unsigned int)value != (unsigned int)UNKNOWN), "Invalid type");
};

//************************************
template <typename T>
static unsigned int get_id_from_type(const T&)
{
return get_id_from_type<T>();
}

//************************************
template <typename T>
static unsigned int get_id_from_type()
{
return id_from_type<T>::value;
}
};

//***************************************************************************
Expand Down Expand Up @@ -920,6 +1060,20 @@ namespace etl

STATIC_ASSERT(((unsigned int)value != (unsigned int)UNKNOWN), "Invalid type");
};

//************************************
template <typename T>
static unsigned int get_id_from_type(const T&)
{
return get_id_from_type<T>();
}

//************************************
template <typename T>
static unsigned int get_id_from_type()
{
return id_from_type<T>::value;
}
};

//***************************************************************************
Expand Down Expand Up @@ -978,6 +1132,20 @@ namespace etl

STATIC_ASSERT(((unsigned int)value != (unsigned int)UNKNOWN), "Invalid type");
};

//************************************
template <typename T>
static unsigned int get_id_from_type(const T&)
{
return get_id_from_type<T>();
}

//************************************
template <typename T>
static unsigned int get_id_from_type()
{
return id_from_type<T>::value;
}
};

//***************************************************************************
Expand Down Expand Up @@ -1034,6 +1202,20 @@ namespace etl

STATIC_ASSERT(((unsigned int)value != (unsigned int)UNKNOWN), "Invalid type");
};

//************************************
template <typename T>
static unsigned int get_id_from_type(const T&)
{
return get_id_from_type<T>();
}

//************************************
template <typename T>
static unsigned int get_id_from_type()
{
return id_from_type<T>::value;
}
};

//***************************************************************************
Expand Down Expand Up @@ -1086,6 +1268,20 @@ namespace etl

STATIC_ASSERT(((unsigned int)value != (unsigned int)UNKNOWN), "Invalid type");
};

//************************************
template <typename T>
static unsigned int get_id_from_type(const T&)
{
return get_id_from_type<T>();
}

//************************************
template <typename T>
static unsigned int get_id_from_type()
{
return id_from_type<T>::value;
}
};

//***************************************************************************
Expand Down Expand Up @@ -1135,6 +1331,20 @@ namespace etl

STATIC_ASSERT(((unsigned int)value != (unsigned int)UNKNOWN), "Invalid type");
};

//************************************
template <typename T>
static unsigned int get_id_from_type(const T&)
{
return get_id_from_type<T>();
}

//************************************
template <typename T>
static unsigned int get_id_from_type()
{
return id_from_type<T>::value;
}
};

//***************************************************************************
Expand Down Expand Up @@ -1181,6 +1391,20 @@ namespace etl

STATIC_ASSERT(((unsigned int)value != (unsigned int)UNKNOWN), "Invalid type");
};

//************************************
template <typename T>
static unsigned int get_id_from_type(const T&)
{
return get_id_from_type<T>();
}

//************************************
template <typename T>
static unsigned int get_id_from_type()
{
return id_from_type<T>::value;
}
};
//***************************************************************************
// Default for 16 types.
Expand Down
28 changes: 28 additions & 0 deletions src/type_lookup_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,20 @@ namespace etl
cog.outl("")
cog.outl(" STATIC_ASSERT(((unsigned int)value != (unsigned int)UNKNOWN), \"Invalid type\");")
cog.outl(" };")
cog.outl("")
cog.outl(" //************************************")
cog.outl(" template <typename T>")
cog.outl(" static unsigned int get_id_from_type(const T&)")
cog.outl(" {")
cog.outl(" return get_id_from_type<T>();")
cog.outl(" }")
cog.outl("")
cog.outl(" //************************************")
cog.outl(" template <typename T>")
cog.outl(" static unsigned int get_id_from_type()")
cog.outl(" {")
cog.outl(" return id_from_type<T>::value;")
cog.outl(" }")
cog.outl("};")
for n in range(int(NTypes) - 1, 0, -1):
cog.outl("")
Expand Down Expand Up @@ -220,6 +234,20 @@ namespace etl
cog.outl("")
cog.outl(" STATIC_ASSERT(((unsigned int)value != (unsigned int)UNKNOWN), \"Invalid type\");")
cog.outl(" };")
cog.outl("")
cog.outl(" //************************************")
cog.outl(" template <typename T>")
cog.outl(" static unsigned int get_id_from_type(const T&)")
cog.outl(" {")
cog.outl(" return get_id_from_type<T>();")
cog.outl(" }")
cog.outl("")
cog.outl(" //************************************")
cog.outl(" template <typename T>")
cog.outl(" static unsigned int get_id_from_type()")
cog.outl(" {")
cog.outl(" return id_from_type<T>::value;")
cog.outl(" }")
cog.outl("};")
cog.outl("//***************************************************************************")
cog.outl("// Default for %s types." % int(NTypes))
Expand Down
1 change: 1 addition & 0 deletions test/codeblocks/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
random_*.csv
/ETL.depend
/ETL.layout
*.depend
Loading

0 comments on commit 68c964a

Please sign in to comment.