<commit_before>// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "app/message_box_flags.h"
#include "base/file_path.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/view_ids.h"
#include "chrome/test/automation/automation_proxy.h"
#include "chrome/test/automation/browser_proxy.h"
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/automation/window_proxy.h"
#include "chrome/test/ui/ui_test.h"
#include "chrome/test/ui_test_utils.h"
#include "gfx/rect.h"
#include "views/event.h"

class FastShutdown : public UITest {
};

#if defined(OS_MACOSX)
// SimulateOSClick is broken on the Mac: http://crbug.com/45162
#define MAYBE_SlowTermination DISABLED_SlowTermination
#elif defined(OS_LINUX)
// http://crbug.com/46614
#define MAYBE_SlowTermination FAILS_SlowTermination
#else
#define MAYBE_SlowTermination SlowTermination
#endif

// This tests for a previous error where uninstalling an onbeforeunload
// handler would enable fast shutdown even if an onUnload handler still
// existed.
TEST_F(FastShutdown, MAYBE_SlowTermination) {
  scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
  ASSERT_TRUE(browser.get());
  scoped_refptr<WindowProxy> window(browser->GetWindow());
  ASSERT_TRUE(window.get());

  // This page has an unload handler.
  const FilePath dir(FILE_PATH_LITERAL("fast_shutdown"));
  const FilePath file(FILE_PATH_LITERAL("on_unloader.html"));
  NavigateToURL(ui_test_utils::GetTestUrl(dir, file));
  gfx::Rect bounds;
  ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_CONTAINER, &bounds, true));
  // This click will launch a popup which has a before unload handler.
  ASSERT_TRUE(window->SimulateOSClick(bounds.CenterPoint(),
                                      views::Event::EF_LEFT_BUTTON_DOWN));
  ASSERT_TRUE(browser->WaitForTabCountToBecome(2, action_max_timeout_ms()));
  // Close the tab, removing the one and only before unload handler.
  scoped_refptr<TabProxy> tab(browser->GetTab(1));
  ASSERT_TRUE(tab->Close(true));

  // Close the browser. We should launch the unload handler, which is an
  // alert().
  ASSERT_TRUE(browser->ApplyAccelerator(IDC_CLOSE_WINDOW));
  ASSERT_TRUE(automation()->WaitForAppModalDialog());
  ASSERT_TRUE(automation()->ClickAppModalDialogButton(
                  MessageBoxFlags::DIALOGBUTTON_OK));
}
<commit_msg>Re-disable FastShutdown.SlowTermination on Windows<commit_after>// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "app/message_box_flags.h"
#include "base/file_path.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/view_ids.h"
#include "chrome/test/automation/automation_proxy.h"
#include "chrome/test/automation/browser_proxy.h"
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/automation/window_proxy.h"
#include "chrome/test/ui/ui_test.h"
#include "chrome/test/ui_test_utils.h"
#include "gfx/rect.h"
#include "views/event.h"

class FastShutdown : public UITest {
};

#if defined(OS_MACOSX)
// SimulateOSClick is broken on the Mac: http://crbug.com/45162
#define MAYBE_SlowTermination DISABLED_SlowTermination
#elif defined(OS_LINUX)
// http://crbug.com/46614
#define MAYBE_SlowTermination FAILS_SlowTermination
#else
// Times out: http://crbug.com/46616
#define MAYBE_SlowTermination DISABLED_SlowTermination
#endif

// This tests for a previous error where uninstalling an onbeforeunload
// handler would enable fast shutdown even if an onUnload handler still
// existed.
TEST_F(FastShutdown, MAYBE_SlowTermination) {
  scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
  ASSERT_TRUE(browser.get());
  scoped_refptr<WindowProxy> window(browser->GetWindow());
  ASSERT_TRUE(window.get());

  // This page has an unload handler.
  const FilePath dir(FILE_PATH_LITERAL("fast_shutdown"));
  const FilePath file(FILE_PATH_LITERAL("on_unloader.html"));
  NavigateToURL(ui_test_utils::GetTestUrl(dir, file));
  gfx::Rect bounds;
  ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_CONTAINER, &bounds, true));
  // This click will launch a popup which has a before unload handler.
  ASSERT_TRUE(window->SimulateOSClick(bounds.CenterPoint(),
                                      views::Event::EF_LEFT_BUTTON_DOWN));
  ASSERT_TRUE(browser->WaitForTabCountToBecome(2, action_max_timeout_ms()));
  // Close the tab, removing the one and only before unload handler.
  scoped_refptr<TabProxy> tab(browser->GetTab(1));
  ASSERT_TRUE(tab->Close(true));

  // Close the browser. We should launch the unload handler, which is an
  // alert().
  ASSERT_TRUE(browser->ApplyAccelerator(IDC_CLOSE_WINDOW));
  ASSERT_TRUE(automation()->WaitForAppModalDialog());
  ASSERT_TRUE(automation()->ClickAppModalDialogButton(
                  MessageBoxFlags::DIALOGBUTTON_OK));
}
<|endoftext|>


<commit_before>// @(#)root/cintex:$Id$
// Author: Pere Mato 2005

// Copyright CERN, CH-1211 Geneva 23, 2004-2005, All rights reserved.
//
// Permission to use, copy, modify, and distribute this software for any
// purpose is hereby granted without fee, provided that this copyright and
// permissions notice appear in all copies and derivatives.
//
// This software is provided "as is" without express or implied warranty.

#include "Reflex/Reflex.h"
#include "Reflex/Tools.h"
#include "Cintex/Cintex.h"
#include "CINTdefs.h"
#include "CINTScopeBuilder.h"
#include "CINTClassBuilder.h"
#include "CINTTypedefBuilder.h"
#include "Api.h"
#include "Typedf.h"
#include "TError.h"

#include <set>

using namespace ROOT::Reflex;
using namespace std;

namespace ROOT {

   namespace Cintex {

      int CINTTypedefBuilder::Setup(const Type& t) {
         // Setup typedef info.
         if ( t.IsTypedef() )  {

            std::string nam = CintName(t.Name(SCOPED));

            static bool init = false;
            static std::set<std::string> exclusionList;
            if (!init) {
               exclusionList.insert("stringstream");
               init = true;
            }
            if ( exclusionList.find(nam) != exclusionList.end() ) {
               return -1;
            }

            Type rt(t);
            Scope scope = rt.DeclaringScope();
            CINTScopeBuilder::Setup( scope );
            while ( rt.IsTypedef() ) rt = rt.ToType();

            Indirection indir = IndirectionGet(rt);
            Scope rscope = indir.second.DeclaringScope();

            if ( scope != rscope ) {
               if ( rscope ) CINTScopeBuilder::Setup(rscope);
               else {
                  rscope = Scope::ByName(Tools::GetScopeName(indir.second.Name(SCOPED)));
                  CINTScopeBuilder::Setup(rscope);
               }
            }

            if( -1 != G__defined_typename(nam.c_str()) ) return -1;

            if ( Cintex::Debug() )  {
               std::cout << "Cintex: Building typedef " << nam << std::endl;
            }

            int rtypenum;
            int rtagnum;
            CintType(rt, rtypenum, rtagnum );

            int stagnum = -1;
            if ( !scope.IsTopScope() ) stagnum = ::G__defined_tagname(CintName(scope.Name(SCOPED)).c_str(), 1);

            int r = ::G__search_typename2( t.Name().c_str(), rtypenum, rtagnum, 0, stagnum);
            ::G__setnewtype(-1,NULL,0);

            static bool alreadyWarnedAboutTooManyTypedefs = false;
            if (!alreadyWarnedAboutTooManyTypedefs
                && Cint::G__TypedefInfo::GetNumTypedefs() > 0.9 * G__MAXTYPEDEF) {
               alreadyWarnedAboutTooManyTypedefs = true;
               Warning("CINTTypedefBuilder::Setup()",
                       "%ld out of %ld possible entries are in use!",
                       (int)Cint::G__TypedefInfo::GetNumTypedefs(), (int)G__MAXTYPEDEF);
            }

            return r;
         }
         return -1;
      }

      void CINTTypedefBuilder::Set(const char* name, const char* value) {
         // As the function name indicates
         static bool alreadyWarnedAboutTooManyTypedefs = false;
         G__linked_taginfo taginfo;
         taginfo.tagnum  = -1;   // >> need to be pre-initialized to be understood by CINT
         taginfo.tagtype = 'c';
         taginfo.tagname = value;
         G__search_typename2(name, 117, G__get_linked_tagnum(&taginfo),0,-1);
         if (!alreadyWarnedAboutTooManyTypedefs
             && Cint::G__TypedefInfo::GetNumTypedefs() > 0.9 * G__MAXTYPEDEF) {
            alreadyWarnedAboutTooManyTypedefs = true;
            Warning("CINTTypedefBuilder::Set()",
                    "%ld out of %ld possible entries are in use!",
                    (int)Cint::G__TypedefInfo::GetNumTypedefs(), (int)G__MAXTYPEDEF);
         }
         G__setnewtype(-1,NULL,0);
      }
   }
}
<commit_msg>Fix format in Warning statements<commit_after>// @(#)root/cintex:$Id$
// Author: Pere Mato 2005

// Copyright CERN, CH-1211 Geneva 23, 2004-2005, All rights reserved.
//
// Permission to use, copy, modify, and distribute this software for any
// purpose is hereby granted without fee, provided that this copyright and
// permissions notice appear in all copies and derivatives.
//
// This software is provided "as is" without express or implied warranty.

#include "Reflex/Reflex.h"
#include "Reflex/Tools.h"
#include "Cintex/Cintex.h"
#include "CINTdefs.h"
#include "CINTScopeBuilder.h"
#include "CINTClassBuilder.h"
#include "CINTTypedefBuilder.h"
#include "Api.h"
#include "Typedf.h"
#include "TError.h"

#include <set>

using namespace ROOT::Reflex;
using namespace std;

namespace ROOT {

   namespace Cintex {

      int CINTTypedefBuilder::Setup(const Type& t) {
         // Setup typedef info.
         if ( t.IsTypedef() )  {

            std::string nam = CintName(t.Name(SCOPED));

            static bool init = false;
            static std::set<std::string> exclusionList;
            if (!init) {
               exclusionList.insert("stringstream");
               init = true;
            }
            if ( exclusionList.find(nam) != exclusionList.end() ) {
               return -1;
            }

            Type rt(t);
            Scope scope = rt.DeclaringScope();
            CINTScopeBuilder::Setup( scope );
            while ( rt.IsTypedef() ) rt = rt.ToType();

            Indirection indir = IndirectionGet(rt);
            Scope rscope = indir.second.DeclaringScope();

            if ( scope != rscope ) {
               if ( rscope ) CINTScopeBuilder::Setup(rscope);
               else {
                  rscope = Scope::ByName(Tools::GetScopeName(indir.second.Name(SCOPED)));
                  CINTScopeBuilder::Setup(rscope);
               }
            }

            if( -1 != G__defined_typename(nam.c_str()) ) return -1;

            if ( Cintex::Debug() )  {
               std::cout << "Cintex: Building typedef " << nam << std::endl;
            }

            int rtypenum;
            int rtagnum;
            CintType(rt, rtypenum, rtagnum );

            int stagnum = -1;
            if ( !scope.IsTopScope() ) stagnum = ::G__defined_tagname(CintName(scope.Name(SCOPED)).c_str(), 1);

            int r = ::G__search_typename2( t.Name().c_str(), rtypenum, rtagnum, 0, stagnum);
            ::G__setnewtype(-1,NULL,0);

            static bool alreadyWarnedAboutTooManyTypedefs = false;
            if (!alreadyWarnedAboutTooManyTypedefs
                && Cint::G__TypedefInfo::GetNumTypedefs() > 0.9 * G__MAXTYPEDEF) {
               alreadyWarnedAboutTooManyTypedefs = true;
               Warning("CINTTypedefBuilder::Setup()",
                       "%d out of %d possible entries are in use!",
                       (int)Cint::G__TypedefInfo::GetNumTypedefs(), (int)G__MAXTYPEDEF);
            }

            return r;
         }
         return -1;
      }

