<commit_before>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: rtl_OUStringBuffer2.cxx,v $
 *
 *  $Revision: 1.3 $
 *
 *  last change: $Author: obo $ $Date: 2006-09-17 08:58:39 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/

// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sal.hxx"
#include <cppunit/simpleheader.hxx>
#include "stringhelper.hxx"
#include <rtl/ustrbuf.hxx>
#include <rtl/uri.hxx>

namespace rtl_OUStringBuffer
{

class insertUtf32 : public CppUnit::TestFixture
{
public:
    // initialise your test code values here.
    void setUp()
    {
    }

    void tearDown()
    {
    }

    void insertUtf32_001()
        {
            ::rtl::OUStringBuffer aUStrBuf(4);
            aUStrBuf.insertUtf32(0,0x10ffff);

            rtl::OUString suStr = aUStrBuf.makeStringAndClear();
            rtl::OUString suStr2 = rtl::Uri::encode(suStr, rtl_UriCharClassUnoParamValue, rtl_UriEncodeKeepEscapes, RTL_TEXTENCODING_UTF8);

            rtl::OString sStr;
            sStr <<= suStr2;
            t_print("%s\n", sStr.getStr());

            CPPUNIT_ASSERT_MESSAGE("Strings must be '%F4%8F%BF%BF'", sStr.equals(rtl::OString("%F4%8F%BF%BF")) == sal_True);
        }

    void insertUtf32_002()
        {
            ::rtl::OUStringBuffer aUStrBuf(4);
            aUStrBuf.insertUtf32(0,0x41);
            aUStrBuf.insertUtf32(1,0x42);
            aUStrBuf.insertUtf32(2,0x43);

            rtl::OUString suStr = aUStrBuf.makeStringAndClear();
            rtl::OUString suStr2 = rtl::Uri::encode(suStr, rtl_UriCharClassUnoParamValue, rtl_UriEncodeKeepEscapes, RTL_TEXTENCODING_UTF8);

            rtl::OString sStr;
            sStr <<= suStr2;
            t_print("%s\n", sStr.getStr());

            CPPUNIT_ASSERT_MESSAGE("Strings must be 'ABC'", sStr.equals(rtl::OString("ABC")) == sal_True);
        }

    CPPUNIT_TEST_SUITE(insertUtf32);
    CPPUNIT_TEST(insertUtf32_001);
    CPPUNIT_TEST(insertUtf32_002);
    CPPUNIT_TEST_SUITE_END();
}; // class getToken

// -----------------------------------------------------------------------------
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OUStringBuffer::insertUtf32, "rtl_OUStringBuffer");

} // namespace rtl_OUStringBuffer

// -----------------------------------------------------------------------------

// this macro creates an empty function, which will called by the RegisterAllFunctions()
// to let the user the possibility to also register some functions by hand.
NOADDITIONAL;

<commit_msg>INTEGRATION: CWS changefileheader (1.3.234); FILE MERGED 2008/03/31 13:23:56 rt 1.3.234.1: #i87441# Change license header to LPGL v3.<commit_after>/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2008 by Sun Microsystems, Inc.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * $RCSfile: rtl_OUStringBuffer2.cxx,v $
 * $Revision: 1.4 $
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/

// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sal.hxx"
#include <cppunit/simpleheader.hxx>
#include "stringhelper.hxx"
#include <rtl/ustrbuf.hxx>
#include <rtl/uri.hxx>

namespace rtl_OUStringBuffer
{

class insertUtf32 : public CppUnit::TestFixture
{
public:
    // initialise your test code values here.
    void setUp()
    {
    }

    void tearDown()
    {
    }

    void insertUtf32_001()
        {
            ::rtl::OUStringBuffer aUStrBuf(4);
            aUStrBuf.insertUtf32(0,0x10ffff);

            rtl::OUString suStr = aUStrBuf.makeStringAndClear();
            rtl::OUString suStr2 = rtl::Uri::encode(suStr, rtl_UriCharClassUnoParamValue, rtl_UriEncodeKeepEscapes, RTL_TEXTENCODING_UTF8);

            rtl::OString sStr;
            sStr <<= suStr2;
            t_print("%s\n", sStr.getStr());

            CPPUNIT_ASSERT_MESSAGE("Strings must be '%F4%8F%BF%BF'", sStr.equals(rtl::OString("%F4%8F%BF%BF")) == sal_True);
        }

    void insertUtf32_002()
        {
            ::rtl::OUStringBuffer aUStrBuf(4);
            aUStrBuf.insertUtf32(0,0x41);
            aUStrBuf.insertUtf32(1,0x42);
            aUStrBuf.insertUtf32(2,0x43);

            rtl::OUString suStr = aUStrBuf.makeStringAndClear();
            rtl::OUString suStr2 = rtl::Uri::encode(suStr, rtl_UriCharClassUnoParamValue, rtl_UriEncodeKeepEscapes, RTL_TEXTENCODING_UTF8);

            rtl::OString sStr;
            sStr <<= suStr2;
            t_print("%s\n", sStr.getStr());

            CPPUNIT_ASSERT_MESSAGE("Strings must be 'ABC'", sStr.equals(rtl::OString("ABC")) == sal_True);
        }

    CPPUNIT_TEST_SUITE(insertUtf32);
    CPPUNIT_TEST(insertUtf32_001);
    CPPUNIT_TEST(insertUtf32_002);
    CPPUNIT_TEST_SUITE_END();
}; // class getToken

// -----------------------------------------------------------------------------
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OUStringBuffer::insertUtf32, "rtl_OUStringBuffer");

} // namespace rtl_OUStringBuffer

// -----------------------------------------------------------------------------

// this macro creates an empty function, which will called by the RegisterAllFunctions()
// to let the user the possibility to also register some functions by hand.
NOADDITIONAL;

<|endoftext|>


<commit_before>/*****************************************************************************
 *
 * This file is part of Mapnik (c++ mapping toolkit)
 *
 * Copyright (C) 2015 Artem Pavlenko
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *****************************************************************************/

// mapnik
#include <mapnik/json/geometry_generator_grammar.hpp>
#include <mapnik/util/spirit_transform_attribute.hpp>

// boost
#include <boost/spirit/include/karma.hpp>
#include <boost/spirit/include/phoenix.hpp>
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_fusion.hpp>
#include <boost/fusion/include/at.hpp>

namespace mapnik { namespace json {

namespace karma = boost::spirit::karma;
namespace phoenix = boost::phoenix;

template <typename OutputIterator, typename Geometry>
geometry_generator_grammar<OutputIterator, Geometry>::geometry_generator_grammar()
    : geometry_generator_grammar::base_type(geometry)
{
    boost::spirit::karma::_val_type _val;
    boost::spirit::karma::_1_type _1;
    boost::spirit::karma::_a_type _a;
    boost::spirit::karma::lit_type lit;
    boost::spirit::karma::uint_type uint_;
    boost::spirit::karma::eps_type eps;

    geometry = geometry_dispatch.alias()
        ;

    geometry_dispatch = eps[_a = geometry_type(_val)] <<
        (&uint_(new_geometry::geometry_types::Point)[_1 = _a]
         << (point | lit("null")))
        |
        (&uint_(new_geometry::geometry_types::LineString)[_1 = _a]
         << (linestring | lit("null")))
        |
        (&uint_(new_geometry::geometry_types::Polygon)[_1 = _a]
         << (polygon | lit("null")))
        |
        (&uint_(new_geometry::geometry_types::MultiPoint)[_1 = _a]
         << (multi_point | lit("null")))
        |
        (&uint_(new_geometry::geometry_types::MultiLineString)[_1 = _a]
         << (multi_linestring | lit("null")))
        |
        (&uint_(new_geometry::geometry_types::MultiPolygon)[_1 = _a]
         << (multi_polygon | lit("null")))
         |
        (&uint_(new_geometry::geometry_types::GeometryCollection)[_1 = _a]
         << (geometry_collection | lit("null")))
        ;

    point = lit("{\"type\":\"Point\",\"coordinates\":") << point_coord << lit("}")
        ;
    linestring = lit("{\"type\":\"LineString\",\"coordinates\":[") << linestring_coord << lit("]}")
        ;
    polygon = lit("{\"type\":\"Polygon\",\"coordinates\":[") << polygon_coord << lit("]}")
        ;
    multi_point = lit("{\"type\":\"MultiPoint\",\"coordinates\":[") << multi_point_coord << lit("]}")
        ;
    multi_linestring = lit("{\"type\":\"MultiLineString\",\"coordinates\":[") << multi_linestring_coord << lit("]}")
        ;
    multi_polygon = lit("{\"type\":\"MultiPolygon\",\"coordinates\":[") << multi_polygon_coord << lit("]}")
        ;
    geometry_collection = lit("{\"type\":\"GeometryCollection\",\"geometries\":[") << geometries  << lit("]}")
        ;
    point_coord = lit('[') << coordinate << lit(',') << coordinate  << lit(']')
        ;
    linestring_coord = point_coord % lit(',')
        ;
    polygon_coord = lit('[') << exterior_ring_coord << lit(']') << interior_ring_coord
        ;
    exterior_ring_coord = linestring_coord.alias()
        ;
    interior_ring_coord =  *(lit(",[") << exterior_ring_coord << lit(']'))
        ;
    multi_point_coord = linestring_coord.alias()
        ;
    multi_linestring_coord = (lit('[') << linestring_coord << lit(']')) % lit(',')
        ;
    multi_polygon_coord = (lit('[') << polygon_coord << lit(']')) % lit(',')
        ;
    geometries =  geometry % lit(',')
        ;
}

}}
<commit_msg>json geometry generator - output "null" for uninitialised geometry<commit_after>/*****************************************************************************
 *
 * This file is part of Mapnik (c++ mapping toolkit)
 *
 * Copyright (C) 2015 Artem Pavlenko
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *****************************************************************************/

// mapnik
#include <mapnik/json/geometry_generator_grammar.hpp>
#include <mapnik/util/spirit_transform_attribute.hpp>

// boost
#include <boost/spirit/include/karma.hpp>
#include <boost/spirit/include/phoenix.hpp>
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_fusion.hpp>
#include <boost/fusion/include/at.hpp>

