1/*
2 * Copyright (C) 2008-2009 SVOX AG, Baslerstr. 30, 8048 Zuerich, Switzerland
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 picoknow.c
18 *
19 * Copyright (C) 2008-2009 SVOX AG, Baslerstr. 30, 8048 Zuerich, Switzerland
20 * All rights reserved.
21 *
22 * History:
23 * - 2009-04-20 -- initial version
24 *
25 */
26
27#include "picodefs.h"
28#include "picoos.h"
29#include "picodbg.h"
30#include "picoknow.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35#if 0
36}
37#endif
38
39
40/**  class   : KnowledgeBase
41 *   shortcut : kb
42 *
43 */
44extern picoknow_KnowledgeBase picoknow_newKnowledgeBase(picoos_MemoryManager mm)
45{
46    picoknow_KnowledgeBase this;
47    PICODBG_TRACE(("start"));
48
49    this = picoos_allocate(mm,sizeof(*this));
50    if (NULL != this) {
51      PICODBG_TRACE(("allocated KnowledgeBase at address %i with size %i",(picoos_uint32)this,sizeof(*this)));
52        /* initialize */
53        this->next = NULL;
54        this->id = PICOKNOW_KBID_NULL;
55        this->base = NULL;
56        this->size = 0;
57        this->subObj = NULL;
58        this->subDeallocate = NULL;
59    }
60    return this;
61}
62
63extern void picoknow_disposeKnowledgeBase(picoos_MemoryManager mm, picoknow_KnowledgeBase * this)
64{
65    picoos_uint8 id;
66    if (NULL != (*this)) {
67        id = (*this)->id;
68        PICODBG_TRACE(("disposing KnowledgeBase id=%i",id));
69        /* terminate */
70        if ((*this)->subObj != NULL) {
71            (*this)->subDeallocate((*this),mm);
72        }
73        picoos_deallocate(mm,(void**)this);
74    }
75}
76
77#ifdef __cplusplus
78}
79#endif
80
81/* End picoknow.c */
82