      void CINTTypedefBuilder::Set(const char* name, const char* value) {
         // As the function name indicates
         static bool alreadyWarnedAboutTooManyTypedefs = false;
         G__linked_taginfo taginfo;
         taginfo.tagnum  = -1;   // >> need to be pre-initialized to be understood by CINT
         taginfo.tagtype = 'c';
         taginfo.tagname = value;
         G__search_typename2(name, 117, G__get_linked_tagnum(&taginfo),0,-1);
         if (!alreadyWarnedAboutTooManyTypedefs
             && Cint::G__TypedefInfo::GetNumTypedefs() > 0.9 * G__MAXTYPEDEF) {
            alreadyWarnedAboutTooManyTypedefs = true;
            Warning("CINTTypedefBuilder::Set()",
                    "%d out of %d possible entries are in use!",
                    (int)Cint::G__TypedefInfo::GetNumTypedefs(), (int)G__MAXTYPEDEF);
         }
         G__setnewtype(-1,NULL,0);
      }
   }
}
<|endoftext|>


<commit_before>#ifndef __ciri_itexturecube__
#define __ciri_itexturecube__

#include "../ErrorCodes.hpp"

namespace ciri {
	class ITextureCube {
	public:
		ITextureCube() {
		}
		virtual ~ITextureCube() {
		}

		virtual err::ErrorCode set( int width, int height, void* right, void* left, void* top, void* bottom, void* back, void* front )=0;

		virtual void destroy()=0;
	};
} // ciri

#endif/* __ciri_itexturecube__ */
<commit_msg>Updated ITextureCube header.<commit_after>#ifndef __ciri_itexturecube__
#define __ciri_itexturecube__

#include "../ErrorCodes.hpp"

namespace ciri {
	class ITextureCube {
	public:
		ITextureCube() {
		}
		virtual ~ITextureCube() {
		}

		virtual err::ErrorCode set( int width, int height, void* posx, void* negx, void* posy, void* negy, void* posz, void* negz )=0;

		virtual void destroy()=0;
	};
} // ciri

#endif/* __ciri_itexturecube__ */
<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  $RCSfile: hierarchyprovider.cxx,v $
 *
 *  $Revision: 1.6 $
 *
 *  last change: $Author: kso $ $Date: 2001-05-08 12:58:41 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 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
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): Kai Sommerfeld ( kso@sun.com )
 *
 *
 ************************************************************************/

/**************************************************************************
                                TODO
 **************************************************************************

 *************************************************************************/

#ifndef _COM_SUN_STAR_CONTAINER_XHIERARCHICALNAMEACCESS_HPP_
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#endif
#ifndef _VOS_DIAGNOSE_HXX_
#include <vos/diagnose.hxx>
#endif
#ifndef _UCBHELPER_CONTENTIDENTIFIER_HXX
#include <ucbhelper/contentidentifier.hxx>
#endif

#ifndef _HIERARCHYPROVIDER_HXX
#include "hierarchyprovider.hxx"
#endif
#ifndef _HIERARCHYCONTENT_HXX
#include "hierarchycontent.hxx"
#endif

using namespace com::sun::star::container;
using namespace com::sun::star::lang;
using namespace com::sun::star::ucb;
using namespace com::sun::star::uno;
using namespace rtl;

using namespace hierarchy_ucp;

//=========================================================================
//=========================================================================
//
// HierarchyContentProvider Implementation.
//
//=========================================================================
//=========================================================================

HierarchyContentProvider::HierarchyContentProvider(
                        const Reference< XMultiServiceFactory >& rXSMgr )
: ::ucb::ContentProviderImplHelper( rXSMgr ),
  m_bTriedToGetRootReadAccess( sal_False )
{
}

//=========================================================================
// virtual
HierarchyContentProvider::~HierarchyContentProvider()
{
}

//=========================================================================
//
// XInterface methods.
//
//=========================================================================

XINTERFACE_IMPL_4( HierarchyContentProvider,
                   XTypeProvider,
                   XServiceInfo,
                   XContentProvider,
                   XInitialization );

//=========================================================================
//
// XTypeProvider methods.
//
//=========================================================================

XTYPEPROVIDER_IMPL_4( HierarchyContentProvider,
                         XTypeProvider,
                         XServiceInfo,
                         XContentProvider,
                      XInitialization );

//=========================================================================
//
// XServiceInfo methods.
//
//=========================================================================

XSERVICEINFO_IMPL_1( HierarchyContentProvider,
                     OUString::createFromAscii(
                         "com.sun.star.comp.ucb.HierarchyContentProvider" ),
                     OUString::createFromAscii(
                         HIERARCHY_CONTENT_PROVIDER_SERVICE_NAME ) );

//=========================================================================
//
// Service factory implementation.
//
//=========================================================================

ONE_INSTANCE_SERVICE_FACTORY_IMPL( HierarchyContentProvider );

//=========================================================================
//
// XContentProvider methods.
//
//=========================================================================

// virtual
Reference< XContent > SAL_CALL HierarchyContentProvider::queryContent(
                        const Reference< XContentIdentifier >& Identifier )
    throw( IllegalIdentifierException, RuntimeException )
{
    vos::OGuard aGuard( m_aMutex );

    // Check URL scheme...

    OUString aScheme( OUString::createFromAscii( HIERARCHY_URL_SCHEME ) );
    if ( !Identifier->getContentProviderScheme().equalsIgnoreCase( aScheme ) )
        throw IllegalIdentifierException();

    // Check URL. Must be at least the URL of the Root Folder.
    OUString aId = Identifier->getContentIdentifier();
    if ( aId.compareToAscii( HIERARCHY_ROOT_FOLDER_URL,
                             HIERARCHY_ROOT_FOLDER_URL_LENGTH ) != 0 )
        throw IllegalIdentifierException();

    // Remove trailing slash, except from Root folder URL.
    if ( aId.getLength() > HIERARCHY_ROOT_FOLDER_URL_LENGTH )
    {
        sal_Int32 nPos = aId.lastIndexOf( '/' );
        if ( nPos == aId.getLength() - 1 )
            aId = aId.copy( 0, aId.getLength() - 1 );
    }

    // Encode URL and create new Id. This may "correct" user-typed-in URL's.
    Reference< XContentIdentifier > xCanonicId =
                new ::ucb::ContentIdentifier( m_xSMgr, encodeURL( aId ) );

    // Check, if a content with given id already exists...
    Reference< XContent > xContent
        = queryExistingContent( xCanonicId ).getBodyPtr();
    if ( xContent.is() )
        return xContent;

    // Create a new content. Note that the content will insert itself
    // into m_pContents by calling addContent(...) from it's ctor.

    xContent = HierarchyContent::create( m_xSMgr, this, xCanonicId );

    if ( xContent.is() && !xContent->getIdentifier().is() )
        throw IllegalIdentifierException();

    return xContent;
}

//=========================================================================
//
// XInitialization methods.
//
//=========================================================================

// virtual
void SAL_CALL HierarchyContentProvider::initialize(
                                    const Sequence< Any >& aArguments )
    throw( Exception, RuntimeException )
{
    if ( aArguments.getLength() > 0 )
    {
         // Extract config provider from service init args.
         aArguments[ 0 ] >>= m_xConfigProvider;

        VOS_ENSURE( m_xConfigProvider.is(),
                    "HierarchyContentProvider::initialize - "
                    "No config provider!" );
    }
}

//=========================================================================
//
//  Non-interface methods.
//
//=========================================================================

Reference< XMultiServiceFactory > HierarchyContentProvider::getConfigProvider()
{
    if ( !m_xConfigProvider.is() )
    {
        vos::OGuard aGuard( m_aMutex );
        if ( !m_xConfigProvider.is() )
        {
            try
            {
               m_xConfigProvider = Reference< XMultiServiceFactory >(
                    m_xSMgr->createInstance(
                        OUString::createFromAscii( "com.sun.star.configuration."
                                                   "ConfigurationProvider" ) ),
                    UNO_QUERY );

                VOS_ENSURE( m_xConfigProvider.is(),
                            "HierarchyContentProvider::getConfigProvider - "
                            "No config provider!" );
            }
            catch ( Exception& )
            {
                VOS_ENSURE( sal_False,
                               "HierarchyContentProvider::getConfigProvider - "
                               "caught exception!" );
            }
        }
    }

    return m_xConfigProvider;
}

//=========================================================================
Reference< XHierarchicalNameAccess >
HierarchyContentProvider::getRootConfigReadNameAccess()
{
    if ( !m_xRootConfigReadNameAccess.is() )
    {
        vos::OGuard aGuard( m_aMutex );
        if ( !m_xRootConfigReadNameAccess.is() )
        {
            if ( m_bTriedToGetRootReadAccess ) // #82494#
            {
                OSL_ENSURE( sal_False,
                    "HierarchyContentProvider::getRootConfigReadNameAccess - "
                    "Unable to read any config data! -> #82494#" );
                return Reference< XHierarchicalNameAccess >();
            }

            try
            {
                getConfigProvider();

                if ( m_xConfigProvider.is() )
                {
                    Sequence< Any > aArguments( 1 );
                    aArguments[ 0 ] <<= OUString::createFromAscii(
                                        "/org.openoffice.ucb.Hierarchy/Root" );

                    m_bTriedToGetRootReadAccess = sal_True;

                    m_xRootConfigReadNameAccess
                        = Reference< XHierarchicalNameAccess >(
                            m_xConfigProvider->createInstanceWithArguments(
                                OUString::createFromAscii(
                                    "com.sun.star.configuration."
                                    "ConfigurationAccess" ),
                                aArguments ),
                            UNO_QUERY );
                }
            }
            catch ( RuntimeException& )
            {
                throw;
            }
            catch ( Exception& )
            {
                // createInstance, createInstanceWithArguments

                VOS_ENSURE( sal_False,
                    "HierarchyContentProvider::getRootConfigReadNameAccess - "
                    "caught Exception!" );
            }
        }
    }

    return m_xRootConfigReadNameAccess;
}

<commit_msg>Adapted to RTL string changes.<commit_after>/*************************************************************************
 *
 *  $RCSfile: hierarchyprovider.cxx,v $
 *
 *  $Revision: 1.7 $
 *
 *  last change: $Author: kso $ $Date: 2001-05-14 08:24:02 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 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
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): Kai Sommerfeld ( kso@sun.com )
 *
 *
 ************************************************************************/

/**************************************************************************
                                TODO
 **************************************************************************

 *************************************************************************/

#ifndef _COM_SUN_STAR_CONTAINER_XHIERARCHICALNAMEACCESS_HPP_
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#endif
#ifndef _VOS_DIAGNOSE_HXX_
#include <vos/diagnose.hxx>
#endif
#ifndef _UCBHELPER_CONTENTIDENTIFIER_HXX
#include <ucbhelper/contentidentifier.hxx>
#endif

#ifndef _HIERARCHYPROVIDER_HXX
#include "hierarchyprovider.hxx"
#endif
#ifndef _HIERARCHYCONTENT_HXX
#include "hierarchycontent.hxx"
#endif

using namespace com::sun::star::container;
using namespace com::sun::star::lang;
using namespace com::sun::star::ucb;
using namespace com::sun::star::uno;
using namespace rtl;