namespace mapnik { namespace json {

namespace karma = boost::spirit::karma;
namespace phoenix = boost::phoenix;

template <typename OutputIterator, typename Geometry>
geometry_generator_grammar<OutputIterator, Geometry>::geometry_generator_grammar()
    : geometry_generator_grammar::base_type(geometry)
{
    boost::spirit::karma::_val_type _val;
    boost::spirit::karma::_1_type _1;
    boost::spirit::karma::_a_type _a;
    boost::spirit::karma::lit_type lit;
    boost::spirit::karma::uint_type uint_;
    boost::spirit::karma::eps_type eps;

    geometry = geometry_dispatch.alias()
        ;

    geometry_dispatch = eps[_a = geometry_type(_val)] <<
        (&uint_(new_geometry::geometry_types::Point)[_1 = _a]
         << (point | lit("null")))
        |
        (&uint_(new_geometry::geometry_types::LineString)[_1 = _a]
         << (linestring | lit("null")))
        |
        (&uint_(new_geometry::geometry_types::Polygon)[_1 = _a]
         << (polygon | lit("null")))
        |
        (&uint_(new_geometry::geometry_types::MultiPoint)[_1 = _a]
         << (multi_point | lit("null")))
        |
        (&uint_(new_geometry::geometry_types::MultiLineString)[_1 = _a]
         << (multi_linestring | lit("null")))
        |
        (&uint_(new_geometry::geometry_types::MultiPolygon)[_1 = _a]
         << (multi_polygon | lit("null")))
        |
        (&uint_(new_geometry::geometry_types::GeometryCollection)[_1 = _a]
         << (geometry_collection | lit("null")))
        |
        lit("null")
        ;

    point = lit("{\"type\":\"Point\",\"coordinates\":") << point_coord << lit("}")
        ;
    linestring = lit("{\"type\":\"LineString\",\"coordinates\":[") << linestring_coord << lit("]}")
        ;
    polygon = lit("{\"type\":\"Polygon\",\"coordinates\":[") << polygon_coord << lit("]}")
        ;
    multi_point = lit("{\"type\":\"MultiPoint\",\"coordinates\":[") << multi_point_coord << lit("]}")
        ;
    multi_linestring = lit("{\"type\":\"MultiLineString\",\"coordinates\":[") << multi_linestring_coord << lit("]}")
        ;
    multi_polygon = lit("{\"type\":\"MultiPolygon\",\"coordinates\":[") << multi_polygon_coord << lit("]}")
        ;
    geometry_collection = lit("{\"type\":\"GeometryCollection\",\"geometries\":[") << geometries  << lit("]}")
        ;
    point_coord = lit('[') << coordinate << lit(',') << coordinate  << lit(']')
        ;
    linestring_coord = point_coord % lit(',')
        ;
    polygon_coord = lit('[') << exterior_ring_coord << lit(']') << interior_ring_coord
        ;
    exterior_ring_coord = linestring_coord.alias()
        ;
    interior_ring_coord =  *(lit(",[") << exterior_ring_coord << lit(']'))
        ;
    multi_point_coord = linestring_coord.alias()
        ;
    multi_linestring_coord = (lit('[') << linestring_coord << lit(']')) % lit(',')
        ;
    multi_polygon_coord = (lit('[') << polygon_coord << lit(']')) % lit(',')
        ;
    geometries =  geometry % lit(',')
        ;
}

}}
<|endoftext|>


<commit_before>/*
 *  @file   TopKItemEstimation.hpp
 *  @author Kuilong Liu
 *  @date   2013.04.24
 *  @       TopKItem by count min sketch
 */
#ifndef IZENELIB_UTIL_TOPKITEM_ESTIMATION_H_
#define IZENELIB_UTIL_TOPKITEM_ESTIMATION_H_

#include <list>
#include <iterator>
#include <iostream>
#include <boost/unordered_map.hpp>
#include <boost/shared_ptr.hpp>

namespace izenelib { namespace util {

template<typename ElemType, typename CountType>
class Bucket;

template<typename ElemType, typename CountType>
class Item
{
public:
    typedef Bucket<ElemType, CountType> BucketT;
    typedef Item<ElemType, CountType> ItemT;

    Item(ElemType e, BucketT* b, ItemT* p, ItemT* n)
        :elem_(e), b_(b), prev_(p), next_(n)
    {
    }
    ~Item()
    {
        b_ = NULL;
        if(next_)delete next_;
    }

    ElemType elem_;
    BucketT* b_;
    ItemT* prev_;
    ItemT* next_;
};

template<typename ElemType, typename CountType>
class Bucket
{
public:
    typedef Item<ElemType, CountType> ItemT;
    typedef Bucket<ElemType, CountType> BucketT;
    Bucket(CountType c, BucketT* p, BucketT* n)
        :size_(0), c_(c), head_(NULL), end_(NULL), prev_(p), next_(n)
    {
    }
    ~Bucket()
    {
        if(head_)delete head_;
        if(next_)delete next_;
    }

    bool insert(ItemT* i)
    {
        if(size_==0)
        {
            head_=end_=i;
            i->prev_=NULL;
        }
        else
        {
            end_->next_=i;
            i->prev_=end_;
            end_=i;
        }
        i->b_=this;
        i->next_=NULL;
        size_++;
        return true;
    }

    bool erase(ItemT* i)
    {
        if(size_==1)
        {
            head_=end_=NULL;
        }
        else if(i->next_==NULL)
        {
            end_=end_->prev_;
            end_->next_=NULL;
        }
        else if(i->prev_==NULL)
        {
            head_=i->next_;
            head_->prev_=NULL;
        }
        else
        {
            i->prev_->next_=i->next_;
            i->next_->prev_=i->prev_;
        }
        size_--;
        i->prev_=i->next_=NULL;
        i->b_=NULL;
        return true;
    }
    CountType size_;
    CountType c_;
    ItemT* head_;
    ItemT* end_;
    BucketT* prev_;
    BucketT* next_;
};

template<typename ElemType, typename CountType>
class TopKEstimation
{
public:
    typedef Bucket<ElemType, CountType> BucketT;
    typedef Item<ElemType, CountType> ItemT;

    TopKEstimation(CountType m)
        :MAXSIZE_(m),
        size_(0),
        th_(0)
    {
        bs_ = new BucketT(0, NULL, NULL);
    }

    ~TopKEstimation()
    {
        if(bs_)delete bs_;
        gps_.clear();
    }

    bool reset()
    {
        if(bs_->next_) delete bs_->next_;
        gps_.clear();
        size_=th_=0;
        return true;
    }
    bool insert(ElemType elem, CountType count)
    {
        if(gps_.find(elem) != gps_.end())
        {
            return update(elem, count);
        }
        else if(size_ >= MAXSIZE_ && count <= th_)
            return true;
        else if(size_ >= MAXSIZE_)
        {
            return replace(elem, count);
        }
        else
        {
            return additem(elem, count);
        }
    }

    bool get(std::list<ElemType>& elem, std::list<CountType>& count)
    {
        BucketT* bp = bs_->next_;
        while(bp)
        {
            ItemT* i=bp->head_;
            while(i)
            {
                elem.push_back(i->elem_);
                count.push_back(i->b_->c_);
                i=i->next_;
            }
            bp=bp->next_;
        }
        return true;
    }
    bool get(std::list<std::pair<ElemType, CountType> >& topk)
    {
        BucketT* bp = bs_->next_;
        while(bp)
        {
            ItemT* i=bp->head_;
            while(i)
            {
                topk.push_back(make_pair(i->elem_, i->b_->c_));
                i=i->next_;
            }
            bp=bp->next_;
        }
        return true;
    }
private:
    bool update(ElemType elem, CountType count)
    {
        ItemT* i = gps_[elem];
        BucketT* bp = i->b_;
        count = bp->c_+1;

        if(bp->size_==1 && (!(bp->next_) || bp->next_->c_ > count))
        {
            bp->c_++;
            th_ = bs_->next_->c_;
            return true;
        }

        bp->erase(i);
        if(!(bp->next_))
            bp->next_=new BucketT(count, bp, NULL);
        else if(bp->next_->c_ > count)
        {
            BucketT* tp=new BucketT(count, bp, bp->next_);
            bp->next_=tp;
            tp->next_->prev_=tp;
        }
        bp->next_->insert(i);

        if(bp->size_==0)
        {
            bp->prev_->next_=bp->next_;
            bp->next_->prev_=bp->prev_;
            bp->next_=bp->prev_=NULL;
            delete bp;
        }
        return true;
    }
    bool replace(ElemType elem, CountType count)
    {
        count = bs_->next_->c_+1;
        ItemT* i = bs_->next_->end_;
        gps_.erase(gps_.find(i->elem_));
        gps_[elem] = i;
        i->elem_=elem;
        return update(elem,count);
    }
    bool additem(ElemType elem, CountType count)
    {
        count=1;
        if(bs_->next_==NULL)
        {
            bs_->next_=new BucketT(count, bs_, NULL);
        }

        BucketT* bp=bs_->next_;
        ItemT* i=new ItemT(elem, bp, NULL, NULL);

        if(bp->c_ == count)
        {
            bp->insert(i);
        }
        else
        {
            BucketT* nbp = new BucketT(count, bs_, bs_->next_);
            bs_->next_ = nbp;
            nbp->next_->prev_=nbp;
            nbp->insert(i);
        }

        size_++;
        gps_[elem]=i;
        th_=bs_->next_->c_;
        return true;
    }

    CountType MAXSIZE_;
    //current size
    CountType size_;
    //threshold
    CountType th_;
    BucketT* bs_;
    boost::unordered_map<ElemType, ItemT* > gps_;
};

} //end of namespace util
} //end of namespace izenelib

#endif
<commit_msg>reverse the topk list, so it can be read more conveniently<commit_after>/*
 *  @file   TopKItemEstimation.hpp
 *  @author Kuilong Liu
 *  @date   2013.04.24
 *  @       TopKItem by count min sketch
 */
#ifndef IZENELIB_UTIL_TOPKITEM_ESTIMATION_H_
#define IZENELIB_UTIL_TOPKITEM_ESTIMATION_H_

#include <list>
#include <iterator>
#include <iostream>
#include <boost/unordered_map.hpp>
#include <boost/shared_ptr.hpp>

namespace izenelib { namespace util {

template<typename ElemType, typename CountType>
class Bucket;

template<typename ElemType, typename CountType>
class Item
{
public:
    typedef Bucket<ElemType, CountType> BucketT;
    typedef Item<ElemType, CountType> ItemT;

    Item(ElemType e, BucketT* b, ItemT* p, ItemT* n)
        :elem_(e), b_(b), prev_(p), next_(n)
    {
    }
    ~Item()
    {
        b_ = NULL;
        if(next_)delete next_;
    }

    ElemType elem_;
    BucketT* b_;
    ItemT* prev_;
    ItemT* next_;
};

template<typename ElemType, typename CountType>
class Bucket
{
public:
    typedef Item<ElemType, CountType> ItemT;
    typedef Bucket<ElemType, CountType> BucketT;
    Bucket(CountType c, BucketT* p, BucketT* n)
        :size_(0), c_(c), head_(NULL), end_(NULL), prev_(p), next_(n)
    {
    }
    ~Bucket()
    {
        if(head_)delete head_;
        if(next_)delete next_;
    }

    bool insert(ItemT* i)
    {
        if(size_==0)
        {
            head_=end_=i;
            i->prev_=NULL;
        }
        else
        {
            end_->next_=i;
            i->prev_=end_;
            end_=i;
        }
        i->b_=this;
        i->next_=NULL;
        size_++;
        return true;
    }

