summaryrefslogtreecommitdiffstats
path: root/src/common/interface
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-10-07 23:34:14 +0000
committerDavid Robillard <d@drobilla.net>2007-10-07 23:34:14 +0000
commit19a9eb15d1c918b10fe169db1b8f4fd0c6ffe8fa (patch)
treeebe897479e882241343196b6b33cf309917e7ae9 /src/common/interface
parent971c02f3707c4872a2da9a3b946b6508290c5ab4 (diff)
downloadingen-19a9eb15d1c918b10fe169db1b8f4fd0c6ffe8fa.tar.gz
ingen-19a9eb15d1c918b10fe169db1b8f4fd0c6ffe8fa.tar.bz2
ingen-19a9eb15d1c918b10fe169db1b8f4fd0c6ffe8fa.zip
Move DataType into Shared namespace.
git-svn-id: http://svn.drobilla.net/lad/ingen@841 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/common/interface')
-rw-r--r--src/common/interface/DataType.hpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/common/interface/DataType.hpp b/src/common/interface/DataType.hpp
index a2e3ce5a..1eef3171 100644
--- a/src/common/interface/DataType.hpp
+++ b/src/common/interface/DataType.hpp
@@ -18,8 +18,8 @@
#ifndef DATATYPE_H
#define DATATYPE_H
-namespace Ingen
-{
+namespace Ingen {
+namespace Shared {
/** A data type that can be stored in a Port.
@@ -30,7 +30,7 @@ namespace Ingen
*/
class DataType {
public:
-
+
enum Symbol {
UNKNOWN = 0,
AUDIO = 1,
@@ -38,9 +38,9 @@ public:
MIDI = 3,
OSC = 4
};
-
+
DataType(const std::string& uri)
- : _symbol(UNKNOWN)
+ : _symbol(UNKNOWN)
{
if (uri == type_uri(AUDIO)) {
_symbol = AUDIO;
@@ -54,20 +54,23 @@ public:
}
DataType(Symbol symbol)
- : _symbol(symbol)
+ : _symbol(symbol)
{}
- const char* uri() const { return type_uri(_symbol); }
- const Symbol& symbol() const { return _symbol; }
+ inline const char* uri() const { return type_uri(_symbol); }
inline bool operator==(const Symbol& symbol) const { return (_symbol == symbol); }
inline bool operator!=(const Symbol& symbol) const { return (_symbol != symbol); }
inline bool operator==(const DataType& type) const { return (_symbol == type._symbol); }
inline bool operator!=(const DataType& type) const { return (_symbol != type._symbol); }
-private:
- Symbol _symbol;
+ inline bool is_audio() { return _symbol == AUDIO; }
+ inline bool is_control() { return _symbol == CONTROL; }
+ inline bool is_midi() { return _symbol == MIDI; }
+ inline bool is_osc() { return _symbol == OSC; }
+private:
+
static inline const char* type_uri(unsigned symbol_num) {
switch (symbol_num) {
case 1: return "ingen:AudioPort";
@@ -77,10 +80,14 @@ private:
default: return "";
}
}
-};
+ Symbol _symbol;
+};
+} // namespace Shared
} // namespace Ingen
+using Ingen::Shared::DataType;
+
#endif // DATATYPE_H