using namespace hierarchy_ucp;

//=========================================================================
//=========================================================================
//
// HierarchyContentProvider Implementation.
//
//=========================================================================
//=========================================================================

HierarchyContentProvider::HierarchyContentProvider(
                        const Reference< XMultiServiceFactory >& rXSMgr )
: ::ucb::ContentProviderImplHelper( rXSMgr ),
  m_bTriedToGetRootReadAccess( sal_False )
{
}

//=========================================================================
// virtual
HierarchyContentProvider::~HierarchyContentProvider()
{
}

//=========================================================================
//
// XInterface methods.
//
//=========================================================================

XINTERFACE_IMPL_4( HierarchyContentProvider,
                   XTypeProvider,
                   XServiceInfo,
                   XContentProvider,
                   XInitialization );

//=========================================================================
//
// XTypeProvider methods.
//
//=========================================================================

XTYPEPROVIDER_IMPL_4( HierarchyContentProvider,
                         XTypeProvider,
                         XServiceInfo,
                         XContentProvider,
                      XInitialization );

//=========================================================================
//
// XServiceInfo methods.
//
//=========================================================================

XSERVICEINFO_IMPL_1( HierarchyContentProvider,
                     OUString::createFromAscii(
                         "com.sun.star.comp.ucb.HierarchyContentProvider" ),
                     OUString::createFromAscii(
                         HIERARCHY_CONTENT_PROVIDER_SERVICE_NAME ) );

//=========================================================================
//
// Service factory implementation.
//
//=========================================================================

ONE_INSTANCE_SERVICE_FACTORY_IMPL( HierarchyContentProvider );

//=========================================================================
//
// XContentProvider methods.
//
//=========================================================================

// virtual
Reference< XContent > SAL_CALL HierarchyContentProvider::queryContent(
                        const Reference< XContentIdentifier >& Identifier )
    throw( IllegalIdentifierException, RuntimeException )
{
    vos::OGuard aGuard( m_aMutex );

    // Check URL scheme...

    OUString aScheme( OUString::createFromAscii( HIERARCHY_URL_SCHEME ) );
    if ( !Identifier->getContentProviderScheme().equalsIgnoreAsciiCase(
                                                                aScheme ) )
        throw IllegalIdentifierException();

    // Check URL. Must be at least the URL of the Root Folder.
    OUString aId = Identifier->getContentIdentifier();
    if ( aId.compareToAscii( HIERARCHY_ROOT_FOLDER_URL,
                             HIERARCHY_ROOT_FOLDER_URL_LENGTH ) != 0 )
        throw IllegalIdentifierException();

    // Remove trailing slash, except from Root folder URL.
    if ( aId.getLength() > HIERARCHY_ROOT_FOLDER_URL_LENGTH )
    {
        sal_Int32 nPos = aId.lastIndexOf( '/' );
        if ( nPos == aId.getLength() - 1 )
            aId = aId.copy( 0, aId.getLength() - 1 );
    }

    // Encode URL and create new Id. This may "correct" user-typed-in URL's.
    Reference< XContentIdentifier > xCanonicId =
                new ::ucb::ContentIdentifier( m_xSMgr, encodeURL( aId ) );

    // Check, if a content with given id already exists...
    Reference< XContent > xContent
        = queryExistingContent( xCanonicId ).getBodyPtr();
    if ( xContent.is() )
        return xContent;

    // Create a new content. Note that the content will insert itself
    // into m_pContents by calling addContent(...) from it's ctor.

    xContent = HierarchyContent::create( m_xSMgr, this, xCanonicId );

    if ( xContent.is() && !xContent->getIdentifier().is() )
        throw IllegalIdentifierException();

    return xContent;
}

//=========================================================================
//
// XInitialization methods.
//
//=========================================================================

// virtual
void SAL_CALL HierarchyContentProvider::initialize(
                                    const Sequence< Any >& aArguments )
    throw( Exception, RuntimeException )
{
    if ( aArguments.getLength() > 0 )
    {
         // Extract config provider from service init args.
         aArguments[ 0 ] >>= m_xConfigProvider;

        VOS_ENSURE( m_xConfigProvider.is(),
                    "HierarchyContentProvider::initialize - "
                    "No config provider!" );
    }
}

//=========================================================================
//
//  Non-interface methods.
//
//=========================================================================

Reference< XMultiServiceFactory > HierarchyContentProvider::getConfigProvider()
{
    if ( !m_xConfigProvider.is() )
    {
        vos::OGuard aGuard( m_aMutex );
        if ( !m_xConfigProvider.is() )
        {
            try
            {
               m_xConfigProvider = Reference< XMultiServiceFactory >(
                    m_xSMgr->createInstance(
                        OUString::createFromAscii( "com.sun.star.configuration."
                                                   "ConfigurationProvider" ) ),
                    UNO_QUERY );

                VOS_ENSURE( m_xConfigProvider.is(),
                            "HierarchyContentProvider::getConfigProvider - "
                            "No config provider!" );
            }
            catch ( Exception& )
            {
                VOS_ENSURE( sal_False,
                               "HierarchyContentProvider::getConfigProvider - "
                               "caught exception!" );
            }
        }
    }

    return m_xConfigProvider;
}

//=========================================================================
Reference< XHierarchicalNameAccess >
HierarchyContentProvider::getRootConfigReadNameAccess()
{
    if ( !m_xRootConfigReadNameAccess.is() )
    {
        vos::OGuard aGuard( m_aMutex );
        if ( !m_xRootConfigReadNameAccess.is() )
        {
            if ( m_bTriedToGetRootReadAccess ) // #82494#
            {
                OSL_ENSURE( sal_False,
                    "HierarchyContentProvider::getRootConfigReadNameAccess - "
                    "Unable to read any config data! -> #82494#" );
                return Reference< XHierarchicalNameAccess >();
            }

            try
            {
                getConfigProvider();

                if ( m_xConfigProvider.is() )
                {
                    Sequence< Any > aArguments( 1 );
                    aArguments[ 0 ] <<= OUString::createFromAscii(
                                        "/org.openoffice.ucb.Hierarchy/Root" );

                    m_bTriedToGetRootReadAccess = sal_True;

                    m_xRootConfigReadNameAccess
                        = Reference< XHierarchicalNameAccess >(
                            m_xConfigProvider->createInstanceWithArguments(
                                OUString::createFromAscii(
                                    "com.sun.star.configuration."
                                    "ConfigurationAccess" ),
                                aArguments ),
                            UNO_QUERY );
                }
            }
            catch ( RuntimeException& )
            {
                throw;
            }
            catch ( Exception& )
            {
                // createInstance, createInstanceWithArguments

                VOS_ENSURE( sal_False,
                    "HierarchyContentProvider::getRootConfigReadNameAccess - "
                    "caught Exception!" );
            }
        }
    }

    return m_xRootConfigReadNameAccess;
}

<|endoftext|>


<commit_before>// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#include <BALL/VIEW/DIALOGS/materialSettings.h>
#include <BALL/VIEW/WIDGETS/scene.h>

#include <qlabel.h>
#include <qbuttongroup.h>
#include <qradiobutton.h>
#include <qslider.h>

namespace BALL
{
	namespace VIEW
	{

MaterialSettings::MaterialSettings( QWidget* parent,  const char* name, WFlags fl )
    : MaterialSettingsData( parent, name, fl )
{
	scene_ = (Scene*) parent;
	diffuse_button->setChecked(true);
	setDefaultValues();
}

void MaterialSettings::updateFromStage()
	throw()
{
}

void MaterialSettings::update()
	throw()
{
}

void MaterialSettings::apply()
	throw()
{
	glMaterialfv(GL_FRONT, GL_SPECULAR,  material_values_[0]);
	glMaterialfv(GL_FRONT, GL_DIFFUSE,   material_values_[1]);
	glMaterialfv(GL_FRONT, GL_AMBIENT,   material_values_[2]);
	glMaterialfv(GL_FRONT, GL_SHININESS, &shininess_);
}

void MaterialSettings::setDefaultValues()
	throw()
{
	for (Position i = 0; i < 4; i++)
	{
		material_values_[0][i] = 0.774597;
	}
	for (Position i = 0; i < 4; i++)
	{
		material_values_[1][i] = 0.4;
	}
	for (Position i = 0; i < 4; i++)
	{
		material_values_[2][i] = 0.25;
	}
	shininess_ = 76.8;

	setValues_();
}

void MaterialSettings::redChanged()
{
	setValues_(*red_slider, *red_label, 0);
}

void MaterialSettings::greenChanged()
{
	setValues_(*green_slider, *green_label, 1);
}

void MaterialSettings::blueChanged()
{
	setValues_(*blue_slider, *blue_label, 2);
}

void MaterialSettings::alphaChanged()
{
	setValues_(*alpha_slider, *alpha_label, 3);
}

void MaterialSettings::shininessChanged()
{
	shininess_label->setText(String(shininess_slider->value()).c_str());
	shininess_ = shininess_slider->value();
}

void MaterialSettings::materialSelected(int button_id)
{
		red_slider->setValue((int)(material_values_[button_id][0] * 10.0));
	green_slider->setValue((int)(material_values_[button_id][1] * 10.0));
	 blue_slider->setValue((int)(material_values_[button_id][2] * 10.0));
	alpha_slider->setValue((int)(material_values_[button_id][3] * 10.0));
}

void MaterialSettings::setValues_(const QSlider& slider, QLabel& label, Position pos)
{
	String text = String((float)slider.value() / 10.0);
	while (text.has('.') && text.hasSuffix("0"))
	{
		text = text.trimRight("0");
	}

	if (text.hasSuffix(".")) text += "0";

	label.setText(text.c_str());
	material_values_[material_group->selectedId()][pos] = slider.value() / 10.0;
}

void MaterialSettings::setValues_()
{
	materialSelected(material_group->selectedId());
	shininess_slider->setValue((int)shininess_);
	shininessChanged();
	redChanged();
	blueChanged();
	greenChanged();
	alphaChanged();
}

// NAMESPACE
} }
<commit_msg>*** empty log message ***<commit_after>// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#include <BALL/VIEW/DIALOGS/materialSettings.h>
#include <BALL/VIEW/WIDGETS/scene.h>

#include <qlabel.h>
#include <qbuttongroup.h>
#include <qradiobutton.h>
#include <qslider.h>

namespace BALL
{
	namespace VIEW
	{

		MaterialSettings::MaterialSettings( QWidget* parent,  const char* name, WFlags fl )
				: MaterialSettingsData( parent, name, fl )
		{
			scene_ = (Scene*) parent;
			diffuse_button->setChecked(true);
			setDefaultValues();
		}

		void MaterialSettings::updateFromStage()
			throw()
		{
		}

		void MaterialSettings::update()
			throw()
		{
		}

		void MaterialSettings::apply()
			throw()
		{
			glMaterialfv(GL_FRONT, GL_SPECULAR,  material_values_[0]);
			glMaterialfv(GL_FRONT, GL_DIFFUSE,   material_values_[1]);
			glMaterialfv(GL_FRONT, GL_AMBIENT,   material_values_[2]);
			glMaterialfv(GL_FRONT, GL_SHININESS, &shininess_);
		}

		void MaterialSettings::setDefaultValues()
			throw()
		{
			for (Position i = 0; i < 4; i++)
			{
				material_values_[0][i] = 0.774597;
			}
			for (Position i = 0; i < 4; i++)
			{
				material_values_[1][i] = 0.4;
			}
			for (Position i = 0; i < 4; i++)
			{
				material_values_[2][i] = 0.25;
			}
			shininess_ = 76.8;

			setValues_();
		}

		void MaterialSettings::redChanged()
		{
			setValues_(*red_slider, *red_label, 0);
		}