    bool erase(ItemT* i)
    {
        if(size_==1)
        {
            head_=end_=NULL;
        }
        else if(i->next_==NULL)
        {
            end_=end_->prev_;
            end_->next_=NULL;
        }
        else if(i->prev_==NULL)
        {
            head_=i->next_;
            head_->prev_=NULL;
        }
        else
        {
            i->prev_->next_=i->next_;
            i->next_->prev_=i->prev_;
        }
        size_--;
        i->prev_=i->next_=NULL;
        i->b_=NULL;
        return true;
    }
    CountType size_;
    CountType c_;
    ItemT* head_;
    ItemT* end_;
    BucketT* prev_;
    BucketT* next_;
};

template<typename ElemType, typename CountType>
class TopKEstimation
{
public:
    typedef Bucket<ElemType, CountType> BucketT;
    typedef Item<ElemType, CountType> ItemT;

    TopKEstimation(CountType m)
        :MAXSIZE_(m),
        size_(0),
        th_(0)
    {
        bs_ = new BucketT(0, NULL, NULL);
    }

    ~TopKEstimation()
    {
        if(bs_)delete bs_;
        gps_.clear();
    }

    bool reset()
    {
        if(bs_->next_) delete bs_->next_;
        gps_.clear();
        size_=th_=0;
        return true;
    }
    bool insert(ElemType elem, CountType count)
    {
        if(gps_.find(elem) != gps_.end())
        {
            return update(elem, count);
        }
        else if(size_ >= MAXSIZE_ && count <= th_)
            return true;
        else if(size_ >= MAXSIZE_)
        {
            return replace(elem, count);
        }
        else
        {
            return additem(elem, count);
        }
    }

    bool get(std::list<ElemType>& elem, std::list<CountType>& count)
    {
        BucketT* bp = bs_->next_;
        while(bp)
        {
            ItemT* i=bp->head_;
            while(i)
            {
                elem.push_front(i->elem_);
                count.push_front(i->b_->c_);
                i=i->next_;
            }
            bp=bp->next_;
        }
        return true;
    }
    bool get(std::list<std::pair<ElemType, CountType> >& topk)
    {
        BucketT* bp = bs_->next_;
        while(bp)
        {
            ItemT* i=bp->head_;
            while(i)
            {
                topk.push_front(make_pair(i->elem_, i->b_->c_));
                i=i->next_;
            }
            bp=bp->next_;
        }
        return true;
    }
private:
    bool update(ElemType elem, CountType count)
    {
        ItemT* i = gps_[elem];
        BucketT* bp = i->b_;
        count = bp->c_+1;

        if(bp->size_==1 && (!(bp->next_) || bp->next_->c_ > count))
        {
            bp->c_++;
            th_ = bs_->next_->c_;
            return true;
        }

        bp->erase(i);
        if(!(bp->next_))
            bp->next_=new BucketT(count, bp, NULL);
        else if(bp->next_->c_ > count)
        {
            BucketT* tp=new BucketT(count, bp, bp->next_);
            bp->next_=tp;
            tp->next_->prev_=tp;
        }
        bp->next_->insert(i);

        if(bp->size_==0)
        {
            bp->prev_->next_=bp->next_;
            bp->next_->prev_=bp->prev_;
            bp->next_=bp->prev_=NULL;
            delete bp;
        }
        return true;
    }
    bool replace(ElemType elem, CountType count)
    {
        count = bs_->next_->c_+1;
        ItemT* i = bs_->next_->end_;
        gps_.erase(gps_.find(i->elem_));
        gps_[elem] = i;
        i->elem_=elem;
        return update(elem,count);
    }
    bool additem(ElemType elem, CountType count)
    {
        count=1;
        if(bs_->next_==NULL)
        {
            bs_->next_=new BucketT(count, bs_, NULL);
        }

        BucketT* bp=bs_->next_;
        ItemT* i=new ItemT(elem, bp, NULL, NULL);

        if(bp->c_ == count)
        {
            bp->insert(i);
        }
        else
        {
            BucketT* nbp = new BucketT(count, bs_, bs_->next_);
            bs_->next_ = nbp;
            nbp->next_->prev_=nbp;
            nbp->insert(i);
        }

        size_++;
        gps_[elem]=i;
        th_=bs_->next_->c_;
        return true;
    }

    CountType MAXSIZE_;
    //current size
    CountType size_;
    //threshold
    CountType th_;
    BucketT* bs_;
    boost::unordered_map<ElemType, ItemT* > gps_;
};

} //end of namespace util
} //end of namespace izenelib

#endif
<|endoftext|>


