Ignore:
Timestamp:
Nov 22, 2017, 3:32:58 PM (19 months ago)
Author:
nmedfort
Message:

Improvements to memory usage of CCs

Location:
icGREP/icgrep-devel/icgrep/re
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/re/re_cc.cpp

    r5673 r5742  
    1111
    1212namespace re {
    13 
    14 CC::CC(const CC * cc1, const CC * cc2)
    15 : RE(ClassTypeId::CC)
    16 , UCD::UnicodeSet(std::move(*cc1 + *cc2)) {
    17 
    18 }
    19 
    20 CC::CC(const CC & cc)
    21 : RE(ClassTypeId::CC)
    22 , UCD::UnicodeSet(cc) {
    23 
    24 }
    2513
    2614std::string CC::canonicalName(const CC_type type) const {
     
    5341    return cci;
    5442}
    55    
     43
     44CC::CC()
     45: RE(ClassTypeId::CC), UnicodeSet() {
     46
    5647}
     48
     49CC::CC(const CC & cc)
     50: RE(ClassTypeId::CC)
     51, UCD::UnicodeSet(cc) {
     52
     53}
     54
     55CC::CC(const codepoint_t codepoint)
     56: RE(ClassTypeId::CC)
     57, UCD::UnicodeSet(codepoint, mAllocator) {
     58
     59}
     60
     61CC::CC(const codepoint_t lo_codepoint, const codepoint_t hi_codepoint)
     62: RE(ClassTypeId::CC)
     63, UCD::UnicodeSet(lo_codepoint, hi_codepoint, mAllocator) {
     64
     65}
     66
     67CC::CC(const CC * cc1, const CC * cc2)
     68: RE(ClassTypeId::CC)
     69, UCD::UnicodeSet(std::move(*cc1 + *cc2)) {
     70
     71}
     72
     73CC::CC(UCD::UnicodeSet && set)
     74: RE(ClassTypeId::CC)
     75, UCD::UnicodeSet(std::move(set), mAllocator) {
     76
     77}
     78
     79CC::CC(std::initializer_list<interval_t>::iterator begin, std::initializer_list<interval_t>::iterator end)
     80: RE(ClassTypeId::CC)
     81, UCD::UnicodeSet(begin, end, mAllocator)
     82{
     83
     84}
     85
     86CC::CC(const std::vector<interval_t>::iterator begin, const std::vector<interval_t>::iterator end)
     87: RE(ClassTypeId::CC)
     88, UCD::UnicodeSet(begin, end, mAllocator)
     89{
     90
     91}
     92
     93}
  • icGREP/icgrep-devel/icgrep/re/re_cc.h

    r5649 r5742  
    5252    friend CC * intersectCC(const CC * a, const CC * b);
    5353
    54     inline CC()
    55     : RE(ClassTypeId::CC), UnicodeSet() {
    56 
    57     }
     54    CC();
    5855
    5956    CC(const CC & cc);
    6057
    61     inline CC(const codepoint_t codepoint)
    62     : RE(ClassTypeId::CC)
    63     , UCD::UnicodeSet(codepoint) {
     58    CC(const codepoint_t codepoint);
    6459
    65     }
     60    explicit CC(const codepoint_t lo_codepoint, const codepoint_t hi_codepoint);
    6661
    67     inline CC(const codepoint_t lo_codepoint, const codepoint_t hi_codepoint)
    68     : RE(ClassTypeId::CC)
    69     , UCD::UnicodeSet(lo_codepoint, hi_codepoint) {
     62    explicit CC(const CC * cc1, const CC * cc2);
    7063
    71     }
     64    CC(UCD::UnicodeSet && set);
    7265
    73     CC(const CC * cc1, const CC * cc2);
     66    CC(std::initializer_list<interval_t>::iterator begin, std::initializer_list<interval_t>::iterator end);
    7467
    75     inline CC(UCD::UnicodeSet && set)
    76     : RE(ClassTypeId::CC)
    77     , UCD::UnicodeSet(std::move(set)) {
    78 
    79     }
    80 
    81     CC(std::initializer_list<interval_t>::iterator begin, std::initializer_list<interval_t>::iterator end)
    82     : RE(ClassTypeId::CC)
    83     , UCD::UnicodeSet(begin, end)
    84     {
    85 
    86     }
    87 
    88     CC(const std::vector<interval_t>::iterator begin, const std::vector<interval_t>::iterator end)
    89     : RE(ClassTypeId::CC)
    90     , UCD::UnicodeSet(begin, end)
    91     {
    92 
    93     }
     68    CC(const std::vector<interval_t>::iterator begin, const std::vector<interval_t>::iterator end);
    9469
    9570};
  • icGREP/icgrep-devel/icgrep/re/re_re.h

    r5630 r5742  
    3535    inline ClassTypeId getClassTypeId() const {
    3636        return mClassTypeId;
     37    }
     38    inline static void Reset() {
     39        mAllocator.Reset();
    3740    }
    3841    typedef std::initializer_list<RE *> InitializerList;
Note: See TracChangeset for help on using the changeset viewer.