		void MaterialSettings::greenChanged()
		{
			setValues_(*green_slider, *green_label, 1);
		}

		void MaterialSettings::blueChanged()
		{
			setValues_(*blue_slider, *blue_label, 2);
		}

		void MaterialSettings::alphaChanged()
		{
			setValues_(*alpha_slider, *alpha_label, 3);
		}

		void MaterialSettings::shininessChanged()
		{
			shininess_label->setText(String(shininess_slider->value()).c_str());
			shininess_ = shininess_slider->value();
		}

		void MaterialSettings::materialSelected(int button_id)
		{
				red_slider->setValue((int)(material_values_[button_id][0] * 10.0));
			green_slider->setValue((int)(material_values_[button_id][1] * 10.0));
			 blue_slider->setValue((int)(material_values_[button_id][2] * 10.0));
			alpha_slider->setValue((int)(material_values_[button_id][3] * 10.0));
		}

		void MaterialSettings::setValues_(const QSlider& slider, QLabel& label, Position pos)
		{
			String text = String((float)slider.value() / 10.0);
			while (text.has('.') && text.hasSuffix("0"))
			{
				text = text.trimRight("0");
			}

			if (text.hasSuffix(".")) text += "0";

			label.setText(text.c_str());
			material_values_[material_group->selectedId()][pos] = slider.value() / 10.0;
		}

		void MaterialSettings::setValues_()
		{
			materialSelected(material_group->selectedId());
			shininess_slider->setValue((int)shininess_);
			shininessChanged();
			redChanged();
			blueChanged();
			greenChanged();
			alphaChanged();
		}

	} // namespace VIEW

} // namespace BALL
<|endoftext|>


<commit_before>/*
 * Distributed under the OSI-approved Apache License, Version 2.0.  See
 * accompanying file Copyright.txt for details.
 *
 * SscWriter.cpp
 *
 *  Created on: Nov 1, 2018
 *      Author: Jason Wang
 */

#include "SscWriter.tcc"
#include "adios2/helper/adiosComm.h"
#include "adios2/helper/adiosCommMPI.h"
#include "adios2/helper/adiosString.h"

namespace adios2
{
namespace core
{
namespace engine
{

SscWriter::SscWriter(IO &io, const std::string &name, const Mode mode,
                     helper::Comm comm)
: Engine("SscWriter", io, name, mode, std::move(comm))
{
    TAU_SCOPED_TIMER_FUNC();

    helper::GetParameter(m_IO.m_Parameters, "MpiMode", m_MpiMode);
    helper::GetParameter(m_IO.m_Parameters, "Verbose", m_Verbosity);
    helper::GetParameter(m_IO.m_Parameters, "OpenTimeoutSecs",
                         m_OpenTimeoutSecs);

    SyncMpiPattern();
    m_WriterRank = m_Comm.Rank();
    m_WriterSize = m_Comm.Size();
    MPI_Comm_rank(m_StreamComm, &m_StreamRank);
    MPI_Comm_size(m_StreamComm, &m_StreamSize);
}

StepStatus SscWriter::BeginStep(StepMode mode, const float timeoutSeconds)
{
    TAU_SCOPED_TIMER_FUNC();

    ++m_CurrentStep;

    if (m_Verbosity >= 5)
    {
        std::cout << "SscWriter::BeginStep, World Rank " << m_StreamRank
                  << ", Reader Rank " << m_WriterRank << ", Step "
                  << m_CurrentStep << std::endl;
    }

    if (m_CurrentStep == 0 || m_WriterDefinitionsLocked == false ||
        m_ReaderSelectionsLocked == false)
    {
        m_Buffer.resize(1, 0);
        m_GlobalWritePattern.clear();
        m_GlobalWritePattern.resize(m_StreamSize);
        m_GlobalReadPattern.clear();
        m_GlobalReadPattern.resize(m_StreamSize);
    }

    if (m_WriterDefinitionsLocked && m_ReaderSelectionsLocked)
    {
        if (m_CurrentStep > 1)
        {
            MpiWait();
        }
    }

    return StepStatus::OK;
}

size_t SscWriter::CurrentStep() const { return m_CurrentStep; }

void SscWriter::PerformPuts() { TAU_SCOPED_TIMER_FUNC(); }

void SscWriter::EndStep()
{
    TAU_SCOPED_TIMER_FUNC();

    if (m_Verbosity >= 5)
    {
        std::cout << "SscWriter::EndStep, World Rank " << m_StreamRank
                  << ", Reader Rank " << m_WriterRank << ", Step "
                  << m_CurrentStep << std::endl;
    }

    if (m_CurrentStep == 0)
    {
        SyncWritePattern();
        MPI_Win_create(m_Buffer.data(), m_Buffer.size(), 1, MPI_INFO_NULL,
                       m_StreamComm, &m_MpiWin);
        MPI_Win_free(&m_MpiWin);
        SyncReadPattern();
        if (m_WriterDefinitionsLocked && m_ReaderSelectionsLocked)
        {
            MPI_Win_create(m_Buffer.data(), m_Buffer.size(), 1, MPI_INFO_NULL,
                           m_StreamComm, &m_MpiWin);
        }
    }
    else
    {
        if (m_WriterDefinitionsLocked && m_ReaderSelectionsLocked)
        {
            if (m_MpiMode == "twosided")
            {
                for (const auto &i : m_AllSendingReaderRanks)
                {
                    m_MpiRequests.emplace_back();
                    MPI_Isend(m_Buffer.data(),
                              static_cast<int>(m_Buffer.size()), MPI_CHAR,
                              i.first, 0, m_StreamComm, &m_MpiRequests.back());
                }
            }
            else if (m_MpiMode == "onesidedfencepush")
            {
                MPI_Win_fence(0, m_MpiWin);
                for (const auto &i : m_AllSendingReaderRanks)
                {
                    MPI_Put(m_Buffer.data(), static_cast<int>(m_Buffer.size()),
                            MPI_CHAR, i.first, i.second.first,
                            static_cast<int>(m_Buffer.size()), MPI_CHAR,
                            m_MpiWin);
                }
            }
            else if (m_MpiMode == "onesidedpostpush")
            {
                MPI_Win_start(m_MpiAllReadersGroup, 0, m_MpiWin);
                for (const auto &i : m_AllSendingReaderRanks)
                {
                    MPI_Put(m_Buffer.data(), static_cast<int>(m_Buffer.size()),
                            MPI_CHAR, i.first, i.second.first,
                            static_cast<int>(m_Buffer.size()), MPI_CHAR,
                            m_MpiWin);
                }
            }
            else if (m_MpiMode == "onesidedfencepull")
            {
                MPI_Win_fence(0, m_MpiWin);
            }
            else if (m_MpiMode == "onesidedpostpull")
            {
                MPI_Win_post(m_MpiAllReadersGroup, 0, m_MpiWin);
            }
        }
        else
        {
            SyncWritePattern();
            MPI_Win_create(m_Buffer.data(), m_Buffer.size(), 1, MPI_INFO_NULL,
                           m_StreamComm, &m_MpiWin);
            MPI_Win_free(&m_MpiWin);
        }
    }
}

void SscWriter::Flush(const int transportIndex) { TAU_SCOPED_TIMER_FUNC(); }

// PRIVATE

void SscWriter::MpiWait()
{
    if (m_MpiMode == "twosided")
    {
        MPI_Waitall(m_MpiRequests.size(), m_MpiRequests.data(),
                    MPI_STATUSES_IGNORE);
        m_MpiRequests.clear();
    }
    else if (m_MpiMode == "onesidedfencepush")
    {
        MPI_Win_fence(0, m_MpiWin);
    }
    else if (m_MpiMode == "onesidedpostpush")
    {
        MPI_Win_complete(m_MpiWin);
    }
    else if (m_MpiMode == "onesidedfencepull")
    {
        MPI_Win_fence(0, m_MpiWin);
    }
    else if (m_MpiMode == "onesidedpostpull")
    {
        MPI_Win_wait(m_MpiWin);
    }
}

void SscWriter::SyncMpiPattern()
{
    TAU_SCOPED_TIMER_FUNC();

    MPI_Group streamGroup;
    MPI_Group writerGroup;
    MPI_Comm writerComm;
    MPI_Comm readerComm;

    helper::HandshakeComm(m_Name, 'w', m_OpenTimeoutSecs, CommAsMPI(m_Comm),
                          streamGroup, writerGroup, m_MpiAllReadersGroup,
                          m_StreamComm, writerComm, readerComm);
}

void SscWriter::SyncWritePattern(bool finalStep)
{
    TAU_SCOPED_TIMER_FUNC();
    if (m_Verbosity >= 5)
    {
        std::cout << "SscWriter::SyncWritePattern, World Rank " << m_StreamRank
                  << ", Writer Rank " << m_WriterRank << ", Step "
                  << m_CurrentStep << std::endl;
    }

    nlohmann::json localRankMetaJ;

    ssc::BlockVecToJson(m_GlobalWritePattern[m_StreamRank], localRankMetaJ);

    if (m_WriterRank == 0)
    {
        ssc::AttributeMapToJson(m_IO, localRankMetaJ);
        localRankMetaJ["Pattern"] = m_WriterDefinitionsLocked;
    }
    if (finalStep)
    {
        localRankMetaJ["FinalStep"] = true;
    }

    std::string localStr = localRankMetaJ.dump();

    // aggregate global write pattern
    size_t localSize = localStr.size();
    size_t maxLocalSize;
    MPI_Allreduce(&localSize, &maxLocalSize, 1, MPI_UNSIGNED_LONG_LONG, MPI_MAX,
                  m_StreamComm);
    std::vector<char> localVec(maxLocalSize, '\0');
    std::memcpy(localVec.data(), localStr.data(), localStr.size());
    std::vector<char> globalVec(maxLocalSize * m_StreamSize, '\0');
    MPI_Allgather(localVec.data(), maxLocalSize, MPI_CHAR, globalVec.data(),
                  maxLocalSize, MPI_CHAR, m_StreamComm);

    // deserialize global metadata Json
    nlohmann::json globalJson;
    ssc::LocalJsonToGlobalJson(globalVec, maxLocalSize, m_StreamSize,
                               globalJson);

    // deserialize variables metadata
    ssc::JsonToBlockVecVec(globalJson, m_GlobalWritePattern);
}

void SscWriter::SyncReadPattern()
{
    TAU_SCOPED_TIMER_FUNC();
    if (m_Verbosity >= 5)
    {
        std::cout << "SscWriter::SyncReadPattern, World Rank " << m_StreamRank
                  << ", Writer Rank " << m_WriterRank << ", Step "
                  << m_CurrentStep << std::endl;
    }

    size_t localSize = 0;
    size_t maxLocalSize;
    MPI_Allreduce(&localSize, &maxLocalSize, 1, MPI_UNSIGNED_LONG_LONG, MPI_MAX,
                  m_StreamComm);
    std::vector<char> localVec(maxLocalSize, '\0');
    std::vector<char> globalVec(maxLocalSize * m_StreamSize);
    MPI_Allgather(localVec.data(), maxLocalSize, MPI_CHAR, globalVec.data(),
                  maxLocalSize, MPI_CHAR, m_StreamComm);

    // deserialize global metadata Json
    nlohmann::json globalJson;
    try
    {
        for (size_t i = 0; i < m_StreamSize; ++i)
        {
            if (globalVec[i * maxLocalSize] == '\0')
            {
                globalJson[i] = nullptr;
            }
            else
            {
                globalJson[i] = nlohmann::json::parse(
                    globalVec.begin() + i * maxLocalSize,
                    globalVec.begin() + (i + 1) * maxLocalSize);
            }
        }
    }
    catch (std::exception &e)
    {
        throw(std::runtime_error(
            std::string("corrupted global read pattern metadata, ") +
            std::string(e.what())));
    }

    ssc::JsonToBlockVecVec(globalJson, m_GlobalReadPattern);
    m_AllSendingReaderRanks = ssc::CalculateOverlap(
        m_GlobalReadPattern, m_GlobalWritePattern[m_StreamRank]);
    CalculatePosition(m_GlobalWritePattern, m_GlobalReadPattern, m_WriterRank,
                      m_AllSendingReaderRanks);

    for (int i = 0; i < m_StreamSize; ++i)
    {
        auto &patternJson = globalJson[i]["Pattern"];
        if (patternJson != nullptr)
        {
            m_ReaderSelectionsLocked = patternJson.get<bool>();
        }
    }

    if (m_Verbosity >= 10)
    {
        ssc::PrintBlockVecVec(m_GlobalWritePattern, "Global Write Pattern");
        ssc::PrintBlockVec(m_GlobalWritePattern[m_WriterRank],
                           "Local Write Pattern");
    }
}

void SscWriter::CalculatePosition(ssc::BlockVecVec &writerVecVec,
                                  ssc::BlockVecVec &readerVecVec,
                                  const int writerRank,
                                  ssc::RankPosMap &allOverlapRanks)
{
    TAU_SCOPED_TIMER_FUNC();
    for (auto &overlapRank : allOverlapRanks)
    {
        auto &readerRankMap = readerVecVec[overlapRank.first];
        auto currentReaderOverlapWriterRanks =
            CalculateOverlap(writerVecVec, readerRankMap);
        size_t bufferPosition = 0;
        for (size_t rank = 0; rank < writerVecVec.size(); ++rank)
        {
            bool hasOverlap = false;
            for (const auto r : currentReaderOverlapWriterRanks)
            {
                if (r.first == rank)
                {
                    hasOverlap = true;
                    break;
                }
            }
            if (hasOverlap)
            {
                currentReaderOverlapWriterRanks[rank].first = bufferPosition;
                auto &bv = writerVecVec[rank];
                size_t currentRankTotalSize = TotalDataSize(bv) + 1;
                currentReaderOverlapWriterRanks[rank].second =
                    currentRankTotalSize;
                bufferPosition += currentRankTotalSize;
            }
        }
        allOverlapRanks[overlapRank.first] =
            currentReaderOverlapWriterRanks[writerRank];
    }
}

#define declare_type(T)                                                        \
    void SscWriter::DoPutSync(Variable<T> &variable, const T *data)            \
    {                                                                          \
        PutDeferredCommon(variable, data);                                     \
        PerformPuts();                                                         \
    }                                                                          \
    void SscWriter::DoPutDeferred(Variable<T> &variable, const T *data)        \
    {                                                                          \
        PutDeferredCommon(variable, data);                                     \
    }
ADIOS2_FOREACH_STDTYPE_1ARG(declare_type)
#undef declare_type

void SscWriter::DoClose(const int transportIndex)
{
    TAU_SCOPED_TIMER_FUNC();

    if (m_WriterDefinitionsLocked && m_ReaderSelectionsLocked)
    {
        if (m_CurrentStep > 0)
        {
            MpiWait();
        }

        m_Buffer[0] = 1;

        if (m_MpiMode == "twosided")
        {
            std::vector<MPI_Request> requests;
            for (const auto &i : m_AllSendingReaderRanks)
            {
                requests.emplace_back();
                MPI_Isend(m_Buffer.data(), 1, MPI_CHAR, i.first, 0,
                          m_StreamComm, &requests.back());
            }
            MPI_Status statuses[requests.size()];
            MPI_Waitall(requests.size(), requests.data(), statuses);
        }
        else if (m_MpiMode == "onesidedfencepush")
        {
            MPI_Win_fence(0, m_MpiWin);
            for (const auto &i : m_AllSendingReaderRanks)
            {
                MPI_Put(m_Buffer.data(), 1, MPI_CHAR, i.first, 0, 1, MPI_CHAR,
                        m_MpiWin);
            }
            MPI_Win_fence(0, m_MpiWin);
        }
        else if (m_MpiMode == "onesidedpostpush")
        {
            MPI_Win_start(m_MpiAllReadersGroup, 0, m_MpiWin);
            for (const auto &i : m_AllSendingReaderRanks)
            {
                MPI_Put(m_Buffer.data(), 1, MPI_CHAR, i.first, 0, 1, MPI_CHAR,
                        m_MpiWin);
            }
            MPI_Win_complete(m_MpiWin);
        }
        else if (m_MpiMode == "onesidedfencepull")
        {
            MPI_Win_fence(0, m_MpiWin);
            MPI_Win_fence(0, m_MpiWin);
        }
        else if (m_MpiMode == "onesidedpostpull")
        {
            MPI_Win_post(m_MpiAllReadersGroup, 0, m_MpiWin);
            MPI_Win_wait(m_MpiWin);
        }

        MPI_Win_free(&m_MpiWin);
    }
    else
    {
        SyncWritePattern(true);
    }
}

} // end namespace engine
} // end namespace core
} // end namespace adios2
<commit_msg>fixed more compiler warnings<commit_after>/*
 * Distributed under the OSI-approved Apache License, Version 2.0.  See
 * accompanying file Copyright.txt for details.
 *
 * SscWriter.cpp
 *
 *  Created on: Nov 1, 2018
 *      Author: Jason Wang
 */