<commit_before>/*
 * Copyright (c) 2013, The University of Oxford
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 * 3. Neither the name of the University of Oxford nor the names of its
 *    contributors may be used to endorse or promote products derived from this
 *    software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#include "oskar_global.h"
#include "widgets/oskar_About.h"

#include <QtGui/QApplication>
#include <QtGui/QDialogButtonBox>
#include <QtGui/QFont>
#include <QtGui/QGroupBox>
#include <QtGui/QHBoxLayout>
#include <QtGui/QLabel>
#include <QtGui/QTextBrowser>
#include <QtGui/QTextDocument>
#include <QtGui/QSizePolicy>
#include <QtGui/QVBoxLayout>

oskar_About::oskar_About(QWidget *parent) : QDialog(parent)
{
    // Set up the GUI.
    QVBoxLayout* vLayoutMain = new QVBoxLayout(this);
    QVBoxLayout* vLayout1 = new QVBoxLayout;
    QHBoxLayout* hLayout1 = new QHBoxLayout;
    QHBoxLayout* hLayout2 = new QHBoxLayout;

    // Create icon.
    QLabel* icon = new QLabel(this);
    QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    sizePolicy.setHorizontalStretch(0);
    sizePolicy.setVerticalStretch(0);
    sizePolicy.setHeightForWidth(icon->sizePolicy().hasHeightForWidth());
    icon->setSizePolicy(sizePolicy);
    icon->setPixmap(QPixmap(QString::fromUtf8(":/icons/oskar-32x32.png")));
    icon->setAlignment(Qt::AlignCenter);
    icon->setMargin(10);
    hLayout1->addWidget(icon);

    // Create title.
    setWindowTitle("About OSKAR");
    QLabel* title = new QLabel("OSKAR 2", this);
    title->setFont(QFont("Arial", 28));
    hLayout1->addWidget(title);

    // Add title block to vertical layout.
    hLayout1->setContentsMargins(0, 0, 80, 0);
    vLayout1->addLayout(hLayout1);

    // Create version label.
    QLabel* version = new QLabel(QString("OSKAR Version %1")
            .arg(OSKAR_VERSION_STR), this);
    vLayout1->addWidget(version);

    // Create compilation date label.
    QLabel* date = new QLabel(QString("Build Date: %1, %2").
            arg(__DATE__).arg(__TIME__), this);
    vLayout1->addWidget(date);

    // Add vertical spacer.
    vLayout1->addStretch();

    // Create logos.
    QLabel* oerc = new QLabel(this);
    oerc->setSizePolicy(sizePolicy);
    oerc->setPixmap(QPixmap(QString(":/icons/oerc-128x128.png")));
    oerc->setAlignment(Qt::AlignCenter);
    oerc->setMargin(4);
    QLabel* oxford = new QLabel(this);
    oxford->setSizePolicy(sizePolicy);
    oxford->setPixmap(QPixmap(QString(":/icons/oxford-128x128.png")));
    oxford->setAlignment(Qt::AlignCenter);
    oxford->setMargin(4);
    hLayout2->addLayout(vLayout1);
    hLayout2->addWidget(oerc);
    hLayout2->addWidget(oxford);

    // Add top banner to main vertical layout.
    vLayoutMain->addLayout(hLayout2);

    // Create license group.
    QGroupBox* grpLic = new QGroupBox("License", this);
    sizePolicy = grpLic->sizePolicy();
    sizePolicy.setVerticalStretch(10);
    grpLic->setSizePolicy(sizePolicy);
    QVBoxLayout* vLayoutLic = new QVBoxLayout(grpLic);

    // Create license text.
    QTextDocument* licenseText = new QTextDocument(this);
    {
        QTextBlockFormat paragraph;
        paragraph.setBottomMargin(10);
        QTextCursor cursor(licenseText);
        cursor.setBlockFormat(paragraph);
        cursor.insertText("Copyright (c) 2011-2013, The University of Oxford. "
                "\nAll rights reserved.");
        cursor.insertList(QTextListFormat::ListDecimal);
        cursor.insertText("Redistributions of source code must retain the "
                "above copyright notice, this list of conditions and the "
                "following disclaimer.");
        cursor.insertBlock();
        cursor.insertText("Redistributions in binary form must reproduce the "
                "above copyright notice, this list of conditions and the "
                "following disclaimer in the documentation and/or other "
                "materials provided with the distribution.");
        cursor.insertBlock();
        cursor.insertText("Neither the name of the University of Oxford nor "
                "the names of its contributors may be used to endorse or "
                "promote products derived from this software without specific "
                "prior written permission.");
        cursor.insertBlock();
        cursor.setBlockFormat(paragraph);
        cursor.insertText("THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "
                "AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED "
                "WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED "
                "WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR "
                "PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT "
                "HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, "
                "INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES "
                "(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE "
                "GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS "
                "INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, "
                "WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING "
                "NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF "
                "THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH "
                "DAMAGE.");
    }

    // Create license display.
    QTextBrowser* license = new QTextBrowser(this);
    license->setDocument(licenseText);
    license->setReadOnly(true);
    vLayoutLic->addWidget(license);

    // Add license group.
    vLayoutMain->addWidget(grpLic);

    // Create attribution group.
    QGroupBox* grpAtt = new QGroupBox("Attribution && Acknowledgements", this);
    sizePolicy = grpAtt->sizePolicy();
    sizePolicy.setVerticalStretch(10);
    grpAtt->setSizePolicy(sizePolicy);
    QVBoxLayout* vLayoutAtt = new QVBoxLayout(grpAtt);

    // Create attribution document.
    QString html;
    html.append("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" "
            "\"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
            "\n");
    html.append("
OSKAR 2 has been developed using hardware "
            "donated by NVIDIA UK.
");
    html.append("
OSKAR 2 directly links against or uses the following "
            "software libraries:
");
    html.append("
");
    html.append("
NVIDIA CUDA "
                "("
                "http://www.nvidia.com/object/cuda_home.html)
");
#ifndef OSKAR_NO_LAPACK
    html.append("
LAPACK "
                "("
                "http://www.netlib.org/lapack/)
");
#endif
#ifndef OSKAR_NO_CBLAS
    html.append("
CBLAS "
                "("
                "http://www.netlib.org/blas/)
");
#endif
    html.append("
DIERCKX for surface fitting using splines "
                "("
                "http://netlib.org/dierckx/)
");
    html.append("
The Qt cross-platform application framework "
                "("
                "http://qt.nokia.com/)
");
#ifndef OSKAR_NO_MS
    html.append("
casacore for Measurement Set export "
                "("
                "http://code.google.com/p/casacore/)
");
#endif
#ifndef OSKAR_NO_FITS
    html.append("
CFITSIO for FITS file export "
                "("
                "http://heasarc.gsfc.nasa.gov/fitsio/)
");
#endif
    html.append("
ezOptionParser "
                "("
                "http://sourceforge.net/projects/ezoptionparser/)
");
    html.append("
");
    html.append("
The following tools have been used during the development "
            "of OSKAR 2:
");
    html.append("
");
    html.append("
The CMake cross-platform build system "
                "("
                "http://www.cmake.org/)
");
    html.append("
The Google Test unit-testing framework "
                "("
                "http://code.google.com/p/googletest/)
");
    html.append("
The Eclipse source-code IDE "
                "("
                "http://www.eclipse.org/)
");
    html.append("
The Valgrind memory checker "
                "("
                "http://valgrind.org/)
");
    html.append("
The GCC toolchain "
                "("
                "http://gcc.gnu.org/)
");
    html.append("
MATLAB "
                "("
                "http://www.mathworks.co.uk/products/matlab/)
");
    html.append("
");
    html.append("
This research has made use of SAOImage DS9, developed "
            "by Smithsonian Astrophysical Observatory.
");
    html.append("");

    // Create attribution document display.
    QTextBrowser* libs = new QTextBrowser(this);
    libs->setOpenExternalLinks(true);
    libs->setHtml(html);
    libs->setReadOnly(true);
    vLayoutAtt->addWidget(libs);

    // Create acknowledgement labels.
    QLabel* ack1 = new QLabel("If OSKAR has been helpful in your research, "
            "please give the following acknowledgement:", this);
    vLayoutAtt->addWidget(ack1);
    QLabel* ack2 = new QLabel("
\"This research has made use of OSKAR, "
            "developed at the University of Oxford.\"
", this);
    ack2->setTextFormat(Qt::RichText);
    vLayoutAtt->addWidget(ack2);
    QLabel* ack3 = new QLabel("and/or reference the following publication:",
            this);
    vLayoutAtt->addWidget(ack3);
    QLabel* ack4 = new QLabel("
Dulwich, F., Mort, B.J., Salvini, S., "
            "\"Using OSKAR to simulate data from radio interferometers\",
"
            "MNRAS 2013 in preparation.
", this);
    ack4->setTextFormat(Qt::RichText);
    vLayoutAtt->addWidget(ack4);

    // Add attribution group.
    vLayoutMain->addWidget(grpAtt);

    // Create close button.
    QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok,
            Qt::Horizontal, this);
    connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
    vLayoutMain->addWidget(buttons);
}
<commit_msg>Updated reference title.<commit_after>/*
 * Copyright (c) 2012-2014, The University of Oxford
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 * 3. Neither the name of the University of Oxford nor the names of its
 *    contributors may be used to endorse or promote products derived from this
 *    software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#include <oskar_global.h>
#include <widgets/oskar_About.h>

#include <QtGui/QApplication>
#include <QtGui/QDialogButtonBox>
#include <QtGui/QFont>
#include <QtGui/QGroupBox>
#include <QtGui/QHBoxLayout>
#include <QtGui/QLabel>
#include <QtGui/QTextBrowser>
#include <QtGui/QTextDocument>
#include <QtGui/QSizePolicy>
#include <QtGui/QVBoxLayout>

oskar_About::oskar_About(QWidget *parent) : QDialog(parent)
{
    // Set up the GUI.
    QVBoxLayout* vLayoutMain = new QVBoxLayout(this);
    QVBoxLayout* vLayout1 = new QVBoxLayout;
    QHBoxLayout* hLayout1 = new QHBoxLayout;
    QHBoxLayout* hLayout2 = new QHBoxLayout;

    // Create icon.
    QLabel* icon = new QLabel(this);
    QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    sizePolicy.setHorizontalStretch(0);
    sizePolicy.setVerticalStretch(0);
    sizePolicy.setHeightForWidth(icon->sizePolicy().hasHeightForWidth());
    icon->setSizePolicy(sizePolicy);
    icon->setPixmap(QPixmap(QString::fromUtf8(":/icons/oskar-32x32.png")));
    icon->setAlignment(Qt::AlignCenter);
    icon->setMargin(10);
    hLayout1->addWidget(icon);

    // Create title.
    setWindowTitle("About OSKAR");
    QLabel* title = new QLabel("OSKAR 2", this);
    title->setFont(QFont("Arial", 28));
    hLayout1->addWidget(title);

    // Add title block to vertical layout.
    hLayout1->setContentsMargins(0, 0, 80, 0);
    vLayout1->addLayout(hLayout1);

    // Create version label.
    QLabel* version = new QLabel(QString("OSKAR Version %1")
            .arg(OSKAR_VERSION_STR), this);
    vLayout1->addWidget(version);

    // Create compilation date label.
    QLabel* date = new QLabel(QString("Build Date: %1, %2").
            arg(__DATE__).arg(__TIME__), this);
    vLayout1->addWidget(date);

    // Add vertical spacer.
    vLayout1->addStretch();

    // Create logos.
    QLabel* oerc = new QLabel(this);
    oerc->setSizePolicy(sizePolicy);
    oerc->setPixmap(QPixmap(QString(":/icons/oerc-128x128.png")));
    oerc->setAlignment(Qt::AlignCenter);
    oerc->setMargin(4);
    QLabel* oxford = new QLabel(this);
    oxford->setSizePolicy(sizePolicy);
    oxford->setPixmap(QPixmap(QString(":/icons/oxford-128x128.png")));
    oxford->setAlignment(Qt::AlignCenter);
    oxford->setMargin(4);
    hLayout2->addLayout(vLayout1);
    hLayout2->addWidget(oerc);
    hLayout2->addWidget(oxford);

    // Add top banner to main vertical layout.
    vLayoutMain->addLayout(hLayout2);

    // Create license group.
    QGroupBox* grpLic = new QGroupBox("License", this);
    sizePolicy = grpLic->sizePolicy();
    sizePolicy.setVerticalStretch(10);
    grpLic->setSizePolicy(sizePolicy);
    QVBoxLayout* vLayoutLic = new QVBoxLayout(grpLic);

    // Create license text.
    QTextDocument* licenseText = new QTextDocument(this);
    {
        QTextBlockFormat paragraph;
        paragraph.setBottomMargin(10);
        QTextCursor cursor(licenseText);
        cursor.setBlockFormat(paragraph);
        cursor.insertText("Copyright (c) 2011-2014, The University of Oxford. "
                "\nAll rights reserved.");
        cursor.insertList(QTextListFormat::ListDecimal);
        cursor.insertText("Redistributions of source code must retain the "
                "above copyright notice, this list of conditions and the "
                "following disclaimer.");
        cursor.insertBlock();
        cursor.insertText("Redistributions in binary form must reproduce the "
                "above copyright notice, this list of conditions and the "
                "following disclaimer in the documentation and/or other "
                "materials provided with the distribution.");
        cursor.insertBlock();
        cursor.insertText("Neither the name of the University of Oxford nor "
                "the names of its contributors may be used to endorse or "
                "promote products derived from this software without specific "
                "prior written permission.");
        cursor.insertBlock();
        cursor.setBlockFormat(paragraph);
        cursor.insertText("THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "
                "AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED "
                "WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED "
                "WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR "
                "PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT "
                "HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, "
                "INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES "
                "(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE "
                "GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS "
                "INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, "
                "WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING "
                "NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF "
                "THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH "
                "DAMAGE.");
    }

    // Create license display.
    QTextBrowser* license = new QTextBrowser(this);
    license->setDocument(licenseText);
    license->setReadOnly(true);
    vLayoutLic->addWidget(license);

    // Add license group.
    vLayoutMain->addWidget(grpLic);

    // Create attribution group.
    QGroupBox* grpAtt = new QGroupBox("Attribution && Acknowledgements", this);
    sizePolicy = grpAtt->sizePolicy();
    sizePolicy.setVerticalStretch(10);
    grpAtt->setSizePolicy(sizePolicy);
    QVBoxLayout* vLayoutAtt = new QVBoxLayout(grpAtt);

    // Create attribution document.
    QString html;
    html.append("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" "
            "\"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
            "\n");
    html.append("
OSKAR 2 has been developed using hardware "
            "donated by NVIDIA UK.
");
    html.append("
OSKAR 2 directly links against or uses the following "
            "software libraries:
");
    html.append("
");
    html.append("
NVIDIA CUDA "
                "("
                "http://www.nvidia.com/object/cuda_home.html)
");
#ifndef OSKAR_NO_LAPACK
    html.append("
LAPACK "
                "("
                "http://www.netlib.org/lapack/)
");
#endif
#ifndef OSKAR_NO_CBLAS
    html.append("
CBLAS "
                "("
                "http://www.netlib.org/blas/)
");
#endif
    html.append("
DIERCKX for surface fitting using splines "
                "("
                "http://netlib.org/dierckx/)
");
    html.append("
The Qt cross-platform application framework "
                "("
                "http://qt.digia.com/)
");
#ifndef OSKAR_NO_MS
    html.append("
casacore for Measurement Set export "
                "("
                "http://code.google.com/p/casacore/)
");
#endif
#ifndef OSKAR_NO_FITS
    html.append("
CFITSIO for FITS file export "
                "("
                "http://heasarc.gsfc.nasa.gov/fitsio/)
");
#endif
    html.append("
ezOptionParser "
                "("
                "http://sourceforge.net/projects/ezoptionparser/)
");
    html.append("
");
    html.append("
The following tools have been used during the development "
            "of OSKAR 2:
");
    html.append("
");
    html.append("
The CMake cross-platform build system "
                "("
                "http://www.cmake.org/)
");
    html.append("
The Google Test unit-testing framework "
                "("
                "http://code.google.com/p/googletest/)
");
    html.append("
The Eclipse source-code IDE "
                "("
                "http://www.eclipse.org/)
");
    html.append("
The Valgrind memory checker "
                "("
                "http://valgrind.org/)
");
    html.append("
The GCC toolchain "
                "("
                "http://gcc.gnu.org/)
");
    html.append("
MATLAB "
                "("
                "http://www.mathworks.co.uk/products/matlab/)
");
    html.append("
");
    html.append("
This research has made use of SAOImage DS9, developed "
            "by Smithsonian Astrophysical Observatory.
");
    html.append("");

    // Create attribution document display.
    QTextBrowser* libs = new QTextBrowser(this);
    libs->setOpenExternalLinks(true);
    libs->setHtml(html);
    libs->setReadOnly(true);
    vLayoutAtt->addWidget(libs);

    // Create acknowledgement labels.
    QLabel* ack1 = new QLabel("If OSKAR has been helpful in your research, "
            "please give the following acknowledgement:", this);
    vLayoutAtt->addWidget(ack1);
    QLabel* ack2 = new QLabel("
\"This research has made use of OSKAR, "
            "developed at the University of Oxford.\"
", this);
    ack2->setTextFormat(Qt::RichText);
    vLayoutAtt->addWidget(ack2);
    QLabel* ack3 = new QLabel("and/or reference the following publication:",
            this);
    vLayoutAtt->addWidget(ack3);
    QLabel* ack4 = new QLabel("
Dulwich, F., Mort, B. J., Salvini, S., "
            "\"OSKAR: A software package to simulate data from radio "
            "interferometers\",
"
            "MNRAS 2014, in preparation.
", this);
    ack4->setTextFormat(Qt::RichText);
    vLayoutAtt->addWidget(ack4);

    // Add attribution group.
    vLayoutMain->addWidget(grpAtt);

    // Create close button.
    QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok,
            Qt::Horizontal, this);
    connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
    vLayoutMain->addWidget(buttons);
}
<|endoftext|>


<commit_before>/*
Copyright (c) 2015 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.

Author: Leonardo de Moura
*/
#include <string>
#include "util/sstream.h"
#include "kernel/find_fn.h"
#include "kernel/replace_fn.h"
#include "kernel/instantiate.h"
#include "library/scoped_ext.h"
#include "library/expr_lt.h"
#include "library/util.h"
#include "library/normalize.h"

