front_idill/extern/fajran-npTuioClient/TuioClient/TuioString.h
author bastiena
Thu, 12 Apr 2012 15:33:25 +0200
changeset 28 9ccef81f02ab
parent 27 6c08d4d7219e
permissions -rw-r--r--
Charset set to UTF-8 without bom tab replaced by 4 spaces \r\n replaced by \n in non cs files
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
     1
/*
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
     2
    Modified by alexandre.bastien@iri.centrepompidou.fr to manage TUIO strings.
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
     3
*/
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
     4
27
6c08d4d7219e Middleware :
bastiena
parents:
diff changeset
     5
#ifndef INCLUDED_TUIOSTRING_H
6c08d4d7219e Middleware :
bastiena
parents:
diff changeset
     6
#define INCLUDED_TUIOSTRING_H
6c08d4d7219e Middleware :
bastiena
parents:
diff changeset
     7
6c08d4d7219e Middleware :
bastiena
parents:
diff changeset
     8
class TuioString {
6c08d4d7219e Middleware :
bastiena
parents:
diff changeset
     9
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    10
    protected:
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    11
        int session_id;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    12
        int string_id;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    13
        const char* code;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    14
        long timestamp;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    15
        int state;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    16
    
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    17
    public:
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    18
    TuioString (int s_id, int string_id, const char* _code) {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    19
        this->session_id = s_id;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    20
        this->string_id = string_id;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    21
        this->code = _code;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    22
        timestamp = TUIO_UNDEFINED;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    23
        state = TUIO_ADDED;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    24
    };
27
6c08d4d7219e Middleware :
bastiena
parents:
diff changeset
    25
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    26
    TuioString (TuioString *tuioString) {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    27
        this->session_id = tuioString->getSessionID();
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    28
        this->string_id = tuioString->getStringID();
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    29
        this->code = tuioString->getCode();
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    30
        timestamp = TUIO_UNDEFINED;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    31
        state = TUIO_ADDED;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    32
    };
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    33
    
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    34
    ~TuioString(){};
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    35
    
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    36
    int getSessionID() { return session_id; };
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    37
    int getStringID() { return string_id; };
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    38
    const char* getCode() { return code; };
27
6c08d4d7219e Middleware :
bastiena
parents:
diff changeset
    39
6c08d4d7219e Middleware :
bastiena
parents:
diff changeset
    40
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    41
    void update(const char* _code)
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    42
    {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    43
        this->code = _code;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    44
        timestamp = TUIO_UNDEFINED;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    45
        state = TUIO_UPDATED;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    46
    }
27
6c08d4d7219e Middleware :
bastiena
parents:
diff changeset
    47
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    48
    void remove() {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    49
        state = TUIO_REMOVED;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    50
        timestamp = TUIO_UNDEFINED;        
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    51
    }
27
6c08d4d7219e Middleware :
bastiena
parents:
diff changeset
    52
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    53
    long getUpdateTime() { return timestamp; };
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    54
    void setUpdateTime(long timestamp) { this->timestamp = timestamp; };
27
6c08d4d7219e Middleware :
bastiena
parents:
diff changeset
    55
};
6c08d4d7219e Middleware :
bastiena
parents:
diff changeset
    56
6c08d4d7219e Middleware :
bastiena
parents:
diff changeset
    57
#endif