#include "SscWriter.tcc"
#include "adios2/helper/adiosComm.h"
#include "adios2/helper/adiosCommMPI.h"
#include "adios2/helper/adiosString.h"

namespace adios2
{
namespace core
{
namespace engine
{

SscWriter::SscWriter(IO &io, const std::string &name, const Mode mode,
                     helper::Comm comm)
: Engine("SscWriter", io, name, mode, std::move(comm))
{
    TAU_SCOPED_TIMER_FUNC();

    helper::GetParameter(m_IO.m_Parameters, "MpiMode", m_MpiMode);
    helper::GetParameter(m_IO.m_Parameters, "Verbose", m_Verbosity);
    helper::GetParameter(m_IO.m_Parameters, "OpenTimeoutSecs",
                         m_OpenTimeoutSecs);

    SyncMpiPattern();
    m_WriterRank = m_Comm.Rank();
    m_WriterSize = m_Comm.Size();
    MPI_Comm_rank(m_StreamComm, &m_StreamRank);
    MPI_Comm_size(m_StreamComm, &m_StreamSize);
}

StepStatus SscWriter::BeginStep(StepMode mode, const float timeoutSeconds)
{
    TAU_SCOPED_TIMER_FUNC();

    ++m_CurrentStep;

    if (m_Verbosity >= 5)
    {
        std::cout << "SscWriter::BeginStep, World Rank " << m_StreamRank
                  << ", Reader Rank " << m_WriterRank << ", Step "
                  << m_CurrentStep << std::endl;
    }

    if (m_CurrentStep == 0 || m_WriterDefinitionsLocked == false ||
        m_ReaderSelectionsLocked == false)
    {
        m_Buffer.resize(1, 0);
        m_GlobalWritePattern.clear();
        m_GlobalWritePattern.resize(m_StreamSize);
        m_GlobalReadPattern.clear();
        m_GlobalReadPattern.resize(m_StreamSize);
    }

    if (m_WriterDefinitionsLocked && m_ReaderSelectionsLocked)
    {
        if (m_CurrentStep > 1)
        {
            MpiWait();
        }
    }

    return StepStatus::OK;
}

size_t SscWriter::CurrentStep() const { return m_CurrentStep; }

void SscWriter::PerformPuts() { TAU_SCOPED_TIMER_FUNC(); }

void SscWriter::EndStep()
{
    TAU_SCOPED_TIMER_FUNC();

    if (m_Verbosity >= 5)
    {
        std::cout << "SscWriter::EndStep, World Rank " << m_StreamRank
                  << ", Reader Rank " << m_WriterRank << ", Step "
                  << m_CurrentStep << std::endl;
    }

    if (m_CurrentStep == 0)
    {
        SyncWritePattern();
        MPI_Win_create(m_Buffer.data(), m_Buffer.size(), 1, MPI_INFO_NULL,
                       m_StreamComm, &m_MpiWin);
        MPI_Win_free(&m_MpiWin);
        SyncReadPattern();
        if (m_WriterDefinitionsLocked && m_ReaderSelectionsLocked)
        {
            MPI_Win_create(m_Buffer.data(), m_Buffer.size(), 1, MPI_INFO_NULL,
                           m_StreamComm, &m_MpiWin);
        }
    }
    else
    {
        if (m_WriterDefinitionsLocked && m_ReaderSelectionsLocked)
        {
            if (m_MpiMode == "twosided")
            {
                for (const auto &i : m_AllSendingReaderRanks)
                {
                    m_MpiRequests.emplace_back();
                    MPI_Isend(m_Buffer.data(),
                              static_cast<int>(m_Buffer.size()), MPI_CHAR,
                              i.first, 0, m_StreamComm, &m_MpiRequests.back());
                }
            }
            else if (m_MpiMode == "onesidedfencepush")
            {
                MPI_Win_fence(0, m_MpiWin);
                for (const auto &i : m_AllSendingReaderRanks)
                {
                    MPI_Put(m_Buffer.data(), static_cast<int>(m_Buffer.size()),
                            MPI_CHAR, i.first, i.second.first,
                            static_cast<int>(m_Buffer.size()), MPI_CHAR,
                            m_MpiWin);
                }
            }
            else if (m_MpiMode == "onesidedpostpush")
            {
                MPI_Win_start(m_MpiAllReadersGroup, 0, m_MpiWin);
                for (const auto &i : m_AllSendingReaderRanks)
                {
                    MPI_Put(m_Buffer.data(), static_cast<int>(m_Buffer.size()),
                            MPI_CHAR, i.first, i.second.first,
                            static_cast<int>(m_Buffer.size()), MPI_CHAR,
                            m_MpiWin);
                }
            }
            else if (m_MpiMode == "onesidedfencepull")
            {
                MPI_Win_fence(0, m_MpiWin);
            }
            else if (m_MpiMode == "onesidedpostpull")
            {
                MPI_Win_post(m_MpiAllReadersGroup, 0, m_MpiWin);
            }
        }
        else
        {
            SyncWritePattern();
            MPI_Win_create(m_Buffer.data(), m_Buffer.size(), 1, MPI_INFO_NULL,
                           m_StreamComm, &m_MpiWin);
            MPI_Win_free(&m_MpiWin);
        }
    }
}

void SscWriter::Flush(const int transportIndex) { TAU_SCOPED_TIMER_FUNC(); }

// PRIVATE

void SscWriter::MpiWait()
{
    if (m_MpiMode == "twosided")
    {
        MPI_Waitall(static_cast<int>(m_MpiRequests.size()),
                    m_MpiRequests.data(), MPI_STATUSES_IGNORE);
        m_MpiRequests.clear();
    }
    else if (m_MpiMode == "onesidedfencepush")
    {
        MPI_Win_fence(0, m_MpiWin);
    }
    else if (m_MpiMode == "onesidedpostpush")
    {
        MPI_Win_complete(m_MpiWin);
    }
    else if (m_MpiMode == "onesidedfencepull")
    {
        MPI_Win_fence(0, m_MpiWin);
    }
    else if (m_MpiMode == "onesidedpostpull")
    {
        MPI_Win_wait(m_MpiWin);
    }
}

void SscWriter::SyncMpiPattern()
{
    TAU_SCOPED_TIMER_FUNC();

    MPI_Group streamGroup;
    MPI_Group writerGroup;
    MPI_Comm writerComm;
    MPI_Comm readerComm;

    helper::HandshakeComm(m_Name, 'w', m_OpenTimeoutSecs, CommAsMPI(m_Comm),
                          streamGroup, writerGroup, m_MpiAllReadersGroup,
                          m_StreamComm, writerComm, readerComm);
}

void SscWriter::SyncWritePattern(bool finalStep)
{
    TAU_SCOPED_TIMER_FUNC();
    if (m_Verbosity >= 5)
    {
        std::cout << "SscWriter::SyncWritePattern, World Rank " << m_StreamRank
                  << ", Writer Rank " << m_WriterRank << ", Step "
                  << m_CurrentStep << std::endl;
    }

    nlohmann::json localRankMetaJ;

    ssc::BlockVecToJson(m_GlobalWritePattern[m_StreamRank], localRankMetaJ);

    if (m_WriterRank == 0)
    {
        ssc::AttributeMapToJson(m_IO, localRankMetaJ);
        localRankMetaJ["Pattern"] = m_WriterDefinitionsLocked;
    }
    if (finalStep)
    {
        localRankMetaJ["FinalStep"] = true;
    }

    std::string localStr = localRankMetaJ.dump();

    // aggregate global write pattern
    size_t localSize = localStr.size();
    size_t maxLocalSize;
    MPI_Allreduce(&localSize, &maxLocalSize, 1, MPI_UNSIGNED_LONG_LONG, MPI_MAX,
                  m_StreamComm);
    std::vector<char> localVec(maxLocalSize, '\0');
    std::memcpy(localVec.data(), localStr.data(), localStr.size());
    std::vector<char> globalVec(maxLocalSize * m_StreamSize, '\0');
    MPI_Allgather(localVec.data(), static_cast<int>(maxLocalSize), MPI_CHAR,
                  globalVec.data(), static_cast<int>(maxLocalSize), MPI_CHAR,
                  m_StreamComm);

    // deserialize global metadata Json
    nlohmann::json globalJson;
    ssc::LocalJsonToGlobalJson(globalVec, maxLocalSize, m_StreamSize,
                               globalJson);

    // deserialize variables metadata
    ssc::JsonToBlockVecVec(globalJson, m_GlobalWritePattern);
}

void SscWriter::SyncReadPattern()
{
    TAU_SCOPED_TIMER_FUNC();
    if (m_Verbosity >= 5)
    {
        std::cout << "SscWriter::SyncReadPattern, World Rank " << m_StreamRank
                  << ", Writer Rank " << m_WriterRank << ", Step "
                  << m_CurrentStep << std::endl;
    }

    size_t localSize = 0;
    size_t maxLocalSize;
    MPI_Allreduce(&localSize, &maxLocalSize, 1, MPI_UNSIGNED_LONG_LONG, MPI_MAX,
                  m_StreamComm);
    std::vector<char> localVec(maxLocalSize, '\0');
    std::vector<char> globalVec(maxLocalSize * m_StreamSize);
    MPI_Allgather(localVec.data(), static_cast<int>(maxLocalSize), MPI_CHAR,
                  globalVec.data(), static_cast<int>(maxLocalSize), MPI_CHAR,
                  m_StreamComm);

    // deserialize global metadata Json
    nlohmann::json globalJson;
    try
    {
        for (size_t i = 0; i < m_StreamSize; ++i)
        {
            if (globalVec[i * maxLocalSize] == '\0')
            {
                globalJson[i] = nullptr;
            }
            else
            {
                globalJson[i] = nlohmann::json::parse(
                    globalVec.begin() + i * maxLocalSize,
                    globalVec.begin() + (i + 1) * maxLocalSize);
            }
        }
    }
    catch (std::exception &e)
    {
        throw(std::runtime_error(
            std::string("corrupted global read pattern metadata, ") +
            std::string(e.what())));
    }

    ssc::JsonToBlockVecVec(globalJson, m_GlobalReadPattern);
    m_AllSendingReaderRanks = ssc::CalculateOverlap(
        m_GlobalReadPattern, m_GlobalWritePattern[m_StreamRank]);
    CalculatePosition(m_GlobalWritePattern, m_GlobalReadPattern, m_WriterRank,
                      m_AllSendingReaderRanks);

    for (int i = 0; i < m_StreamSize; ++i)
    {
        auto &patternJson = globalJson[i]["Pattern"];
        if (patternJson != nullptr)
        {
            m_ReaderSelectionsLocked = patternJson.get<bool>();
        }
    }

    if (m_Verbosity >= 10)
    {
        ssc::PrintBlockVecVec(m_GlobalWritePattern, "Global Write Pattern");
        ssc::PrintBlockVec(m_GlobalWritePattern[m_WriterRank],
                           "Local Write Pattern");
    }
}

void SscWriter::CalculatePosition(ssc::BlockVecVec &writerVecVec,
                                  ssc::BlockVecVec &readerVecVec,
                                  const int writerRank,
                                  ssc::RankPosMap &allOverlapRanks)
{
    TAU_SCOPED_TIMER_FUNC();
    for (auto &overlapRank : allOverlapRanks)
    {
        auto &readerRankMap = readerVecVec[overlapRank.first];
        auto currentReaderOverlapWriterRanks =
            CalculateOverlap(writerVecVec, readerRankMap);
        size_t bufferPosition = 0;
        for (int rank = 0; rank < writerVecVec.size(); ++rank)
        {
            bool hasOverlap = false;
            for (const auto r : currentReaderOverlapWriterRanks)
            {
                if (r.first == rank)
                {
                    hasOverlap = true;
                    break;
                }
            }
            if (hasOverlap)
            {
                currentReaderOverlapWriterRanks[rank].first = bufferPosition;
                auto &bv = writerVecVec[rank];
                size_t currentRankTotalSize = TotalDataSize(bv) + 1;
                currentReaderOverlapWriterRanks[rank].second =
                    currentRankTotalSize;
                bufferPosition += currentRankTotalSize;
            }
        }
        allOverlapRanks[overlapRank.first] =
            currentReaderOverlapWriterRanks[writerRank];
    }
}

#define declare_type(T)                                                        \
    void SscWriter::DoPutSync(Variable<T> &variable, const T *data)            \
    {                                                                          \
        PutDeferredCommon(variable, data);                                     \
        PerformPuts();                                                         \
    }                                                                          \
    void SscWriter::DoPutDeferred(Variable<T> &variable, const T *data)        \
    {                                                                          \
        PutDeferredCommon(variable, data);                                     \
    }
ADIOS2_FOREACH_STDTYPE_1ARG(declare_type)
#undef declare_type

void SscWriter::DoClose(const int transportIndex)
{
    TAU_SCOPED_TIMER_FUNC();

    if (m_WriterDefinitionsLocked && m_ReaderSelectionsLocked)
    {
        if (m_CurrentStep > 0)
        {
            MpiWait();
        }

        m_Buffer[0] = 1;

        if (m_MpiMode == "twosided")
        {
            std::vector<MPI_Request> requests;
            for (const auto &i : m_AllSendingReaderRanks)
            {
                requests.emplace_back();
                MPI_Isend(m_Buffer.data(), 1, MPI_CHAR, i.first, 0,
                          m_StreamComm, &requests.back());
            }
            MPI_Status statuses[requests.size()];
            MPI_Waitall(requests.size(), requests.data(), statuses);
        }
        else if (m_MpiMode == "onesidedfencepush")
        {
            MPI_Win_fence(0, m_MpiWin);
            for (const auto &i : m_AllSendingReaderRanks)
            {
                MPI_Put(m_Buffer.data(), 1, MPI_CHAR, i.first, 0, 1, MPI_CHAR,
                        m_MpiWin);
            }
            MPI_Win_fence(0, m_MpiWin);
        }
        else if (m_MpiMode == "onesidedpostpush")
        {
            MPI_Win_start(m_MpiAllReadersGroup, 0, m_MpiWin);
            for (const auto &i : m_AllSendingReaderRanks)
            {
                MPI_Put(m_Buffer.data(), 1, MPI_CHAR, i.first, 0, 1, MPI_CHAR,
                        m_MpiWin);
            }
            MPI_Win_complete(m_MpiWin);
        }
        else if (m_MpiMode == "onesidedfencepull")
        {
            MPI_Win_fence(0, m_MpiWin);
            MPI_Win_fence(0, m_MpiWin);
        }
        else if (m_MpiMode == "onesidedpostpull")
        {
            MPI_Win_post(m_MpiAllReadersGroup, 0, m_MpiWin);
            MPI_Win_wait(m_MpiWin);
        }

        MPI_Win_free(&m_MpiWin);
    }
    else
    {
        SyncWritePattern(true);
    }
}

} // end namespace engine
} // end namespace core
} // end namespace adios2
<|endoftext|>