namespace lean {
typedef pair<name, bool> abbrev_entry;

struct abbrev_state {
    name_map<bool>                               m_abbrevs;
    rb_map<expr, name, expr_cmp_no_level_params> m_inv_map; // for pretty printer

    void add(environment const & env, name const & n, bool parsing_only) {
        declaration const & d = env.get(n);
        if (!d.is_definition())
            throw exception(sstream() << "invalid abbreviation '" << n << "', it is not a definition");
        m_abbrevs.insert(n, parsing_only);
        if (!parsing_only) {
            expr v = try_eta(d.get_value());
            m_inv_map.insert(v, n);
        }
    }

    bool is_abbreviation(name const & n) const { return m_abbrevs.contains(n); }

    bool is_parsing_only_abbreviation(name const & n) const {
        if (auto it = m_abbrevs.find(n))
            return *it;
        else
            return false;
    }

    optional<name> is_abbreviated(expr const & e) const {
        if (auto it = m_inv_map.find(e))
            return optional<name>(*it);
        else
            return optional<name>();
    }
};

static name * g_class_name = nullptr;
static std::string * g_key = nullptr;

struct abbrev_config {
    typedef abbrev_state  state;
    typedef abbrev_entry  entry;
    static void add_entry(environment const & env, io_state const &, state & s, entry const & e) {
        s.add(env, e.first, e.second);
    }
    static name const & get_class_name() {
        return *g_class_name;
    }
    static std::string const & get_serialization_key() {
        return *g_key;
    }
    static void  write_entry(serializer & s, entry const & e) {
        s << e.first << e.second;
    }
    static entry read_entry(deserializer & d) {
        entry e;
        d >> e.first >> e.second;
        return e;
    }
    static optional<unsigned> get_fingerprint(entry const & e) {
        return some(e.first.hash());
    }
};

template class scoped_ext<abbrev_config>;
typedef scoped_ext<abbrev_config> abbrev_ext;

environment add_abbreviation(environment const & env, name const & n, bool parsing_only, bool persistent) {
    return abbrev_ext::add_entry(env, get_dummy_ios(), abbrev_entry(n, parsing_only), persistent);
}

bool is_abbreviation(environment const & env, name const & n) {
    abbrev_state const & s = abbrev_ext::get_state(env);
    return s.is_abbreviation(n);
}

bool is_parsing_only_abbreviation(environment const & env, name const & n) {
    abbrev_state const & s = abbrev_ext::get_state(env);
    return s.is_parsing_only_abbreviation(n);
}

optional<name> is_abbreviated(environment const & env, expr const & e) {
    abbrev_state const & s = abbrev_ext::get_state(env);
    return s.is_abbreviated(e);
}

bool contains_abbreviations(environment const & env, expr const & e) {
    abbrev_state const & s = abbrev_ext::get_state(env);
    return static_cast<bool>(find(e, [&](expr const & e, unsigned) {
                return is_constant(e) && s.is_abbreviation(const_name(e));
            }));
}

expr expand_abbreviations(environment const & env, expr const & e) {
    if (!contains_abbreviations(env, e))
        return e;
    abbrev_state const & s = abbrev_ext::get_state(env);
    return replace(e, [&](expr const & e, unsigned) {
            if (is_constant(e) && s.is_abbreviation(const_name(e)))
                return some_expr(instantiate_value_univ_params(env.get(const_name(e)), const_levels(e)));
            else
                return none_expr();
        });
}

void initialize_abbreviation() {
    g_class_name = new name("abbreviations");
    g_key        = new std::string("abbrev");
    abbrev_ext::initialize();
}

void finalize_abbreviation() {
    abbrev_ext::finalize();
    delete g_key;
    delete g_class_name;
}
}
<commit_msg>feat(library/abbreviation): apply eta-reduction when expanding abbreviations<commit_after>/*
Copyright (c) 2015 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.

Author: Leonardo de Moura
*/
#include <string>
#include "util/sstream.h"
#include "kernel/find_fn.h"
#include "kernel/replace_fn.h"
#include "kernel/instantiate.h"
#include "library/scoped_ext.h"
#include "library/expr_lt.h"
#include "library/util.h"
#include "library/normalize.h"

namespace lean {
typedef pair<name, bool> abbrev_entry;

struct abbrev_state {
    name_map<bool>                               m_abbrevs;
    rb_map<expr, name, expr_cmp_no_level_params> m_inv_map; // for pretty printer

    void add(environment const & env, name const & n, bool parsing_only) {
        declaration const & d = env.get(n);
        if (!d.is_definition())
            throw exception(sstream() << "invalid abbreviation '" << n << "', it is not a definition");
        m_abbrevs.insert(n, parsing_only);
        if (!parsing_only) {
            expr v = try_eta(d.get_value());
            m_inv_map.insert(v, n);
        }
    }

    bool is_abbreviation(name const & n) const { return m_abbrevs.contains(n); }

    bool is_parsing_only_abbreviation(name const & n) const {
        if (auto it = m_abbrevs.find(n))
            return *it;
        else
            return false;
    }

    optional<name> is_abbreviated(expr const & e) const {
        if (auto it = m_inv_map.find(e))
            return optional<name>(*it);
        else
            return optional<name>();
    }
};

static name * g_class_name = nullptr;
static std::string * g_key = nullptr;

struct abbrev_config {
    typedef abbrev_state  state;
    typedef abbrev_entry  entry;
    static void add_entry(environment const & env, io_state const &, state & s, entry const & e) {
        s.add(env, e.first, e.second);
    }
    static name const & get_class_name() {
        return *g_class_name;
    }
    static std::string const & get_serialization_key() {
        return *g_key;
    }
    static void  write_entry(serializer & s, entry const & e) {
        s << e.first << e.second;
    }
    static entry read_entry(deserializer & d) {
        entry e;
        d >> e.first >> e.second;
        return e;
    }
    static optional<unsigned> get_fingerprint(entry const & e) {
        return some(e.first.hash());
    }
};

template class scoped_ext<abbrev_config>;
typedef scoped_ext<abbrev_config> abbrev_ext;

environment add_abbreviation(environment const & env, name const & n, bool parsing_only, bool persistent) {
    return abbrev_ext::add_entry(env, get_dummy_ios(), abbrev_entry(n, parsing_only), persistent);
}

bool is_abbreviation(environment const & env, name const & n) {
    abbrev_state const & s = abbrev_ext::get_state(env);
    return s.is_abbreviation(n);
}

bool is_parsing_only_abbreviation(environment const & env, name const & n) {
    abbrev_state const & s = abbrev_ext::get_state(env);
    return s.is_parsing_only_abbreviation(n);
}

optional<name> is_abbreviated(environment const & env, expr const & e) {
    abbrev_state const & s = abbrev_ext::get_state(env);
    return s.is_abbreviated(e);
}

bool contains_abbreviations(environment const & env, expr const & e) {
    abbrev_state const & s = abbrev_ext::get_state(env);
    return static_cast<bool>(find(e, [&](expr const & e, unsigned) {
                return is_constant(e) && s.is_abbreviation(const_name(e));
            }));
}

expr expand_abbreviations(environment const & env, expr const & e) {
    if (!contains_abbreviations(env, e))
        return e;
    abbrev_state const & s = abbrev_ext::get_state(env);
    return replace(e, [&](expr const & e, unsigned) {
            if (is_constant(e) && s.is_abbreviation(const_name(e)))
                return some_expr(try_eta(instantiate_value_univ_params(env.get(const_name(e)), const_levels(e))));
            else
                return none_expr();
        });
}

void initialize_abbreviation() {
    g_class_name = new name("abbreviations");
    g_key        = new std::string("abbrev");
    abbrev_ext::initialize();
}

void finalize_abbreviation() {
    abbrev_ext::finalize();
    delete g_key;
    delete g_class_name;
}
}
<|endoftext|>


<commit_before>//////////////////////////////////////////////////////////////////////////
//
// SneezyMUD - All rights reserved, SneezyMUD Coding Team
//
// $Log: task_trance_of_blades.cc,v $
// Revision 1.1  2000/12/22 07:12:03  dash
// Initial revision
//
// Revision 5.1.1.1  1999/10/16 04:32:20  batopr
// new branch
//
// Revision 5.1  1999/10/16 04:31:17  batopr
// new branch
//
// Revision 1.1  1999/09/12 17:24:04  sneezy
// Initial revision
//
//
//////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////
//
//      SneezyMUD 4.0 - All rights reserved, SneezyMUD Coding Team
//      "task.cc" - All functions related to tasks that keep mobs/PCs busy
//
//////////////////////////////////////////////////////////////////////////

#include "stdsneezy.h"

void stop_trance_of_blades(TBeing *ch)
{
  if (ch->getPosition() >= POSITION_RESTING) {
    act("You suddenly snap out of your trance.",
	FALSE, ch, 0, 0, TO_CHAR);
    act("$n suddenly snaps out of $s trance.",
	FALSE, ch, 0, 0, TO_ROOM);
  }
  ch->stopTask();
}

void TBaseWeapon::tranceOfBladesPulse(TBeing *ch, TThing *)
{
  stop_trance_of_blades(ch);
  return;
}

