Ignore:
Timestamp:
01/08/06 16:35:04 (6 years ago)
Author:
pfp
Message:

Added ability to do compression.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/applications/NXtranslate/node.cpp

    r683 r800  
    167167} 
    168168 
     169const std::vector<int> Node::comp_buffer_dims() const{ 
     170  return __comp_buffer_dims; 
     171} 
     172 
    169173void* Node::data() const{ 
    170174  return __value; 
     
    202206    throw out_of_range("asked for attribute with higher index than size"); 
    203207  return (*(__attrs.begin()+attr_num)); 
     208} 
     209 
     210const void Node::set_comp(const string &comp_type){ 
     211  if(string_util::starts_with(comp_type,"NONE")){ 
     212    __comp_type=COMP_NONE; 
     213  }else if(string_util::starts_with(comp_type,"LZW")){ 
     214    __comp_type=COMP_LZW; 
     215  }else if(string_util::starts_with(comp_type,"RLE")){ 
     216    __comp_type=COMP_RLE; 
     217  }else if(string_util::starts_with(comp_type,"HUF")){ 
     218    __comp_type=COMP_HUF; 
     219  }else{ 
     220    throw invalid_argument("Do not understand compression type: "+comp_type); 
     221  } 
     222 
     223  // work with user specified dimension information 
     224  vector<string> temp=string_util::split(comp_type,":"); 
     225  if(temp.size()==2){ 
     226    __comp_buffer_dims=string_util::str_to_intVec(*(temp.rbegin())); 
     227  } 
     228 
     229  // use default if anything is wrong 
     230  if(__comp_buffer_dims.size()!=__dims.size()){ 
     231    __comp_buffer_dims=__dims; 
     232    for( size_t i=0 ; i<__comp_buffer_dims.size()-1 ; ++i ){ 
     233      __comp_buffer_dims[i]=1; 
     234    } 
     235  } 
    204236} 
    205237 
Note: See TracChangeset for help on using the changeset viewer.