<commit_before>/*
 * Distributed under the OSI-approved Apache License, Version 2.0.  See
 * accompanying file Copyright.txt for details.
 *
 * SstReader.cpp
 *
 *  Created on: Aug 17, 2017
 *      Author: Greg Eisenhauer
 */

#include "adios2/helper/adiosFunctions.h"
#include <cstring>
#include <string>

#include "SstReader.h"

namespace adios2
{

SstReader::SstReader(IO &io, const std::string &name, const Mode mode,
                     MPI_Comm mpiComm)
: Engine("SstReader", io, name, mode, mpiComm)
{
    SstStream output;
    char *cstr = new char[name.length() + 1];
    std::strcpy(cstr, name.c_str());

    m_Input = SstReaderOpen(cstr, NULL, mpiComm);
    auto varCallback = [](void *reader, const char *variableName,
                          const char *type, void *data) {
        std::string Type(type);
        SstReader::SstReader *Reader =
            reinterpret_cast<SstReader::SstReader *>(reader);
        if (Type == "compound")
        {
            return (void *)NULL;
        }
#define declare_type(T)                                                        \
    else if (Type == GetType<T>())                                             \
    {                                                                          \
        Variable<T> *variable =                                                \
            &(Reader->m_IO.DefineVariable<T>(variableName));                   \
        variable->SetData((T *)data);                                          \
        return (void *)variable;                                               \
    }

        ADIOS2_FOREACH_TYPE_1ARG(declare_type)
#undef declare_type

        return (void *)NULL;
    };

    auto arrayCallback = [](void *reader, const char *variableName,
                            const char *type, int DimCount, size_t *Shape,
                            size_t *Start, size_t *Count) {
        std::vector<size_t> VecShape;
        std::vector<size_t> VecStart;
        std::vector<size_t> VecCount;
        std::string Type(type);
        SstReader::SstReader *Reader =
            reinterpret_cast<SstReader::SstReader *>(reader);
        for (int i = 0; i < DimCount; i++)
        {
            VecShape.push_back(Shape[i]);
            VecStart.push_back(Start[i]);
            VecCount.push_back(Count[i]);
        }
        if (Type == "compound")
        {
            return (void *)NULL;
        }
#define declare_type(T)                                                        \
    else if (Type == GetType<T>())                                             \
    {                                                                          \
        Variable<T> *variable = &(Reader->m_IO.DefineVariable<T>(              \
            variableName, VecShape, VecStart, VecCount));                      \
        return (void *)variable;                                               \
    }
        ADIOS2_FOREACH_TYPE_1ARG(declare_type)
#undef declare_type
        return (void *)NULL;
    };

    SstReaderInitCallback(m_Input, this, varCallback, arrayCallback);

    Init();
    delete[] cstr;
}

StepStatus SstReader::BeginStep(StepMode mode, const float timeout_sec)
{
    return (StepStatus)SstAdvanceStep(m_Input, (int)mode, timeout_sec);
}

void SstReader::EndStep()
{
    m_IO.RemoveAllVariables();
    SstReleaseStep(m_Input);
}

void SstReader::Close(const int transportIndex) { SstReaderClose(m_Input); }

// PRIVATE
void SstReader::Init()
{
    auto itRealTime = m_IO.m_Parameters.find("real_time");
}

#define declare_type(T)                                                        \
    void SstReader::DoGetSync(Variable<T> &variable, T *data)                  \
    {                                                                          \
        SstGetDeferred(m_Input, (void *)&variable, variable.m_Name.c_str(),    \
                       variable.m_Start.size(), variable.m_Start.data(),       \
                       variable.m_Count.data(), data);                         \
        SstPerformGets(m_Input);                                               \
    }                                                                          \
    void SstReader::DoGetDeferred(Variable<T> &variable, T *data)              \
    {                                                                          \
        SstGetDeferred(m_Input, (void *)&variable, variable.m_Name.c_str(),    \
                       variable.m_Start.size(), variable.m_Start.data(),       \
                       variable.m_Count.data(), data);                         \
    }                                                                          \
    void SstReader::DoGetDeferred(Variable<T> &variable, T &data)              \
    {                                                                          \
        SstGetDeferred(m_Input, (void *)&variable, variable.m_Name.c_str(),    \
                       variable.m_Start.size(), variable.m_Start.data(),       \
                       variable.m_Count.data(), &data);                        \
    }
ADIOS2_FOREACH_TYPE_1ARG(declare_type)
#undef declare_type

void SstReader::PerformGets() { SstPerformGets(m_Input); }

} // end namespace adios
<commit_msg>Set AvailableStepsCount to 1 with SST engine<commit_after>/*
 * Distributed under the OSI-approved Apache License, Version 2.0.  See
 * accompanying file Copyright.txt for details.
 *
 * SstReader.cpp
 *
 *  Created on: Aug 17, 2017
 *      Author: Greg Eisenhauer
 */

#include "adios2/helper/adiosFunctions.h"
#include <cstring>
#include <string>

#include "SstReader.h"

namespace adios2
{

SstReader::SstReader(IO &io, const std::string &name, const Mode mode,
                     MPI_Comm mpiComm)
: Engine("SstReader", io, name, mode, mpiComm)
{
    SstStream output;
    char *cstr = new char[name.length() + 1];
    std::strcpy(cstr, name.c_str());

    m_Input = SstReaderOpen(cstr, NULL, mpiComm);
    auto varCallback = [](void *reader, const char *variableName,
                          const char *type, void *data) {
        std::string Type(type);
        SstReader::SstReader *Reader =
            reinterpret_cast<SstReader::SstReader *>(reader);
        if (Type == "compound")
        {
            return (void *)NULL;
        }
#define declare_type(T)                                                        \
    else if (Type == GetType<T>())                                             \
    {                                                                          \
        Variable<T> *variable =                                                \
            &(Reader->m_IO.DefineVariable<T>(variableName));                   \
        variable->SetData((T *)data);                                          \
        variable->m_AvailableStepsCount = 1;                                   \
        return (void *)variable;                                               \
    }

        ADIOS2_FOREACH_TYPE_1ARG(declare_type)
#undef declare_type

        return (void *)NULL;
    };

    auto arrayCallback = [](void *reader, const char *variableName,
                            const char *type, int DimCount, size_t *Shape,
                            size_t *Start, size_t *Count) {
        std::vector<size_t> VecShape;
        std::vector<size_t> VecStart;
        std::vector<size_t> VecCount;
        std::string Type(type);
        SstReader::SstReader *Reader =
            reinterpret_cast<SstReader::SstReader *>(reader);
        for (int i = 0; i < DimCount; i++)
        {
            VecShape.push_back(Shape[i]);
            VecStart.push_back(Start[i]);
            VecCount.push_back(Count[i]);
        }
        if (Type == "compound")
        {
            return (void *)NULL;
        }
#define declare_type(T)                                                        \
    else if (Type == GetType<T>())                                             \
    {                                                                          \
        Variable<T> *variable = &(Reader->m_IO.DefineVariable<T>(              \
            variableName, VecShape, VecStart, VecCount));                      \
        variable->m_AvailableStepsCount = 1;                                   \
        return (void *)variable;                                               \
    }
        ADIOS2_FOREACH_TYPE_1ARG(declare_type)
#undef declare_type
        return (void *)NULL;
    };

    SstReaderInitCallback(m_Input, this, varCallback, arrayCallback);

    Init();
    delete[] cstr;
}

StepStatus SstReader::BeginStep(StepMode mode, const float timeout_sec)
{
    return (StepStatus)SstAdvanceStep(m_Input, (int)mode, timeout_sec);
}

void SstReader::EndStep()
{
    m_IO.RemoveAllVariables();
    SstReleaseStep(m_Input);
}

void SstReader::Close(const int transportIndex) { SstReaderClose(m_Input); }

// PRIVATE
void SstReader::Init()
{
    auto itRealTime = m_IO.m_Parameters.find("real_time");
}

#define declare_type(T)                                                        \
    void SstReader::DoGetSync(Variable<T> &variable, T *data)                  \
    {                                                                          \
        SstGetDeferred(m_Input, (void *)&variable, variable.m_Name.c_str(),    \
                       variable.m_Start.size(), variable.m_Start.data(),       \
                       variable.m_Count.data(), data);                         \
        SstPerformGets(m_Input);                                               \
    }                                                                          \
    void SstReader::DoGetDeferred(Variable<T> &variable, T *data)              \
    {                                                                          \
        SstGetDeferred(m_Input, (void *)&variable, variable.m_Name.c_str(),    \
                       variable.m_Start.size(), variable.m_Start.data(),       \
                       variable.m_Count.data(), data);                         \
    }                                                                          \
    void SstReader::DoGetDeferred(Variable<T> &variable, T &data)              \
    {                                                                          \
        SstGetDeferred(m_Input, (void *)&variable, variable.m_Name.c_str(),    \
                       variable.m_Start.size(), variable.m_Start.data(),       \
                       variable.m_Count.data(), &data);                        \
    }
ADIOS2_FOREACH_TYPE_1ARG(declare_type)
#undef declare_type

void SstReader::PerformGets() { SstPerformGets(m_Input); }

} // end namespace adios
<|endoftext|>


<commit_before>/*=========================================================================

  Program:   Visualization Toolkit
  Module:    TestPLYWriter.cxx

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// .NAME Test of vtkPLYWriter
// .SECTION Description
//

#include "vtkPLYWriter.h"

#include "vtkFloatArray.h"
#include "vtkPLYReader.h"
#include "vtkPolyData.h"
#include "vtkPointData.h"
#include "vtkTestUtilities.h"

#include <limits>

int TestPLYWriter(int argc, char *argv[])
{
  // Test temporary directory
  char *tempDir = vtkTestUtilities::GetArgOrEnvOrDefault(
     "-T", argc, argv, "VTK_TEMP_DIR", "Testing/Temporary");
  if (!tempDir)
    {
    std::cout << "Could not determine temporary directory.\n";
    return EXIT_FAILURE;
    }
  std::string testDirectory = tempDir;
  delete[] tempDir;

  std::string outputfile = testDirectory + std::string("/") + std::string("tmp.ply");

  // Read file name.
  const char* inputfile = vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/squareTextured.ply");

  // Test if the reader thinks it can open the input file.
  if (0 == vtkPLYReader::CanReadFile(inputfile))
    {
    std::cout << "The PLY reader can not read the input file." << std::endl;
    return EXIT_FAILURE;
    }

  // Create the reader.
  vtkSmartPointer<vtkPLYReader> reader = vtkSmartPointer<vtkPLYReader>::New();
  reader->SetFileName(inputfile);
  reader->Update();
  delete [] inputfile;

  // Data to compare.
  vtkSmartPointer<vtkPolyData> data = vtkSmartPointer<vtkPolyData>::New();
  data->DeepCopy(reader->GetOutput());

  // Create the writer.
  vtkSmartPointer<vtkPLYWriter> writer = vtkSmartPointer<vtkPLYWriter>::New();
  writer->SetFileName(outputfile.c_str());
  writer->SetFileTypeToASCII();
  writer->SetTextureCoordinatesNameToTextureUV();
  writer->SetInputConnection(reader->GetOutputPort());
  writer->AddComment("TextureFile vtk.png");
  writer->Write();

  // Test if the reader thinks it can open the written file.
  if (0 == vtkPLYReader::CanReadFile(outputfile.c_str()))
    {
    std::cout << "The PLY reader can not read the written file." << std::endl;
    return EXIT_FAILURE;
    }
  reader->SetFileName(outputfile.c_str());
  reader->Update();

  vtkPolyData *newData = reader->GetOutput();

  const vtkIdType nbrPoints = newData->GetNumberOfPoints();
  if (nbrPoints != data->GetNumberOfPoints())
    {
    std::cout << "Different number of points." << std::endl;
    return EXIT_FAILURE;
    }

  vtkDataArray *tCoords = newData->GetPointData()->GetTCoords();
  if (!tCoords || !data->GetPointData()->GetTCoords())
    {
    std::cout << "Texture coordinates are not present." << std::endl;
    return EXIT_FAILURE;
    }

  const vtkIdType nbrCoords = tCoords->GetNumberOfTuples()*tCoords->GetNumberOfComponents();
  if (nbrCoords != (2 * nbrPoints))
    {
    std::cout << "Number of texture coordinates is not coherent." << std::endl;
    return EXIT_FAILURE;
    }

  vtkFloatArray * inputArray = vtkFloatArray::SafeDownCast(data->GetPointData()->GetTCoords());
  vtkFloatArray * outputArray = vtkFloatArray::SafeDownCast(tCoords);
  if (!inputArray || !outputArray)
    {
    std::cout << "Texture coordinates are not of float type." << std::endl;
    return EXIT_FAILURE;
    }

  float *input = inputArray->GetPointer(0);
  float *output = outputArray->GetPointer(0);
  for (vtkIdType id = 0; id < nbrCoords; ++id)
    {
    if (std::abs(*input++ - *output++) > std::numeric_limits<float>::epsilon())
      {
      std::cout << "Texture coordinates are not identical." << std::endl;
      return EXIT_FAILURE;
      }
    }

  return EXIT_SUCCESS;
}
<commit_msg>Add missing include for OSX and Linux<commit_after>/*=========================================================================

  Program:   Visualization Toolkit
  Module:    TestPLYWriter.cxx

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// .NAME Test of vtkPLYWriter
// .SECTION Description
//

#include "vtkPLYWriter.h"

#include "vtkFloatArray.h"
#include "vtkPLYReader.h"
#include "vtkPolyData.h"
#include "vtkPointData.h"
#include "vtkTestUtilities.h"

#include <cmath>
#include <limits>

int TestPLYWriter(int argc, char *argv[])
{
  // Test temporary directory
  char *tempDir = vtkTestUtilities::GetArgOrEnvOrDefault(
     "-T", argc, argv, "VTK_TEMP_DIR", "Testing/Temporary");
  if (!tempDir)
    {
    std::cout << "Could not determine temporary directory.\n";
    return EXIT_FAILURE;
    }
  std::string testDirectory = tempDir;
  delete[] tempDir;

  std::string outputfile = testDirectory + std::string("/") + std::string("tmp.ply");

  // Read file name.
  const char* inputfile = vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/squareTextured.ply");

  // Test if the reader thinks it can open the input file.
  if (0 == vtkPLYReader::CanReadFile(inputfile))
    {
    std::cout << "The PLY reader can not read the input file." << std::endl;
    return EXIT_FAILURE;
    }

  // Create the reader.
  vtkSmartPointer<vtkPLYReader> reader = vtkSmartPointer<vtkPLYReader>::New();
  reader->SetFileName(inputfile);
  reader->Update();
  delete [] inputfile;

  // Data to compare.
  vtkSmartPointer<vtkPolyData> data = vtkSmartPointer<vtkPolyData>::New();
  data->DeepCopy(reader->GetOutput());

  // Create the writer.
  vtkSmartPointer<vtkPLYWriter> writer = vtkSmartPointer<vtkPLYWriter>::New();
  writer->SetFileName(outputfile.c_str());
  writer->SetFileTypeToASCII();
  writer->SetTextureCoordinatesNameToTextureUV();
  writer->SetInputConnection(reader->GetOutputPort());
  writer->AddComment("TextureFile vtk.png");
  writer->Write();

  // Test if the reader thinks it can open the written file.
  if (0 == vtkPLYReader::CanReadFile(outputfile.c_str()))
    {
    std::cout << "The PLY reader can not read the written file." << std::endl;
    return EXIT_FAILURE;
    }
  reader->SetFileName(outputfile.c_str());
  reader->Update();

  vtkPolyData *newData = reader->GetOutput();

  const vtkIdType nbrPoints = newData->GetNumberOfPoints();
  if (nbrPoints != data->GetNumberOfPoints())
    {
    std::cout << "Different number of points." << std::endl;
    return EXIT_FAILURE;
    }

  vtkDataArray *tCoords = newData->GetPointData()->GetTCoords();
  if (!tCoords || !data->GetPointData()->GetTCoords())
    {
    std::cout << "Texture coordinates are not present." << std::endl;
    return EXIT_FAILURE;
    }

  const vtkIdType nbrCoords = tCoords->GetNumberOfTuples()*tCoords->GetNumberOfComponents();
  if (nbrCoords != (2 * nbrPoints))
    {
    std::cout << "Number of texture coordinates is not coherent." << std::endl;
    return EXIT_FAILURE;
    }

  vtkFloatArray * inputArray = vtkFloatArray::SafeDownCast(data->GetPointData()->GetTCoords());
  vtkFloatArray * outputArray = vtkFloatArray::SafeDownCast(tCoords);
  if (!inputArray || !outputArray)
    {
    std::cout << "Texture coordinates are not of float type." << std::endl;
    return EXIT_FAILURE;
    }

  float *input = inputArray->GetPointer(0);
  float *output = outputArray->GetPointer(0);
  for (vtkIdType id = 0; id < nbrCoords; ++id)
    {
    if (std::abs(*input++ - *output++) > std::numeric_limits<float>::epsilon())
      {
      std::cout << "Texture coordinates are not identical." << std::endl;
      return EXIT_FAILURE;
      }
    }

  return EXIT_SUCCESS;
}
<|endoftext|>


<commit_before>// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/views/controls/menu/menu_item_view.h"

#include "base/utf_string_conversions.h"
#include "grit/ui_resources.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/favicon_size.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/native_theme.h"
#include "ui/views/controls/menu/menu_config.h"
#include "ui/views/controls/menu/menu_image_util.h"
#include "ui/views/controls/menu/submenu_view.h"

namespace views {

void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) {
  const MenuConfig& config = MenuConfig::instance();
  bool render_selection =
      (mode == PB_NORMAL && IsSelected() &&
       parent_menu_item_->GetSubmenu()->GetShowSelection(this) &&
       !has_children());

  int icon_x = config.item_left_margin;
  int top_margin = GetTopMargin();
  int bottom_margin = GetBottomMargin();
  int icon_y = top_margin + (height() - config.item_top_margin -
                             bottom_margin - config.check_height) / 2;
  int icon_height = config.check_height;
  int available_height = height() - top_margin - bottom_margin;

  // Render the background. As MenuScrollViewContainer draws the background, we
  // only need the background when we want it to look different, as when we're
  // selected.
  if (render_selection) {
    SkColor bg_color = gfx::NativeTheme::instance()->GetSystemColor(
        gfx::NativeTheme::kColorId_FocusedMenuItemBackgroundColor);
    canvas->sk_canvas()->drawColor(bg_color, SkXfermode::kSrc_Mode);
  }

  // Render the check.
  if (type_ == CHECKBOX && GetDelegate()->IsItemChecked(GetCommand())) {
    ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
    const SkBitmap* check = rb.GetImageNamed(IDR_MENU_CHECK).ToSkBitmap();
    // Don't use config.check_width here as it's padded to force more padding.
    gfx::Rect check_bounds(icon_x, icon_y, check->width(), icon_height);
    AdjustBoundsForRTLUI(&check_bounds);
    canvas->DrawBitmapInt(*check, check_bounds.x(), check_bounds.y());
  } else if (type_ == RADIO) {
    const SkBitmap* image =
        GetRadioButtonImage(GetDelegate()->IsItemChecked(GetCommand()));
    gfx::Rect radio_bounds(icon_x,
                           top_margin +
                           (height() - top_margin - bottom_margin -
                            image->height()) / 2,
                           image->width(),
                           image->height());
    AdjustBoundsForRTLUI(&radio_bounds);
    canvas->DrawBitmapInt(*image, radio_bounds.x(), radio_bounds.y());
  }

  // Render the foreground.
  SkColor fg_color = gfx::NativeTheme::instance()->GetSystemColor(
      enabled() ? gfx::NativeTheme::kColorId_EnabledMenuItemForegroundColor
          : gfx::NativeTheme::kColorId_DisabledMenuItemForegroundColor);

  const gfx::Font& font = GetFont();
  int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width();
  int width = this->width() - item_right_margin_ - label_start_ - accel_width;
  gfx::Rect text_bounds(label_start_, top_margin +
                        (available_height - font.GetHeight()) / 2, width,
                        font.GetHeight());
  text_bounds.set_x(GetMirroredXForRect(text_bounds));
  canvas->DrawStringInt(title(), font, fg_color,
                        text_bounds.x(), text_bounds.y(), text_bounds.width(),
                        text_bounds.height(),
                        GetRootMenuItem()->GetDrawStringFlags());

  PaintAccelerator(canvas);

  // Render the icon.
  if (icon_.width() > 0) {
    gfx::Rect icon_bounds(config.item_left_margin,
                          top_margin + (height() - top_margin -
                          bottom_margin - icon_.height()) / 2,
                          icon_.width(),
                          icon_.height());
    icon_bounds.set_x(GetMirroredXForRect(icon_bounds));
    canvas->DrawBitmapInt(icon_, icon_bounds.x(), icon_bounds.y());
  }

  // Render the submenu indicator (arrow).
  if (HasSubmenu()) {
    gfx::Rect arrow_bounds(this->width() - item_right_margin_ +
                           config.label_to_arrow_padding,
                           top_margin + (available_height -
                                         config.arrow_width) / 2,
                           config.arrow_width, height());
    AdjustBoundsForRTLUI(&arrow_bounds);
    canvas->DrawBitmapInt(*GetSubmenuArrowImage(),
                          arrow_bounds.x(), arrow_bounds.y());
  }
}

}  // namespace views
<commit_msg>views: Update menu item text Y-position for Aura.<commit_after>// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/views/controls/menu/menu_item_view.h"

#include "base/utf_string_conversions.h"
#include "grit/ui_resources.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/favicon_size.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/native_theme.h"
#include "ui/views/controls/menu/menu_config.h"
#include "ui/views/controls/menu/menu_image_util.h"
#include "ui/views/controls/menu/submenu_view.h"

namespace views {

void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) {
  const MenuConfig& config = MenuConfig::instance();
  bool render_selection =
      (mode == PB_NORMAL && IsSelected() &&
       parent_menu_item_->GetSubmenu()->GetShowSelection(this) &&
       !has_children());

  int icon_x = config.item_left_margin;
  int top_margin = GetTopMargin();
  int bottom_margin = GetBottomMargin();
  int icon_y = top_margin + (height() - config.item_top_margin -
                             bottom_margin - config.check_height) / 2;
  int icon_height = config.check_height;
  int available_height = height() - top_margin - bottom_margin;

  // Render the background. As MenuScrollViewContainer draws the background, we
  // only need the background when we want it to look different, as when we're
  // selected.
  if (render_selection) {
    SkColor bg_color = gfx::NativeTheme::instance()->GetSystemColor(
        gfx::NativeTheme::kColorId_FocusedMenuItemBackgroundColor);
    canvas->sk_canvas()->drawColor(bg_color, SkXfermode::kSrc_Mode);
  }

  // Render the check.
  if (type_ == CHECKBOX && GetDelegate()->IsItemChecked(GetCommand())) {
    ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
    const SkBitmap* check = rb.GetImageNamed(IDR_MENU_CHECK).ToSkBitmap();
    // Don't use config.check_width here as it's padded to force more padding.
    gfx::Rect check_bounds(icon_x, icon_y, check->width(), icon_height);
    AdjustBoundsForRTLUI(&check_bounds);
    canvas->DrawBitmapInt(*check, check_bounds.x(), check_bounds.y());
  } else if (type_ == RADIO) {
    const SkBitmap* image =
        GetRadioButtonImage(GetDelegate()->IsItemChecked(GetCommand()));
    gfx::Rect radio_bounds(icon_x,
                           top_margin +
                           (height() - top_margin - bottom_margin -
                            image->height()) / 2,
                           image->width(),
                           image->height());
    AdjustBoundsForRTLUI(&radio_bounds);
    canvas->DrawBitmapInt(*image, radio_bounds.x(), radio_bounds.y());
  }

  // Render the foreground.
  SkColor fg_color = gfx::NativeTheme::instance()->GetSystemColor(
      enabled() ? gfx::NativeTheme::kColorId_EnabledMenuItemForegroundColor
          : gfx::NativeTheme::kColorId_DisabledMenuItemForegroundColor);

  const gfx::Font& font = GetFont();
  int accel_width = parent_menu_item_->GetSubmenu()->max_accelerator_width();
  int width = this->width() - item_right_margin_ - label_start_ - accel_width;
  gfx::Rect text_bounds(label_start_, top_margin +
                        (available_height - font.GetHeight() + 1) / 2, width,
                        font.GetHeight());
  text_bounds.set_x(GetMirroredXForRect(text_bounds));
  canvas->DrawStringInt(title(), font, fg_color,
                        text_bounds.x(), text_bounds.y(), text_bounds.width(),
                        text_bounds.height(),
                        GetRootMenuItem()->GetDrawStringFlags());

  PaintAccelerator(canvas);

  // Render the icon.
  if (icon_.width() > 0) {
    gfx::Rect icon_bounds(config.item_left_margin,
                          top_margin + (height() - top_margin -
                          bottom_margin - icon_.height()) / 2,
                          icon_.width(),
                          icon_.height());
    icon_bounds.set_x(GetMirroredXForRect(icon_bounds));
    canvas->DrawBitmapInt(icon_, icon_bounds.x(), icon_bounds.y());
  }

  // Render the submenu indicator (arrow).
  if (HasSubmenu()) {
    gfx::Rect arrow_bounds(this->width() - item_right_margin_ +
                           config.label_to_arrow_padding,
                           top_margin + (available_height -
                                         config.arrow_width) / 2,
                           config.arrow_width, height());
    AdjustBoundsForRTLUI(&arrow_bounds);
    canvas->DrawBitmapInt(*GetSubmenuArrowImage(),
                          arrow_bounds.x(), arrow_bounds.y());
  }
}

}  // namespace views
<|endoftext|>


<commit_before><commit_msg>INTEGRATION: CWS changefileheader (1.4.48); FILE MERGED 2008/03/31 12:31:33 rt 1.4.48.1: #i87441# Change license header to LPGL v3.<commit_after><|endoftext|>