int task_trance_of_blades(TBeing *ch, cmdTypeT cmd, const char *, int pulse, TRoom *, TObj *)
{
  TThing *o = NULL;

  // sanity check
  if (ch->isLinkdead() ||
      (ch->in_room != ch->task->wasInRoom) ||
      (ch->getPosition() < POSITION_RESTING) ||
      !(o = ch->heldInPrimHand())) {
    stop_trance_of_blades(ch);
    return FALSE;  // returning FALSE lets command be interpreted
  }
  if (ch->utilityTaskCommand(cmd) ||
      ch->nobrainerTaskCommand(cmd))
    return FALSE;
  switch (cmd) {
  case CMD_TASK_CONTINUE:
    ch->task->calcNextUpdate(pulse, 2 * PULSE_MOBACT);
    //w->sharpenPulse(ch, o);
    return FALSE;
  case CMD_ABORT:
  case CMD_STOP:
    act("You slowly come out of the trance.",
	FALSE, ch, o, 0, TO_CHAR);
    act("$n slowly comes out of $s trance.", FALSE, ch, o, 0, TO_ROOM);
    ch->stopTask();
    break;
  case CMD_TASK_FIGHTING:
    act("Your $o becomes a blur as you concentrate on your defensive trance.", FALSE, ch, o, 0, TO_CHAR);
    act("$n's $o becomes a blur as $e concentrates on $s defensive trance.", FALSE, ch, o, 0, TO_ROOM);
    break;
  default:
    if (cmd < MAX_CMD_LIST)
      warn_busy(ch);
    break;                    // eat the command
  }
  return TRUE;
}

<commit_msg>added code for 'defensive trance' warrior skill<commit_after>//////////////////////////////////////////////////////////////////////////
//
// SneezyMUD - All rights reserved, SneezyMUD Coding Team
//
// $Log: task_trance_of_blades.cc,v $
// Revision 1.2  2000/12/27 08:27:35  dash
// added code for 'defensive trance' warrior skill
//
// Revision 1.1  2000/12/22 07:12:03  dash
// Initial revision
//
//
//////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////
//
//      SneezyMUD 4.0 - All rights reserved, SneezyMUD Coding Team
//      "task.cc" - All functions related to tasks that keep mobs/PCs busy
//
//////////////////////////////////////////////////////////////////////////

#include "stdsneezy.h"

void stop_trance_of_blades(TBeing *ch)
{
  if (ch->getPosition() >= POSITION_RESTING) {
    act("You suddenly snap out of your trance.",
	FALSE, ch, 0, 0, TO_CHAR, ANSI_RED);
    act("$n suddenly snaps out of $s trance.",
	FALSE, ch, 0, 0, TO_ROOM);
  }
  ch->stopTask();
}

//void TBaseWeapon::tranceOfBladesPulse(TBeing *ch, TThing *)
//  {
//  stop_trance_of_blades(ch);
//  return;
//  }

int task_trance_of_blades(TBeing *ch, cmdTypeT cmd, const char *, int pulse, TRoom *, TObj *)
{
  TThing *o = NULL;
  int chance = 0;
  // sanity check
  if (ch->isLinkdead() ||
      (ch->in_room != ch->task->wasInRoom) ||
      (ch->getPosition() < POSITION_RESTING)) {
    stop_trance_of_blades(ch);
    return FALSE;  // returning FALSE lets command be interpreted
  }
  if (ch->utilityTaskCommand(cmd) ||
      ch->nobrainerTaskCommand(cmd))
    return FALSE;
  switch (cmd) {
  case CMD_TASK_CONTINUE:
    ch->task->calcNextUpdate(pulse, PULSE_MOBACT);
    if (!(o = ch->heldInPrimHand())) {
      act("Loss of your weapon causes you to snap out of your trance.",
          FALSE, ch, 0, 0, TO_CHAR, ANSI_RED);
      act("Loss of $s weapon causes $n to snap out of $s trance.",
          FALSE, ch, 0, 0, TO_ROOM);
      ch->stopTask();
      ch->addToWait(combatRound(2));
      ch->cantHit += ch->loseRound(1);
      return FALSE;
    }
    if (ch->getCombatMode() == ATTACK_BERSERK) {
      act("Berserking causes you to snap out of your trance.",
          FALSE, ch, 0, 0, TO_CHAR, ANSI_RED);
      act("Berserking causes $n to snap out of $s trance.",
          FALSE, ch, 0, 0, TO_ROOM);
      ch->stopTask();
      ch->addToWait(combatRound(2));
      ch->cantHit += ch->loseRound(1);
      return FALSE;
    }
    if (ch->isSwimming()) {
      act("Sudden immersion causes you to snap out of your trance.",
          FALSE, ch, 0, 0, TO_CHAR, ANSI_RED);
      act("Sudden immersion causes $n to snap out of $s trance.",
          FALSE, ch, 0, 0, TO_ROOM);
      ch->stopTask();
      ch->addToWait(combatRound(2));
      ch->cantHit += ch->loseRound(1);
      return FALSE;
    }
    if (!ch->canUseArm(HAND_PRIMARY)) {
      act("Your injured arm causes you to snap out of your trance.",
          FALSE, ch, 0, 0, TO_CHAR), ANSI_RED;
      act("$n's injured arm causes $m to snap out of $s trance.",
          FALSE, ch, 0, 0, TO_ROOM);
      ch->stopTask();
      ch->addToWait(combatRound(2));
      ch->cantHit += ch->loseRound(1);
      return FALSE;
    }
    if (ch->getMove() < 30) {
      act("Your fatigue causes you to snap out of your trance.",
	  FALSE, ch, 0, 0, TO_CHAR, ANSI_RED);
      act("$n's fatigue causes $m to snap out of $s trance.",
	  FALSE, ch, 0, 0, TO_ROOM);
      ch->stopTask();
      ch->addToWait(combatRound(2));
      ch->cantHit += ch->loseRound(1);
      return FALSE;
    }
    ch->addToMove(-10);
    chance = 150 - ch->getSkillValue(SKILL_TRANCE_OF_BLADES);
    if (!(ch->attackers)) chance *= 2;
    chance = (int)((float) chance * ch->plotStat(STAT_CURRENT, STAT_FOC, 1.25, 0.80, 1.00));
    if (chance > ::number(0,999)) {
      act("Your concentraion has been lost, and you snap out of your defensive trance.",
	  FALSE, ch, 0, 0, TO_CHAR, ANSI_YELLOW);
      act("$n loses $s concentration and snaps out of $s defensive trance.",
	  FALSE, ch, 0, 0, TO_ROOM, ANSI_YELLOW);
      ch->stopTask();
      ch->addToWait(combatRound(2));
      ch->cantHit += ch->loseRound(1);
      return FALSE;
    }
    if (!(::number(0,2)) || (ch->attackers))
      act("Your focus is good and you are able to maintain your defensive trance.",
	  FALSE, ch, 0, 0, TO_CHAR);
    return FALSE;
  case CMD_ABORT:
  case CMD_STOP:
    act("You slowly come out of your trance.",
	FALSE, ch, o, 0, TO_CHAR);
    act("$n slowly comes out of $s trance.", FALSE, ch, o, 0, TO_ROOM);
    ch->stopTask();
    ch->addToWait(combatRound(2));
    ch->cantHit += ch->loseRound(1);
    break;
  case CMD_TASK_FIGHTING:
    //    act("Your $o becomes a blur as you concentrate on your defensive trance.", FALSE, ch, o, 0, TO_CHAR);
    //    act("$n's $o becomes a blur as $e concentrates on $s defensive trance.", FALSE, ch, o, 0, TO_ROOM);
    break;
  default:
    if (cmd < MAX_CMD_LIST)
      warn_busy(ch);
    break;                    // eat the command
  }
  return TRUE;
}

<|endoftext|>


<commit_before>/*******************************************************************************
* ALMA - Atacama Large Millimiter Array
* (c) European Southern Observatory, 2011
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
*
* "@(#) $Id: bulkDataNTGenReceiver.cpp,v 1.7 2012/07/16 22:34:32 bjeram Exp $"
*
* who       when      what
* --------  --------  ----------------------------------------------
* bjeram  2011-04-19  created
*/
#include "bulkDataNTReceiverStream.h"
#include "bulkDataNTCallback.h"
#include <iostream>
#include <ace/Get_Opt.h>
#include <ace/Tokenizer_T.h>

using namespace std;

class  TestCB:  public BulkDataNTCallback
{
public:
	TestCB()
	{
		totalRcvData=0;
	}

	virtual ~TestCB()
	{
		std::cout << "Total received data for: " << getStreamName() << "#" << getFlowName()  << " : " << totalRcvData << std::endl;
	}

	int cbStart(unsigned char* userParam_p, unsigned  int size)
	{
		// we cannot initialize flow name and flow stream in ctor, because they are after CB object is created
		fn = getFlowName();
		sn = getStreamName();

		std::cout << "cbStart[ " << sn << "#" << fn  << " ]: got a parameter: ";
		for(unsigned int i=0; i<size; i++)
		{
			std::cout <<  *(char*)(userParam_p+i);
		}
		std::cout << " of size: " << size << std::endl;
		return 0;
	}

	int cbReceive(unsigned char* data, unsigned  int size)
	{
		std::cout << "cbReceive[ " << sn << "#" << fn << " ]: got data of size: " << size << " :";
/*		for(unsigned int i=0; i<frame_p->length(); i++)
		{
			std::cout <<  *(char*)(frame_p->base()+i);
		}
	*/
		std::cout << std::endl;

		if (cbDealy>0) usleep(cbDealy);
		totalRcvData+=size;
		return 0;
	}

	int cbStop()
	{
		std::cout << "cbStop[ " << sn << "#" << fn << " ]" << std::endl;
		return 0;
	}

	static unsigned long cbDealy;
private:
	std::string fn; ///flow Name
	std::string sn; ///stream name
	unsigned int totalRcvData; ///total size of all received data
};

unsigned long TestCB::cbDealy = 0;

void print_usage(char *argv[]) {
	cout << "Usage: " << argv[0] << " [-s streamName] -f flow1Name[,flow2Name,flow3Name...] [-d cbReceive delay(sleep) in msec] [-u unicast mode] [-m multicast address]" << endl;
	exit(1);
}

int main(int argc, char *argv[])
{

	char c;
	ReceiverFlowConfiguration flowCfg;
	char *streamName = "DefaultStream";
	/*char unicastPortQoS[250];
	unsigned int unicastPort=24000;
	*/
	list<char *> flows;

	// Parse the args
	ACE_Get_Opt get_opts (argc, argv, "s:f:d:m:u");
	while(( c = get_opts()) != -1 ) {

		switch(c) {
			case 'm':
			{
				flowCfg.setMulticastAddress(get_opts.opt_arg());
				break;
			}
			case 'u':
			{
				flowCfg.setEnableMulticast(false);
				break;
			}
			case 's':
			{
				streamName = get_opts.opt_arg();
				break;
			}
			case 'f':
			{
				ACE_Tokenizer tok(get_opts.opt_arg());
				tok.delimiter_replace(',', 0);
				for(char *p = tok.next(); p; p = tok.next())
					flows.push_back(p);
				break;
			}
			case 'd':
			{
				TestCB::cbDealy = atoi(get_opts.opt_arg());
				break;
			}
		}//case

	}//while

	if( flows.size() == 0 )
		print_usage(argv);

	LoggingProxy m_logger(0, 0, 31, 0);
	LoggingProxy::init (&m_logger);
	ACS_CHECK_LOGGER;

	AcsBulkdata::BulkDataNTReceiverStream<TestCB> receiverStream(streamName);

	list<char *>::iterator it;
	for(it = flows.begin(); it != flows.end(); it++) {
		/*
		sprintf(unicastPortQoS, "<datareader_qos><unicast><value><element><receive_port>%ud</receive_port></element></value></unicast></datareader_qos>", unicastPort++);
		flowCfg.setDDSReceiverFlowQoS((*it), unicastPortQoS);
		*/
		BulkDataNTReceiverFlow *flow = receiverStream.createFlow((*it), flowCfg);
		flow->getCallback<TestCB>();
		std::vector<string> flowNames = receiverStream.getFlowNames();
		std::cout << "Waiting on the following " << receiverStream.getFlowNumber() << " flow(s):[ ";
		for(unsigned int i=0;i<flowNames.size(); i++)
		  std::cout << flowNames[i] << " ";
		std::cout << "] of stream: " <<  streamName << std::endl;
	}

	std::cout << "Press a key to exit.." << std::endl;
	getchar();

}
<commit_msg>added option: -n suppers printing in cbReceive<commit_after>/*******************************************************************************
* ALMA - Atacama Large Millimiter Array
* (c) European Southern Observatory, 2011
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
*
* "@(#) $Id: bulkDataNTGenReceiver.cpp,v 1.8 2012/07/21 01:08:17 bjeram Exp $"
*
* who       when      what
* --------  --------  ----------------------------------------------
* bjeram  2011-04-19  created
*/
#include "bulkDataNTReceiverStream.h"
#include "bulkDataNTCallback.h"
#include <iostream>
#include <ace/Get_Opt.h>
#include <ace/Tokenizer_T.h>

using namespace std;

class  TestCB:  public BulkDataNTCallback
{
public:
	TestCB()
	{
		totalRcvData=0;
	}

	virtual ~TestCB()
	{
		std::cout << "Total received data for: " << getStreamName() << "#" << getFlowName()  << " : " << totalRcvData << std::endl;
	}

	int cbStart(unsigned char* userParam_p, unsigned  int size)
	{
		// we cannot initialize flow name and flow stream in ctor, because they are after CB object is created
		fn = getFlowName();
		sn = getStreamName();

		std::cout << "cbStart[ " << sn << "#" << fn  << " ]: got a parameter: ";
		for(unsigned int i=0; i<size; i++)
		{
			std::cout <<  *(char*)(userParam_p+i);
		}
		std::cout << " of size: " << size << std::endl;
		return 0;
	}

	int cbReceive(unsigned char* data, unsigned  int size)
	{
		if (cbReceivePrint)
		{
			std::cout << "cbReceive[ " << sn << "#" << fn << " ]: got data of size: " << size << " :";
			/*		for(unsigned int i=0; i<frame_p->length(); i++)
		{
			std::cout <<  *(char*)(frame_p->base()+i);
		}
			 */
			std::cout << std::endl;
		}
		if (cbDealy>0) usleep(cbDealy);
		totalRcvData+=size;
		return 0;
	}

	int cbStop()
	{
		std::cout << "cbStop[ " << sn << "#" << fn << " ]" << std::endl;
		return 0;
	}

	static unsigned long cbDealy;
	static bool cbReceivePrint;
private:
	std::string fn; ///flow Name
	std::string sn; ///stream name
	unsigned int totalRcvData; ///total size of all received data
};

unsigned long TestCB::cbDealy = 0;
bool TestCB::cbReceivePrint=true;

void print_usage(char *argv[]) {
	cout << "Usage: " << argv[0] << " [-s streamName] -f flow1Name[,flow2Name,flow3Name...] [-d cbReceive delay(sleep) in msec] [-u unicast mode] [-m multicast address] [-n suppers printing in cbReceive]" << endl;
	exit(1);
}

int main(int argc, char *argv[])
{

	char c;
	ReceiverFlowConfiguration flowCfg;
	char *streamName = "DefaultStream";
	/*char unicastPortQoS[250];
	unsigned int unicastPort=24000;
	*/
	list<char *> flows;

	// Parse the args
	ACE_Get_Opt get_opts (argc, argv, "s:f:d:m:un");
	while(( c = get_opts()) != -1 ) {

		switch(c) {
			case 'n':
			{
				TestCB::cbReceivePrint=false;
				break;
			}
			case 'm':
			{
				flowCfg.setMulticastAddress(get_opts.opt_arg());
				break;
			}
			case 'u':
			{
				flowCfg.setEnableMulticast(false);
				break;
			}
			case 's':
			{
				streamName = get_opts.opt_arg();
				break;
			}
			case 'f':
			{
				ACE_Tokenizer tok(get_opts.opt_arg());
				tok.delimiter_replace(',', 0);
				for(char *p = tok.next(); p; p = tok.next())
					flows.push_back(p);
				break;
			}
			case 'd':
			{
				TestCB::cbDealy = atoi(get_opts.opt_arg());
				break;
			}
		}//case

	}//while

	if( flows.size() == 0 )
		print_usage(argv);

	LoggingProxy m_logger(0, 0, 31, 0);
	LoggingProxy::init (&m_logger);
	ACS_CHECK_LOGGER;

	AcsBulkdata::BulkDataNTReceiverStream<TestCB> receiverStream(streamName);

	list<char *>::iterator it;
	for(it = flows.begin(); it != flows.end(); it++) {
		/*
		sprintf(unicastPortQoS, "<datareader_qos><unicast><value><element><receive_port>%ud</receive_port></element></value></unicast></datareader_qos>", unicastPort++);
		flowCfg.setDDSReceiverFlowQoS((*it), unicastPortQoS);
		*/
		BulkDataNTReceiverFlow *flow = receiverStream.createFlow((*it), flowCfg);
		flow->getCallback<TestCB>();
		std::vector<string> flowNames = receiverStream.getFlowNames();
		std::cout << "Waiting on the following " << receiverStream.getFlowNumber() << " flow(s):[ ";
		for(unsigned int i=0;i<flowNames.size(); i++)
		  std::cout << flowNames[i] << " ";
		std::cout << "] of stream: " <<  streamName << std::endl;
	}

	std::cout << "Press a key to exit.." << std::endl;
	getchar();

}
<|endoftext|>


<commit_before>/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/
#ifndef _SVX_OPTINET_HXX
#define _SVX_OPTINET_HXX

#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <vcl/lstbox.hxx>
#include <vcl/group.hxx>
#include <vcl/field.hxx>
#include <svtools/stdctrl.hxx>
#include <svtools/svtabbx.hxx>
#include <sfx2/tabdlg.hxx>
#include <unotools/configitem.hxx>

#ifdef _SVX_OPTINET2_CXX
#include <svtools/headbar.hxx>
#else
class HeaderBar;
#endif
#include <readonlyimage.hxx>

class SfxFilter;

namespace svx {
    class SecurityOptionsDialog;
}

namespace lang = ::com::sun::star::lang;
namespace uno = ::com::sun::star::uno;

// class SvxNoSpaceEdit --------------------------------------------------

class SvxNoSpaceEdit : public Edit
{
private:
    sal_Bool            bOnlyNumeric;

public:
    SvxNoSpaceEdit(Window* pParent, ResId rResId, sal_Bool bNum = sal_False ) :
        Edit( pParent, rResId ), bOnlyNumeric( bNum ) {}

    virtual void    KeyInput( const KeyEvent& rKEvent );
    virtual void    Modify();
};

typedef std::vector<SfxFilter*> SfxFilterPtrArr;

// class SvxProxyTabPage -------------------------------------------------

class SvxProxyTabPage : public SfxTabPage
{
private:
    FixedLine       aOptionGB;

    FixedText       aProxyModeFT;
    ListBox         aProxyModeLB;

    FixedText       aHttpProxyFT;
    SvxNoSpaceEdit  aHttpProxyED;
    FixedText       aHttpPortFT;
    SvxNoSpaceEdit  aHttpPortED;

    FixedText       aHttpsProxyFT;
    SvxNoSpaceEdit  aHttpsProxyED;
    FixedText       aHttpsPortFT;
    SvxNoSpaceEdit  aHttpsPortED;

    FixedText       aFtpProxyFT;
    SvxNoSpaceEdit  aFtpProxyED;
    FixedText       aFtpPortFT;
    SvxNoSpaceEdit  aFtpPortED;

    FixedText       aNoProxyForFT;
    Edit            aNoProxyForED;
    FixedText       aNoProxyDescFT;

    String          sFromBrowser;

    const rtl::OUString aProxyModePN;
    const rtl::OUString aHttpProxyPN;
    const rtl::OUString aHttpPortPN;
    const rtl::OUString aHttpsProxyPN;
    const rtl::OUString aHttpsPortPN;
    const rtl::OUString aFtpProxyPN;
    const rtl::OUString aFtpPortPN;
    const rtl::OUString aNoProxyDescPN;

    uno::Reference< uno::XInterface > m_xConfigurationUpdateAccess;

#ifdef _SVX_OPTINET2_CXX
    void ArrangeControls_Impl();
    void EnableControls_Impl(sal_Bool bEnable);
    void ReadConfigData_Impl();
    void ReadConfigDefaults_Impl();
    void RestoreConfigDefaults_Impl();

    DECL_LINK( ProxyHdl_Impl, ListBox * );
    DECL_LINK( LoseFocusHdl_Impl, Edit * );
#endif

    SvxProxyTabPage( Window* pParent, const SfxItemSet& rSet );
    virtual ~SvxProxyTabPage();

public:
    static SfxTabPage*  Create( Window* pParent, const SfxItemSet& rAttrSet );
    virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
    virtual void        Reset( const SfxItemSet& rSet );
};

// #98647# class SvxScriptExecListBox ------------------------------------
class SvxScriptExecListBox : public ListBox
{ // for adding tooltips to ListBox
public:
    SvxScriptExecListBox( Window* pParent, WinBits nStyle = WB_BORDER )
            :ListBox(pParent, nStyle) {}
    SvxScriptExecListBox( Window* pParent, const ResId& rResId )
            :ListBox(pParent, rResId) {}

protected:
    virtual void RequestHelp( const HelpEvent& rHEvt );
};

// class SvxSecurityTabPage ---------------------------------------------

class SvtSecurityOptions;

