转载请注明: http://blog.csdn.net/c602273091/article/details/50717999
Introduction STL
STL(Standard Template Library,标准模板库)是惠普实验室开发的一系列软件的统称。它是由Alexander Stepanov、Meng Lee和David R Musser在惠普实验室工作时所开发出来的。现在虽说它主要出现在C++中,但在被引入C++之前该技术就已经存在了很长的一段时间。
STL的代码从广义上讲分为三类:algorithm(算法)、container(容器)和iterator(迭代器),几乎所有的代码都采用了模板类和模版函数的方式,这相比于传统的由函数和类组成的库来说提供了更好的代码重用机会。
在C++标准中,STL被组织为下面的13头文件:
algorithm、deque、 functional、iterator、vector、list、map、memory、numeric、queue、set、stack、utility。
http://www.cnblogs.com/shiyangxt/archive/2008/09/11/1289493.html
Algorithm
大家都能取得的一个共识是函数库对数据类型的选择对其可重用性起着至关重要的作用。举例来说,一个求方根的函数,在使用浮点数作为其参数类型的情况下的可重用性肯定比使用整型作为它的参数类性要高。而C++通过模板的机制允许推迟对某些类型的选择,直到真正想使用模板或者说对模板进行特化的时候,STL就利用了这一点提供了相当多的有用算法。它是在一个有效的框架中完成这些算法的——你可以将所有的类型划分为少数的几类,然后就可以在模版的参数中使用一种类型替换掉同一种类中的其他类型。
STL提供了大约100个实现算法的模版函数,比如算法for_each将为指定序列中的每一个元素调用指定的函数,stable_sort以你所指定的规则对序列进行稳定性排序等等。这样一来,只要我们熟悉了STL之后,许多代码可以被大大的化简,只需要通过调用一两个算法模板,就可以完成所需要的功能并大大地提升效率。
算法部分主要由头文件algorithm,numeric 和 functional组成。
algorithm 是所有STL头文件中最大的一个(尽管它很好理解),它是由一大堆模版函数组成的,可以认为每个函数在很大程度上都是独立的,其中常用到的功能范围涉及到比较、交换、查找、遍历操作、复制、修改、移除、反转、排序、合并等等。
numeric 体积很小,只包括几个在序列上面进行简单数学运算的模板函数,包括加法和乘法在序列上的一些操作。
functional 中则定义了一些模板类,用以声明函数对象。
Container
在实际的开发过程中,数据结构本身的重要性不会逊于操作于数据结构的算法的重要性,当程序中存在着对时间要求很高的部分时,数据结构的选择就显得更加重要。
经典的数据结构数量有限,但是我们常常重复着一些为了实现向量、链表等结构而编写的代码,这些代码都十分相似,只是为了适应不同数据的变化而在细节上有所出入。STL容器
就为我们提供了这样的方便,它允许我们重复利用已有的实现构造自己的特定类型下的数据结构,通过设置一些模版类,STL容器对最常用的数据结构提供了支持,这些模板的参数
允许我们指定容器中元素的数据类型,可以将我们许多重复而乏味的工作简化。
容器部分主要由头文件 vector, list, deque, set, map, stack、queue组成。对于常用的一些容器和容器适配器(可以看作由其它容器实现的容器),可以通过下表总结一下它们和相应头文件的对应关系。
向量(vector) 连续存储的元素vector。
#include <iostream>
#include <vector>
using namespace std;
int main(){
vector<int>vi;
int a;
while(true)
{
cout<<"输入一个整数,按0停止输入:";
cin>>a;
if(a==0)
break;
vi.push_back(a);
vector<int>::iterator iter;
for(iter=vi.begin();iter!=vi.end();++iter)
cout<<*iter;
}
return 0;
}
列表(list) 由节点组成的双向链表,每个结点包含着一个元素 list
#include <iostream>
#include <list>
#include <numeric>
#include <algorithm>
using namespace std;
//创建一个list容器的实例LISTINT
typedef list<int> LISTINT;
//创建一个list容器的实例LISTCHAR
typedef list<int> LISTCHAR;
int main(){
//--------------------------
//用list容器处理整型数据
//--------------------------
//用LISTINT创建一个名为listOne的list对象
LISTINT listOne;
//声明i为迭代器
LISTINT::iterator i;
//从前面向listOne容器中添加数据
listOne.push_front (2);
listOne.push_front (1);
//从后面向listOne容器中添加数据
listOne.push_back (3);
listOne.push_back (4);
//从前向后显示listOne中的数据
cout<<"listOne.begin()--- listOne.end():"<<endl;
for (i = listOne.begin(); i != listOne.end(); ++i)
cout << *i << " ";
cout << endl;
//从后向前显示listOne中的数据
LISTINT::reverse_iterator ir;
cout<<"listOne.rbegin()---listOne.rend():"<<endl;
for (ir =listOne.rbegin(); ir!=listOne.rend();ir++) {
cout << *ir << " ";
}
cout << endl;
//使用STL的accumulate(累加)算法
int result = accumulate(listOne.begin(), listOne.end(),0);
cout<<"Sum="<<result<<endl;
cout<<"------------------"<<endl;
//--------------------------
//用list容器处理字符型数据
//--------------------------
//用LISTCHAR创建一个名为listOne的list对象
LISTCHAR listTwo;
//声明i为迭代器
LISTCHAR::iterator j;
//从前面向listTwo容器中添加数据
listTwo.push_front ('A');
listTwo.push_front ('B');
//从后面向listTwo容器中添加数据
listTwo.push_back ('x');
listTwo.push_back ('y');
//从前向后显示listTwo中的数据
cout<<"listTwo.begin()---listTwo.end():"<<endl;
for (j = listTwo.begin(); j != listTwo.end(); ++j)
cout << char(*j) << " ";
cout << endl;
//使用STL的max_element算法求listTwo中的最大元素并显示
j=max_element(listTwo.begin(),listTwo.end());
cout << "The maximum element in listTwo is: "<<char(*j)<<endl;
}
#include <iostream>
#include <list>
using namespace std;
typedef list<int> INTLIST;
//从前向后显示list队列的全部元素
void put_list(INTLIST list, char *name)
{
INTLIST::iterator plist;
cout << "The contents of " << name << " : ";
for(plist = list.begin(); plist != list.end(); plist++)
cout << *plist << " ";
cout<<endl;
}
//测试list容器的功能
int main(){
//list1对象初始为空
INTLIST list1;
//list2对象最初有10个值为6的元素
INTLIST list2(10,6);
//list3对象最初有9个值为6的元素
INTLIST list3(list2.begin(),--list2.end());
//声明一个名为i的双向迭代器
INTLIST::iterator i;
//从前向后显示各list对象的元素
put_list(list1,"list1");
put_list(list2,"list2");
put_list(list3,"list3");
//从list1序列后面添加两个元素
list1.push_back(2);
list1.push_back(4);
cout<<"list1.push_back(2) and list1.push_back(4):"<<endl;
put_list(list1,"list1");
//从list1序列前面添加两个元素
list1.push_front(5);
list1.push_front(7);
cout<<"list1.push_front(5) and list1.push_front(7):"<<endl;
put_list(list1,"list1");
//在list1序列中间插入数据3个9
list1.insert(++list1.begin(),3,9);
cout<<"list1.insert(list1.begin(),3,9):"<<endl;
put_list(list1,"list1");
//测试引用类函数
cout<<"list1.front()="<<list1.front()<<endl;
cout<<"list1.back()="<<list1.back()<<endl;
//从list1序列的前后各移去一个元素
list1.pop_front();
list1.pop_back();
cout<<"list1.pop_front() and list1.pop_back():"<<endl;
put_list(list1,"list1");
//清除list1中的第2个元素
list1.erase(++list1.begin());
cout<<"list1.erase(++list1.begin()):"<<endl;
put_list(list1,"list1");
//对list2赋值并显示
list2.assign(8,1);
cout<<"list2.assign(8,1):"<<endl;
put_list(list2,"list2");
//显示序列的状态信息
cout<<"list1.max_size(): "<<list1.max_size()<<endl;
cout<<"list1.size(): "<<list1.size()<<endl;
cout<<"list1.empty(): "<<list1.empty()<<endl;
//list序列容器的运算
put_list(list1,"list1");
put_list(list3,"list3");
cout<<"list1>list3: "<<(list1>list3)<<endl;
cout<<"list1<list3: "<<(list1<list3)<<endl;
//对list1容器排序
list1.sort();
put_list(list1,"list1");
//结合处理
list1.splice(++list1.begin(), list3);
put_list(list1,"list1");
put_list(list3,"list3");
}
双队列(deque) 连续存储的指向不同元素的指针所组成的数组 deque
集合(set) 由节点组成的红黑树,每个节点都包含着一个元素,节点之间以某种作用于元素对的谓词排列,没有两个不同的元素能够拥有相同的次序 set
多重集合(multiset) 允许存在两个次序相等的元素的集合 set
栈(stack) 后进先出的值的排列 stack
队列(queue) 先进先出的执的排列 queue
优先队列(priority_queue) 元素的次序是由作用于所存储的值对上的某种谓词决定的的一种队列 queue
映射(map) 由{键,值}对组成的集合,以某种作用于键对上的谓词排列 map
#include <stdlib.h>
#include <windows.h>
#include <conio.h>
#include <map> //STL
#include <functional> //STL
#include <algorithm> //STL
#include <iostream>
using namespace std;
typedef map<int,int*> m_iip;
typedef map<int,char*> m_icp;
class f_c{
int _i;
public:
f_c(int i):_i(i){
}
void operator()(m_iip::value_type ite)
{
cout<<_i++<<"\t"<<ite.first<<" shi"<<endl;
}
void operator()(m_icp::value_type ite)
{
cout<<_i++<<"\t"<<ite.first<<" yang"<<endl;
}
};
void f(int i,int c)
{
}
int main(int argc,char* argv[]){
m_iip iip;
m_icp icp;
int i=0;
iip.insert(make_pair(34,&i));
iip.insert(make_pair(67,&i));
iip.insert(make_pair(5,&i));
iip.insert(make_pair(342,&i));
char d=0;
icp.insert(make_pair(12,&d));
icp.insert(make_pair(54,&d));
icp.insert(make_pair(6,&d));
icp.insert(make_pair(92,&d));
for_each(iip.begin(),iip.end(),f_c(8));
for_each(icp.begin(),icp.end(),f_c(65));//
return 0;
}
多重映射(multimap) 允许键对有相等的次序的映射 map
Iterator
下面要说的迭代器从作用上来说是最基本的部分,可是理解起来比前两者都要费力一些(至少笔者是这样)。软件设计有一个基本原则,所有的问题都可以通过引进一个间接层来简化,这种简化在STL中就是用迭代器来完成的。
概括来说,迭代器在STL中用来将算法和容器联系起来,起着一种黏和剂的作用。几乎STL提供的所有算法都是通过迭代器存取元素序列进行工作的,每一个容器都定义了其本身所专有的迭代器,用以存取容器中的元素。
迭代器部分主要由头文件 utility, iterator 和 memory 组成。
utility 是一个很小的头文件,它包括了贯穿使用在STL中的几个模板的声明,iterator 中提供了迭代器使用的许多方法,而对于 memory 的描述则十分的困难,它以不同寻常的方式为容器中的元素分配存储空间,同时也为某些算法执行期间产生的临时对象提供机制, memory中的主要部分是模板类allocator,它负责产生所有容器中的默认分配器。
对于之前不太了解STL的读者来说,上面的文字只是十分概括地描述了一下STL的框架,对您理解STL的机制乃至使用STL所起到的帮助微乎甚微,这不光是因为深入STL需要对C++的高级应用有比较全面的了解,更因为STL的三个部分算法、容器和迭代器三部分是互相牵制或者说是紧密结合的。从概念上讲最基础的部分是迭代器,可是直接学习迭代器会遇到许多抽象枯燥和繁琐的细节,然而不真正理解迭代器又是无法直接进入另两部分的学习的(至少对剖析源码来说是这样)。可以说,适应STL处理问题的方法是需要花费一定的时间的,但是以此为代价,STL取得了一种十分可贵的独立性,它通过迭代器能在尽可能少地知道某种数据结构的情况下完成对这一结构的运算,所以下决心钻研STL的朋友们千万不要被一时的困难击倒。其实STL运用的模式相对统一,只要适应了它,从一个STL工具到另一个工具,都不会有什么大的变化。
head
C++头文件一览
C、传统 C++
#include <assert.h> 设定插入点
#include <ctype.h> 字符处理
#include <errno.h> 定义错误码
#include <float.h> 浮点数处理
#include <fstream.h> 文件输入/输出
#include <iomanip.h> 参数化输入/输出
#include <iostream.h> 数据流输入/输出
#include <limits.h> 定义各种数据类型最值常量
#include <locale.h> 定义本地化函数
#include <math.h> 定义数学函数
#include <stdio.h> 定义输入/输出函数
#include <stdlib.h> 定义杂项函数及内存分配函数
#include <string.h> 字符串处理
#include <strstrea.h> 基于数组的输入/输出
#include <time.h> 定义关于时间的函数
#include <wchar.h> 宽字符处理及输入/输出
#include <wctype.h> 宽字符分类
标准 C++
#include <algorithm> 通用算法
#include <bitset> 位集容器
#include <cctype>
#include <cerrno>
#include <clocale>
#include <cmath>
#include <complex> 复数类
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque> 双端队列容器
#include <exception> 异常处理类
#include <fstream>
#include <functional> 定义运算函数(代替运算符)
#include <limits>
#include <list> 线性列表容器
#include <map> 映射容器
#include <iomanip>
#include <ios> 基本输入/输出支持
#include <iosfwd> 输入/输出系统使用的前置声明
#include <iostream>
#include <istream> 基本输入流
#include <ostream> 基本输出流
#include <queue> 队列容器
#include <set> 集合容器
#include <sstream> 基于字符串的流
#include <stack> 堆栈容器
#include <stdexcept> 标准异常类
#include <streambuf> 底层输入/输出支持
#include <string> 字符串类
#include <utility> 通用模板类
#include <vector> 动态数组容器
#include <cwchar>
#include <cwctype>
C99 增加
#include <complex.h> 复数处理
#include <fenv.h> 浮点环境
#include <inttypes.h> 整数格式转换
#include <stdbool.h> 布尔环境
#include <stdint.h> 整型环境
#include <tgmath.h> 通用类型数学宏
List
List Introduction
- Efficient insertion and removal of elements anywhere in the container (constant time).
- Efficient moving elements and block of elements within the container or even between different containers (constant time).
Iterating over the elements in forward or reverse order (linear time).
- Iterating over the elements in forward or reverse order (linear time).
双向链表是一种每个节点都有两个指针,分别直接的指向了直接前驱和直接后驱。
template < class T, class Allocator = allocator<T> > class list;
member:
http://blog.csdn.net/wallwind/article/details/6892139
Using
function usage in detail:
http://www.360doc.com/content/14/0107/09/1317564_343237392.shtml
http://www.360doc.com/content/14/0107/09/1317564_343237529.shtml
assign() 给list赋值
back() 返回最后一个元素
begin() 返回指向第一个元素的迭代器
clear() 删除所有元素
empty() 如果list是空的则返回true
end() 返回末尾的迭代器
erase() 删除一个元素
front() 返回第一个元素
get_allocator() 返回list的配置器
insert() 插入一个元素到list中
max_size() 返回list能容纳的最大元素数量
merge() 合并两个list
pop_back() 删除最后一个元素
pop_front() 删除第一个元素
push_back() 在list的末尾添加一个元素
push_front() 在list的头部添加一个元素
rbegin() 返回指向第一个元素的逆向迭代器
remove() 从list删除元素
remove_if() 按指定条件删除元素
rend() 指向list末尾的逆向迭代器
resize() 改变list的大小
reverse() 把list的元素倒转
size() 返回list中的元素个数
sort() 给list排序
splice() 合并两个list
swap() 交换两个list
unique() 删除list中重复的元素
Template Introduction
#include<iostream>
#include<list>
using namespace std;
int
main(void)
{
int arr[] = {1, 2, 3, 4, 5};
list<int> l(arr, arr + sizeof(arr)/sizeof(int));
// list::front
cout << "Thefirst element is : " << l.front() << endl;
// list::back
cout << "Thesecond element is : " << l.back() << endl;
return(0);
}
http://blog.csdn.net/zhangliang_571/article/details/26143631
http://www.cnblogs.com/rushoooooo/archive/2011/09/03/2164623.html
http://blog.sina.com.cn/s/blog_648debb00100rhgr.html
erase:
http://blog.sina.com.cn/s/blog_782496390100rtyp.html
memory allocation
没有new的 进程虚拟地址空间中的栈中分配内存,使用了new,在堆中分配了内存,而栈中内存的分配和释放是由系统管理,而堆中内存的分配和释放必须由程序员手动释放。
栈是系统数据结构,对于进程/线程是唯一的,它的分配与释放由操作系统来维护,不需要开发者来管理。在执行函数时,函数内局部变量的存储单元都可以在栈上创建,函数执行结束时,这些存储单元会被自动释放。栈内存分配运算内置于处理器的指令集中,效率很高,不同的操作系统对栈都有一定的限制。 堆上的内存分配,亦称动态内存分配。程序在运行的期间用malloc申请的内存,这部分内存由程序员自己负责管理,其生存期由开发者决定:在何时分配,分配多少,并在何时用free来释放该内存。这是唯一可以由开发者参与管理的内存。使用的好坏直接决定系统的性能和稳定。
栈是机器系统提供的数据结构,计算机会在底层对栈提供支持:分配专门的寄存器存放栈的地址,压栈出栈都有专门的指令执行,这就决定了栈的效率 比较高。堆则是C/C++函数库提供的,它的机制是很复杂的,例如为了分配一块内存,库函数会按照一定的算法(具体的算法可以参考数据结构/操作系统)在 堆内存中搜索可用的足够大小的空间,如果没有足够大小的空间(可能是由于内存碎片太多),就有可能调用系统功能去增加程序数据段的内存空间,这样就有机会 分 到足够大小的内存,然后进行返回。显然,堆的效率比栈要低得多。
http://zhidao.baidu.com/link?url=H1qujvB9llIwZysgBa7frrFh0OwGNghXD3zVqStIYeTfpPyK448-7XPVrWDq1btd1TaM4UGeNIePvurBOfNX8Lkh7TNcRstkBDzsguqjLIe
http://www.cnblogs.com/Code-life/archive/2009/12/06/1618014.html
http://blog.163.com/shayne_chu/blog/static/167097832201062562723206/
http://www.cnblogs.com/GODYCA/archive/2013/01/10/2854777.html
http://blog.163.com/shayne_chu/blog/static/167097832201062562723206/
example
declaration:
/// list template
template< class C >
class TComList : public std::list< C >
{
public:
typedef typename std::list<C>::iterator TComIterator;
TComList& operator += ( const TComList& rcTComList)
{
if( ! rcTComList.empty() )
{
insert( this->end(), rcTComList.begin(), rcTComList.end());
}
return *this;
} // leszek
C popBack()
{
C cT = this->back();
this->pop_back();
return cT;
}
C popFront()
{
C cT = this->front();
this->pop_front();
return cT;
}
Void pushBack( const C& rcT )
{
/*assert( sizeof(C) == 4);*/
if( rcT != NULL )
{
this->push_back( rcT);
}
}
Void pushFront( const C& rcT )
{
/*assert( sizeof(C) == 4);*/
if( rcT != NULL )
{
this->push_front( rcT);
}
}
TComIterator find( const C& rcT ) // leszek
{
return find( this->begin(), this->end(), rcT );
}
};
/// picture class (symbol + YUV buffers)
class TComPic
{
public:
UInt m_uiTLayer; // Temporal layer
Bool m_bUsedByCurr; // Used by current picture
Bool m_bIsLongTerm; // IS long term picture
Bool m_bIsDecoded; // IS the Pic decode end
TComPicSym* m_apcPicSym; // Symbol
TComPicYuv* m_apcPicYuv[2]; // Texture, 0:org / 1:rec
TComPicYuv* m_pcPicYuvPred; // Prediction
TComPicYuv* m_pcPicYuvResi; // Residual
Bool m_bReconstructed;
Bool m_bNeededForOutput;
UInt m_uiCurrSliceIdx; // Index of current slice
Int* m_pSliceSUMap;
Bool* m_pbValidSlice;
Int m_sliceGranularityForNDBFilter;
Bool m_bIndependentSliceBoundaryForNDBFilter;
Bool m_bIndependentTileBoundaryForNDBFilter;
TComPicYuv* m_pNDBFilterYuvTmp; //!< temporary picture buffer when non-cross slice/tile boundary in-loop filtering is enabled
Bool m_bCheckLTMSB;
Int m_numReorderPics[MAX_TLAYER];
Window m_conformanceWindow;
Window m_defaultDisplayWindow;
bool m_isTop;
bool m_isField;
std::vector<std::vector<TComDataCU*> > m_vSliceCUDataLink;
SEIMessages m_SEIs; ///< Any SEI messages that have been received. If !NULL we own the object.
Int idx;
public:
TComPic();
virtual ~TComPic();
Void create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
Int *numReorderPics, Bool bIsVirtual = false );
virtual Void destroy();
void setIdx(Int s) { idx=s; }
Int getIdx() { return idx; }
UInt getTLayer() { return m_uiTLayer; }
Void setTLayer( UInt uiTLayer ) { m_uiTLayer = uiTLayer; }
Void setDecoded(Bool b) { m_bIsDecoded = b; }
Bool getDecoded() { return m_bIsDecoded;}
Bool getUsedByCurr() { return m_bUsedByCurr; }
Void setUsedByCurr( Bool bUsed ) { m_bUsedByCurr = bUsed; }
Bool getIsLongTerm() { return m_bIsLongTerm; }
Void setIsLongTerm( Bool lt ) { m_bIsLongTerm = lt; }
Void setCheckLTMSBPresent (Bool b ) {m_bCheckLTMSB=b;}
Bool getCheckLTMSBPresent () { return m_bCheckLTMSB;}
TComPicSym* getPicSym() { return m_apcPicSym; }
TComSlice* getSlice(Int i) { return m_apcPicSym->getSlice(i); }
Int getPOC() { return m_apcPicSym->getSlice(m_uiCurrSliceIdx)->getPOC(); }
TComDataCU*& getCU( UInt uiCUAddr )
{
return m_apcPicSym->getCU( uiCUAddr );
}
TComDataCU_hm* getCU_hm( UInt uiCUAddr ) { return NULL; }
TComPicYuv* getPicYuvOrg() { return m_apcPicYuv[0]; }
TComPicYuv* getPicYuvRec() { return m_apcPicYuv[1]; }
TComPicYuv* getPicYuvPred() { return m_pcPicYuvPred; }
TComPicYuv* getPicYuvResi() { return m_pcPicYuvResi; }
Void setPicYuvPred( TComPicYuv* pcPicYuv ) { m_pcPicYuvPred = pcPicYuv; }
Void setPicYuvResi( TComPicYuv* pcPicYuv ) { m_pcPicYuvResi = pcPicYuv; }
UInt getNumCUsInFrame() { return m_apcPicSym->getNumberOfCUsInFrame(); }
UInt getNumPartInWidth() { return m_apcPicSym->getNumPartInWidth(); }
UInt getNumPartInHeight() { return m_apcPicSym->getNumPartInHeight(); }
UInt getNumPartInCU() { return m_apcPicSym->getNumPartition(); }
UInt getFrameWidthInCU() { return m_apcPicSym->getFrameWidthInCU(); }
UInt getFrameHeightInCU() { return m_apcPicSym->getFrameHeightInCU(); }
UInt getMinCUWidth() { return m_apcPicSym->getMinCUWidth(); }
UInt getMinCUHeight() { return m_apcPicSym->getMinCUHeight(); }
UInt getParPelX(UChar uhPartIdx) { return getParPelX(uhPartIdx); }
UInt getParPelY(UChar uhPartIdx) { return getParPelX(uhPartIdx); }
Int getStride() { return m_apcPicYuv[1]->getStride(); }
Int getCStride() { return m_apcPicYuv[1]->getCStride(); }
Void setReconMark (Bool b) { m_bReconstructed = b; }
Bool getReconMark () { return m_bReconstructed; }
Void setOutputMark (Bool b) { m_bNeededForOutput = b; }
Bool getOutputMark () { return m_bNeededForOutput; }
Void setNumReorderPics(Int i, UInt tlayer) { m_numReorderPics[tlayer] = i; }
Int getNumReorderPics(UInt tlayer) { return m_numReorderPics[tlayer]; }
Void compressMotion();
UInt getCurrSliceIdx() { return m_uiCurrSliceIdx; }
Void setCurrSliceIdx(UInt i) { m_uiCurrSliceIdx = i; }
UInt getNumAllocatedSlice() {return m_apcPicSym->getNumAllocatedSlice();}
Void allocateNewSlice() {m_apcPicSym->allocateNewSlice(); }
Void clearSliceBuffer() {m_apcPicSym->clearSliceBuffer(); }
Window& getConformanceWindow() { return m_conformanceWindow; }
Window& getDefDisplayWindow() { return m_defaultDisplayWindow; }
Void createNonDBFilterInfo (std::vector<Int> sliceStartAddress, Int sliceGranularityDepth
,std::vector<Bool>* LFCrossSliceBoundary
,Int numTiles = 1
,Bool bNDBFilterCrossTileBoundary = true);
Void createNonDBFilterInfoLCU(Int tileID, Int sliceID, TComDataCU* pcCU, UInt startSU, UInt endSU, Int sliceGranularyDepth, UInt picWidth, UInt picHeight);
Void destroyNonDBFilterInfo();
Bool getValidSlice (Int sliceID) {return m_pbValidSlice[sliceID];}
Bool getIndependentSliceBoundaryForNDBFilter () {return m_bIndependentSliceBoundaryForNDBFilter;}
Bool getIndependentTileBoundaryForNDBFilter () {return m_bIndependentTileBoundaryForNDBFilter; }
TComPicYuv* getYuvPicBufferForIndependentBoundaryProcessing() {return m_pNDBFilterYuvTmp;}
std::vector<TComDataCU*>& getOneSliceCUDataForNDBFilter (Int sliceID) { return m_vSliceCUDataLink[sliceID];}
/* field coding parameters*/
Void setTopField(bool b) {m_isTop = b;}
bool isTopField() {return m_isTop;}
Void setField(bool b) {m_isField = b;}
bool isField() {return m_isField;}
/** transfer ownership of seis to this picture */
void setSEIs(SEIMessages& seis) { m_SEIs = seis; }
/**
* return the current list of SEI messages associated with this picture.
* Pointer is valid until this->destroy() is called */
SEIMessages& getSEIs() { return m_SEIs; }
/**
* return the current list of SEI messages associated with this picture.
* Pointer is valid until this->destroy() is called */
const SEIMessages& getSEIs() const { return m_SEIs; }
};// END CLASS DEFINITION TComPic
definition:
TComList<TComPic*>* pcListPic = NULL;