Beispiel #1
0
void SEPtrDict::detach()
{
        if (0 == d)
                return;

        if (1 == d->ref)
                return;

        Data* d_new = new Data();

        d_new->ref = 1;

        size_t n;
        for (n = 0; n < SIZE; n++)
                d_new->dict[n] = 0;

        for (n = 0; n < SIZE; n++) {
                Element** from = &(d->dict[n]);
                Element** to = &(d_new->dict[n]);

                while (*from) {
                        *to = new Element((*from)->key, (*from)->value);

                        from = &((*from)->next);
                        to = &((*to)->next);
                }
        }

        d_unref();

        d = d_new;
}
SERefList& SERefList::operator=(const SERefList& sl)
{
    d_unref();

    d = sl.d;

    d_ref();

    return *this;
}
Beispiel #3
0
SEPtrDict& SEPtrDict::operator=(const SEPtrDict& dict)
{
        const_cast<SEPtrDict&>(dict).d_ref();

        d_unref();

        d = dict.d;

        return *this;
}
Beispiel #4
0
SEIntList& SEIntList::operator=(const SEIntList& sl)
{
        const_cast<SEIntList&>(sl).d_ref();

        d_unref();

        d = sl.d;

        return *this;
}
void SERefList::detach()
{
    if (0 == d)
        return;

    d->lock.Acquire();

    if (1 != d->ref) {

        Data* d_new = new Data();

        d_new->ref = 1;
        d_new->dirty = true;
        d_new->quick_list = 0;

        d_new->list = new Element;
        d_new->list->reference = d->list->reference;

        Element* from = d->list->next;
        Element* to = d_new->list;

        while (from) {
            to->next = new Element;
            to->next->reference = from->reference;

            to = to->next;
            from = from->next;
        }

        d_new->last = to;

        d->lock.Release();

        d_unref();

        d = d_new;

        return;
    }

    d->lock.Release();
}
void SEObjDict::detach()
{
    if (0 == d)
        return;

    d->lock.Acquire();

    if (1 != d->ref) {

        Data* d_new = new Data();

        d_new->ref = 1;

        size_t n;
        for (n = 0; n < SIZE; n++)
            d_new->dict[n] = 0;

        for (n = 0; n < SIZE; n++) {
            Element** from = &(d->dict[n]);
            Element** to = &(d_new->dict[n]);

            while (*from) {
                *to = new Element((*from)->key, (*from)->value);

                from = &((*from)->next);
                to = &((*to)->next);
            }
        }

        d->lock.Release();

        d_unref();

        d = d_new;

        return;
    }

    d->lock.Release();
}
Beispiel #7
0
SEPtrDict::~SEPtrDict()
{
        d_unref();
}
SEObjDict::~SEObjDict()
{
    d_unref();
}
SERefList::~SERefList()
{
    d_unref();
}
Beispiel #10
0
SEIntList::~SEIntList()
{
        d_unref();
}
SEStringList::~SEStringList()
{
    d_unref();
}