SHOGUN  v3.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
IndexBlock.cpp
Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 3 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * Copyright (C) 2012 Sergey Lisitsyn
00008  */
00009 
00010 #include <shogun/lib/IndexBlock.h>
00011 
00012 using namespace shogun;
00013 
00014 CIndexBlock::CIndexBlock() : CSGObject(),
00015     m_min_index(0), m_max_index(0),
00016     m_weight(1.0), m_sub_blocks(NULL)
00017 {
00018     m_sub_blocks = new CList(true);
00019     SG_REF(m_sub_blocks);
00020 }
00021 
00022 CIndexBlock::CIndexBlock(index_t min_index, index_t max_index,
00023              float64_t weight, const char* name) :
00024     CSGObject(), m_min_index(min_index), m_max_index(max_index),
00025     m_weight(weight), m_sub_blocks(NULL)
00026 {
00027     m_sub_blocks = new CList(true);
00028     SG_REF(m_sub_blocks);
00029 }
00030 
00031 CIndexBlock::~CIndexBlock()
00032 {
00033     SG_UNREF(m_sub_blocks);
00034 }
00035 
00036 void CIndexBlock::add_sub_block(CIndexBlock* sub_block)
00037 {
00038     ASSERT(sub_block->get_min_index()>=m_min_index)
00039     ASSERT(sub_block->get_max_index()<=m_max_index)
00040     m_sub_blocks->append_element(sub_block);
00041 }
00042 
00043 CList* CIndexBlock::get_sub_blocks()
00044 {
00045     SG_REF(m_sub_blocks);
00046     return m_sub_blocks;
00047 }
00048 
00049 int32_t CIndexBlock::get_num_sub_blocks()
00050 {
00051     return m_sub_blocks->get_num_elements();
00052 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation