Migrate from 2.4 code repo
[platform/core/context/context-service.git] / src / context_trigger / clips_handler.h
1 /*
2 * context-service
3 *
4 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 */
19
20 #ifndef __CLIPS_HANDLER_H__
21 #define __CLIPS_HANDLER_H__
22
23 namespace ctx {
24
25         class json;
26         class rule_manager;
27
28         class clips_handler {
29                 public:
30                         clips_handler();
31                         ~clips_handler();
32                         bool init(ctx::rule_manager* rm);
33
34                         int define_template(std::string& script);
35                         int define_class(std::string& script);
36                         int define_rule(std::string& script);
37                         int run_environment();
38                         int add_fact(std::string& fact);
39                         int route_string_command(std::string& fact);
40                         int make_instance(std::string& script);
41                         int unmake_instance(std::string& instance_name);
42                         static int execute_action();
43                         bool find_instance(std::string& instance_name);
44                         bool define_global_variable_string(std::string variable_name, std::string value);
45                         bool set_global_variable_string(std::string variable_name, std::string value);
46
47                 private:
48                         int init_environment(void* &environment);
49                         int env_build(std::string& script);
50                         void* find_instance_internal(std::string& instance_name);
51
52    };   /* class clips_handler */
53
54 }       /* namespace ctx */
55
56 #endif  /* End of __CLIPS_HANDLER_H__ */