class CertPathDialog;

class SvxSecurityTabPage : public SfxTabPage
{
    using TabPage::ActivatePage;
    using TabPage::DeactivatePage;

private:
    FixedLine           maSecurityOptionsFL;
    FixedInfo           maSecurityOptionsFI;
    PushButton          maSecurityOptionsPB;

    FixedLine           maPasswordsFL;
    CheckBox            maSavePasswordsCB;
    PushButton          maShowConnectionsPB;
    CheckBox            maMasterPasswordCB;
    FixedInfo           maMasterPasswordFI;
    PushButton          maMasterPasswordPB;

    FixedLine           maMacroSecFL;
    FixedInfo           maMacroSecFI;
    PushButton          maMacroSecPB;

    FixedLine           m_aCertPathFL;
    FixedInfo           m_aCertPathFI;
    PushButton          m_aCertPathPB;

    SvtSecurityOptions*         mpSecOptions;
    svx::SecurityOptionsDialog* mpSecOptDlg;

    CertPathDialog* mpCertPathDlg;

    String              msPasswordStoringDeactivateStr;

    DECL_LINK(SecurityOptionsHdl, void *);
    DECL_LINK(SavePasswordHdl, void* );
    DECL_LINK(MasterPasswordHdl, void *);
    DECL_LINK(MasterPasswordCBHdl, void* );
    DECL_LINK(ShowPasswordsHdl, void *);
    DECL_LINK(MacroSecPBHdl, void* );
    DECL_LINK(CertPathPBHdl, void* );

    void                InitControls();

                SvxSecurityTabPage( Window* pParent, const SfxItemSet& rSet );
    virtual     ~SvxSecurityTabPage();

protected:
    virtual void        ActivatePage( const SfxItemSet& rSet );
    virtual int         DeactivatePage( SfxItemSet* pSet = 0 );

public:
    static SfxTabPage*  Create( Window* pParent, const SfxItemSet& rAttrSet );
    virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
    virtual void        Reset( const SfxItemSet& rSet );
};

class MozPluginTabPage : public SfxTabPage
{
    FixedLine       aMSWordGB;
    CheckBox        aWBasicCodeCB;

    sal_Bool isInstalled(void);
    sal_Bool installPlugin(void);
    sal_Bool uninstallPlugin(void);

    MozPluginTabPage( Window* pParent, const SfxItemSet& rSet );
    virtual ~MozPluginTabPage();

public:

    static SfxTabPage*  Create( Window* pParent,
                                const SfxItemSet& rAttrSet );

    virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
    virtual void        Reset( const SfxItemSet& rSet );

};

struct SvxEMailTabPage_Impl;
class SvxEMailTabPage : public SfxTabPage
{
    FixedLine       aMailFL;
    ReadOnlyImage   aMailerURLFI;
    FixedText       aMailerURLFT;
    Edit            aMailerURLED;
    PushButton      aMailerURLPB;

    String          m_sDefaultFilterName;

    SvxEMailTabPage_Impl* pImpl;

    DECL_LINK(  FileDialogHdl_Impl, PushButton* ) ;

public:
    SvxEMailTabPage( Window* pParent, const SfxItemSet& rSet );
    ~SvxEMailTabPage();

    static SfxTabPage*  Create( Window* pParent, const SfxItemSet& rAttrSet );

    virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
    virtual void        Reset( const SfxItemSet& rSet );
};

#endif // #ifndef _SVX_OPTINET_HXX

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
<commit_msg>remove unused SfxFilterPtrArr<commit_after>/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/
#ifndef _SVX_OPTINET_HXX
#define _SVX_OPTINET_HXX

#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <vcl/lstbox.hxx>
#include <vcl/group.hxx>
#include <vcl/field.hxx>
#include <svtools/stdctrl.hxx>
#include <svtools/svtabbx.hxx>
#include <sfx2/tabdlg.hxx>
#include <unotools/configitem.hxx>

#ifdef _SVX_OPTINET2_CXX
#include <svtools/headbar.hxx>
#else
class HeaderBar;
#endif
#include <readonlyimage.hxx>

class SfxFilter;

namespace svx {
    class SecurityOptionsDialog;
}

namespace lang = ::com::sun::star::lang;
namespace uno = ::com::sun::star::uno;

// class SvxNoSpaceEdit --------------------------------------------------

class SvxNoSpaceEdit : public Edit
{
private:
    sal_Bool            bOnlyNumeric;

public:
    SvxNoSpaceEdit(Window* pParent, ResId rResId, sal_Bool bNum = sal_False ) :
        Edit( pParent, rResId ), bOnlyNumeric( bNum ) {}

    virtual void    KeyInput( const KeyEvent& rKEvent );
    virtual void    Modify();
};

// class SvxProxyTabPage -------------------------------------------------

class SvxProxyTabPage : public SfxTabPage
{
private:
    FixedLine       aOptionGB;

    FixedText       aProxyModeFT;
    ListBox         aProxyModeLB;

    FixedText       aHttpProxyFT;
    SvxNoSpaceEdit  aHttpProxyED;
    FixedText       aHttpPortFT;
    SvxNoSpaceEdit  aHttpPortED;

    FixedText       aHttpsProxyFT;
    SvxNoSpaceEdit  aHttpsProxyED;
    FixedText       aHttpsPortFT;
    SvxNoSpaceEdit  aHttpsPortED;

    FixedText       aFtpProxyFT;
    SvxNoSpaceEdit  aFtpProxyED;
    FixedText       aFtpPortFT;
    SvxNoSpaceEdit  aFtpPortED;

    FixedText       aNoProxyForFT;
    Edit            aNoProxyForED;
    FixedText       aNoProxyDescFT;

    String          sFromBrowser;

    const rtl::OUString aProxyModePN;
    const rtl::OUString aHttpProxyPN;
    const rtl::OUString aHttpPortPN;
    const rtl::OUString aHttpsProxyPN;
    const rtl::OUString aHttpsPortPN;
    const rtl::OUString aFtpProxyPN;
    const rtl::OUString aFtpPortPN;
    const rtl::OUString aNoProxyDescPN;

    uno::Reference< uno::XInterface > m_xConfigurationUpdateAccess;

#ifdef _SVX_OPTINET2_CXX
    void ArrangeControls_Impl();
    void EnableControls_Impl(sal_Bool bEnable);
    void ReadConfigData_Impl();
    void ReadConfigDefaults_Impl();
    void RestoreConfigDefaults_Impl();

    DECL_LINK( ProxyHdl_Impl, ListBox * );
    DECL_LINK( LoseFocusHdl_Impl, Edit * );
#endif

    SvxProxyTabPage( Window* pParent, const SfxItemSet& rSet );
    virtual ~SvxProxyTabPage();

public:
    static SfxTabPage*  Create( Window* pParent, const SfxItemSet& rAttrSet );
    virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
    virtual void        Reset( const SfxItemSet& rSet );
};

// #98647# class SvxScriptExecListBox ------------------------------------
class SvxScriptExecListBox : public ListBox
{ // for adding tooltips to ListBox
public:
    SvxScriptExecListBox( Window* pParent, WinBits nStyle = WB_BORDER )
            :ListBox(pParent, nStyle) {}
    SvxScriptExecListBox( Window* pParent, const ResId& rResId )
            :ListBox(pParent, rResId) {}

protected:
    virtual void RequestHelp( const HelpEvent& rHEvt );
};

// class SvxSecurityTabPage ---------------------------------------------

class SvtSecurityOptions;

class CertPathDialog;

class SvxSecurityTabPage : public SfxTabPage
{
    using TabPage::ActivatePage;
    using TabPage::DeactivatePage;

private:
    FixedLine           maSecurityOptionsFL;
    FixedInfo           maSecurityOptionsFI;
    PushButton          maSecurityOptionsPB;

    FixedLine           maPasswordsFL;
    CheckBox            maSavePasswordsCB;
    PushButton          maShowConnectionsPB;
    CheckBox            maMasterPasswordCB;
    FixedInfo           maMasterPasswordFI;
    PushButton          maMasterPasswordPB;

    FixedLine           maMacroSecFL;
    FixedInfo           maMacroSecFI;
    PushButton          maMacroSecPB;

    FixedLine           m_aCertPathFL;
    FixedInfo           m_aCertPathFI;
    PushButton          m_aCertPathPB;

    SvtSecurityOptions*         mpSecOptions;
    svx::SecurityOptionsDialog* mpSecOptDlg;

    CertPathDialog* mpCertPathDlg;

    String              msPasswordStoringDeactivateStr;

    DECL_LINK(SecurityOptionsHdl, void *);
    DECL_LINK(SavePasswordHdl, void* );
    DECL_LINK(MasterPasswordHdl, void *);
    DECL_LINK(MasterPasswordCBHdl, void* );
    DECL_LINK(ShowPasswordsHdl, void *);
    DECL_LINK(MacroSecPBHdl, void* );
    DECL_LINK(CertPathPBHdl, void* );

    void                InitControls();

                SvxSecurityTabPage( Window* pParent, const SfxItemSet& rSet );
    virtual     ~SvxSecurityTabPage();

protected:
    virtual void        ActivatePage( const SfxItemSet& rSet );
    virtual int         DeactivatePage( SfxItemSet* pSet = 0 );

public:
    static SfxTabPage*  Create( Window* pParent, const SfxItemSet& rAttrSet );
    virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
    virtual void        Reset( const SfxItemSet& rSet );
};

class MozPluginTabPage : public SfxTabPage
{
    FixedLine       aMSWordGB;
    CheckBox        aWBasicCodeCB;

    sal_Bool isInstalled(void);
    sal_Bool installPlugin(void);
    sal_Bool uninstallPlugin(void);

    MozPluginTabPage( Window* pParent, const SfxItemSet& rSet );
    virtual ~MozPluginTabPage();

public:

    static SfxTabPage*  Create( Window* pParent,
                                const SfxItemSet& rAttrSet );

    virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
    virtual void        Reset( const SfxItemSet& rSet );

};

struct SvxEMailTabPage_Impl;
class SvxEMailTabPage : public SfxTabPage
{
    FixedLine       aMailFL;
    ReadOnlyImage   aMailerURLFI;
    FixedText       aMailerURLFT;
    Edit            aMailerURLED;
    PushButton      aMailerURLPB;

    String          m_sDefaultFilterName;

    SvxEMailTabPage_Impl* pImpl;

    DECL_LINK(  FileDialogHdl_Impl, PushButton* ) ;

public:
    SvxEMailTabPage( Window* pParent, const SfxItemSet& rSet );
    ~SvxEMailTabPage();

    static SfxTabPage*  Create( Window* pParent, const SfxItemSet& rAttrSet );

    virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
    virtual void        Reset( const SfxItemSet& rSet );
};

#endif // #ifndef _SVX_OPTINET_HXX

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
<|endoftext|>