Tizen 2.1 base
[framework/web/wrt-commons.git] / modules / ace / include / dpl / ace / Subject.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 //
17 // File:   Subject.h
18 // Author: notroot
19 //
20 // Created on June 2, 2009, 8:47 AM
21 //
22
23 #ifndef _SUBJECT_H
24 #define    _SUBJECT_H
25
26 #include <set>
27 #include <list>
28 #include <iostream>
29 #include <dpl/assert.h>
30 #include <dpl/noncopyable.h>
31
32 #include "Attribute.h"
33
34 class Subject : DPL::Noncopyable
35 {
36     std::string subjectId;
37     std::list<Attribute> targetAttributes;
38
39   public:
40     Subject()
41     {}
42
43     //deserialize
44     Subject(std::istream&);
45
46     virtual bool serialize (std::ostream& os);
47
48     const std::list<Attribute>& getTargetAttributes() const;
49
50     void setSubjectId(const std::string & subjectId)
51     {
52         this->subjectId = subjectId;
53     }
54
55     //TODO maybe we should remove that becuase this causes a memory leak right now!! [CR] maybe thats true, maybe whe can remove this fun
56     // KW    void setTargetAttributes(std::list<Attribute> * targetAttributes){ this->targetAttributes = targetAttributes; }
57
58     const std::string & getSubjectId() const
59     {
60         return this->subjectId;
61     }
62
63     void addNewAttribute(Attribute & attr)
64     {
65         this->targetAttributes.push_back(attr);
66     }
67
68     //TODO in 1.0 change to true/false/undetermined
69     bool matchSubject(const AttributeSet *attrSet,
70             bool &isUndetermined) const;
71
72     ~Subject()
73     {}
74 };
75
76 #endif    /* _SUBJECT_H */
77