code
stringlengths 4
1.01M
| language
stringclasses 2
values |
---|---|
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation ([email protected])
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at [email protected].
**
**************************************************************************/
#ifndef INSPECTORSETTINGS_H
#define INSPECTORSETTINGS_H
#include <QtCore/QObject>
QT_FORWARD_DECLARE_CLASS(QSettings)
namespace QmlJSInspector {
namespace Internal {
class InspectorSettings : public QObject
{
Q_OBJECT
public:
InspectorSettings(QObject *parent = 0);
void restoreSettings(QSettings *settings);
void saveSettings(QSettings *settings) const;
bool showLivePreviewWarning() const;
void setShowLivePreviewWarning(bool value);
private:
bool m_showLivePreviewWarning;
};
} // namespace Internal
} // namespace QmlJSInspector
#endif // INSPECTORSETTINGS_H
| Java |
/*
* This library is part of OpenCms -
* the Open Source Content Management System
*
* Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* For further information about Alkacon Software, please see the
* company website: http://www.alkacon.com
*
* For further information about OpenCms, please see the
* project website: http://www.opencms.org
*
* 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
*/
package org.opencms.gwt.shared.sort;
import java.util.Comparator;
/**
* Comparator for objects with a type property.<p>
*
* @see I_CmsHasType
*
* @since 8.0.0
*/
public class CmsComparatorType implements Comparator<I_CmsHasType> {
/** Sort order flag. */
private boolean m_ascending;
/**
* Constructor.<p>
*
* @param ascending if <code>true</code> order is ascending
*/
public CmsComparatorType(boolean ascending) {
m_ascending = ascending;
}
/**
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
public int compare(I_CmsHasType o1, I_CmsHasType o2) {
int result = o1.getType().compareTo(o2.getType());
return m_ascending ? result : -result;
}
}
| Java |
/*
eXokernel Development Kit (XDK)
Based on code by Samsung Research America Copyright (C) 2013
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C 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 the GNU C Library; if not, see
<http://www.gnu.org/licenses/>.
As a special exception, if you link the code in this file with
files compiled with a GNU compiler to produce an executable,
that does not cause the resulting executable to be covered by
the GNU Lesser General Public License. This exception does not
however invalidate any other reasons why the executable file
might be covered by the GNU Lesser General Public License.
This exception applies to code released by its copyright holders
in files containing the exception.
*/
#include <stdio.h>
#include <stdarg.h>
#include <common/logging.h>
#include "nvme_common.h"
#ifdef NVME_VERBOSE
void NVME_INFO(const char *fmt, ...) {
printf(NORMAL_MAGENTA);
va_list list;
va_start(list, fmt);
printf("[NVME]:");
vprintf(fmt, list);
va_end(list);
printf(RESET);
}
#endif
| Java |
package railo.runtime.search.lucene2.query;
import railo.commons.lang.StringUtil;
public final class Concator implements Op {
private Op left;
private Op right;
public Concator(Op left,Op right) {
this.left=left;
this.right=right;
}
@Override
public String toString() {
if(left instanceof Literal && right instanceof Literal) {
String str=((Literal)left).literal+" "+((Literal)right).literal;
return "\""+StringUtil.replace(str, "\"", "\"\"", false)+"\"";
}
return left+" "+right;
}
}
| Java |
/*
* Portable Object Compiler (c) 1997,98,2003. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Library General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __OBJSET_H__
#define __OBJSET_H__
#include "cltn.h"
typedef struct objset
{
int count;
int capacity;
id * ptr;
} * objset_t;
/*!
* @abstract Set of objects.
* @discussion Stores objects in a hashed table. Each object may be added only
* once; no duplicates are permitted. The @link hash @/link message is used for
* this purpose. Both that and the @link isEqual: @/link message should be
* responded to by any object to be added to the set, and @link hash @/link
* should return an identical hash for an object to that of one that
* @link isEqual: @/link to another.
*
* The object may not be properly located within the Set, or duplicates may be
* permitted to be added, if the object should change its respond to
* @link hash @/link while it is in the Set.
* @see Cltn
* @indexgroup Collection
*/
@interface Set <T> : Cltn
{
struct objset value;
}
+ new;
+ new:(unsigned)n;
+ with:(int)nArgs, ...;
+ with:firstObject with:nextObject;
+ add:(T)firstObject;
- copy;
- deepCopy;
- emptyYourself;
- freeContents;
- free;
- (unsigned)size;
- (BOOL)isEmpty;
- eachElement;
- (BOOL)isEqual:set;
- add:(T)anObject;
- addNTest:(T)anObject;
- filter:(T)anObject;
- add:(T)anObject ifDuplicate:aBlock;
- replace:(T)anObject;
- remove:(T)oldObject;
- remove:(T)oldObject ifAbsent:exceptionBlock;
- (BOOL)includesAllOf:aCltn;
- (BOOL)includesAnyOf:aCltn;
- addAll:aCltn;
- addContentsOf:aCltn;
- addContentsTo:aCltn;
- removeAll:aCltn;
- removeContentsFrom:aCltn;
- removeContentsOf:aCltn;
- intersection:bag;
- union:bag;
- difference:bag;
- asSet;
- asOrdCltn;
- detect:aBlock;
- detect:aBlock ifNone:noneBlock;
- select:testBlock;
- reject:testBlock;
- collect:transformBlock;
- (unsigned)count:aBlock;
- elementsPerform:(SEL)aSelector;
- elementsPerform:(SEL)aSelector with:anObject;
- elementsPerform:(SEL)aSelector with:anObject with:otherObject;
- elementsPerform:(SEL)aSelector with:anObject with:otherObject with:thirdObj;
- do:aBlock;
- do:aBlock until:(BOOL *)flag;
- find:(T)anObject;
- (BOOL)contains:(T)anObject;
- (BOOL)includes:(T)anObject;
- (unsigned)occurrencesOf:(T)anObject;
- printOn:(IOD)aFile;
- fileOutOn:aFiler;
- fileInFrom:aFiler;
- awakeFrom:aFiler;
/* private */
- (objset_t)objsetvalue;
- addYourself;
- freeAll;
- ARC_dealloc;
- (uintptr_t)hash;
@end
#endif /* __OBJSET_H__ */
| Java |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class XorgServer(AutotoolsPackage, XorgPackage):
"""X.Org Server is the free and open source implementation of the display
server for the X Window System stewarded by the X.Org Foundation."""
homepage = "http://cgit.freedesktop.org/xorg/xserver"
xorg_mirror_path = "xserver/xorg-server-1.18.99.901.tar.gz"
version('1.18.99.901', sha256='c8425163b588de2ee7e5c8e65b0749f2710f55a7e02a8d1dc83b3630868ceb21')
depends_on('[email protected]:')
depends_on('font-util')
depends_on('[email protected]:')
depends_on('[email protected]:')
depends_on('libx11')
depends_on('[email protected]:', type='build')
depends_on('[email protected]:', type='build')
depends_on('[email protected]:', type='build')
depends_on('flex', type='build')
depends_on('bison', type='build')
depends_on('pkgconfig', type='build')
depends_on('util-macros', type='build')
depends_on('[email protected]:')
depends_on('[email protected]:')
depends_on('[email protected]:')
depends_on('[email protected]:')
depends_on('[email protected]:')
depends_on('[email protected]:')
depends_on('[email protected]:')
depends_on('[email protected]:')
depends_on('[email protected]:')
depends_on('[email protected]:')
depends_on('[email protected]:')
depends_on('[email protected]:')
depends_on('[email protected]:')
depends_on('videoproto')
depends_on('[email protected]:')
depends_on('[email protected]:')
depends_on('[email protected]:')
depends_on('[email protected]:')
depends_on('[email protected]:')
depends_on('[email protected]:')
depends_on('[email protected]:')
depends_on('xineramaproto')
depends_on('libxkbfile')
depends_on('libxfont2')
depends_on('libxext')
depends_on('libxdamage')
depends_on('libxfixes')
depends_on('libepoxy')
| Java |
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation ([email protected])
**
** This file is part of the QtXmlPatterns module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
#ifndef Patternist_OperandsIterator_H
#define Patternist_OperandsIterator_H
#include <QPair>
#include <QStack>
#include "qexpression_p.h"
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
namespace QPatternist
{
/**
* @short A helper class that iterates a tree of Expression instances. It
* is not a sub-class of QAbstractXmlForwardIterator.
*
* The OperandsIterator delivers all Expression instances that are children at any
* depth of the Expression passed in the constructor.
* The order is delivered in a defined way, from left to right and depth
* first.
*
* @author Frans Englich <[email protected]>
*/
class OperandsIterator
{
/**
* The second value, the int, is the current position in the first.
*/
typedef QPair<Expression::List, int> Level;
public:
enum TreatParent
{
ExcludeParent,
IncludeParent
};
/**
* if @p treatParent is @c IncludeParent, @p start is excluded.
*
* @p start must be a valid Expression.
*/
inline OperandsIterator(const Expression::Ptr &start,
const TreatParent treatParent)
{
Q_ASSERT(start);
if(treatParent == IncludeParent)
{
Expression::List l;
l.append(start);
m_exprs.push(qMakePair(l, -1));
}
m_exprs.push(qMakePair(start->operands(), -1));
}
/**
* @short Returns the current Expression and advances the iterator.
*
* If the end has been reached, a default constructed pointer is
* returned.
*
* We intentionally return by reference.
*/
inline Expression::Ptr next()
{
if(m_exprs.isEmpty())
return Expression::Ptr();
Level &lvl = m_exprs.top();
++lvl.second;
if(lvl.second == lvl.first.size())
{
/* Resume iteration above us. */
m_exprs.pop();
if(m_exprs.isEmpty())
return Expression::Ptr();
while(true)
{
Level &previous = m_exprs.top();
++previous.second;
if(previous.second < previous.first.count())
{
const Expression::Ptr &op = previous.first.at(previous.second);
m_exprs.push(qMakePair(op->operands(), -1));
return op;
}
else
{
// We have already reached the end of this level.
m_exprs.pop();
if(m_exprs.isEmpty())
return Expression::Ptr();
}
}
}
else
{
const Expression::Ptr &op = lvl.first.at(lvl.second);
m_exprs.push(qMakePair(op->operands(), -1));
return op;
}
}
/**
* Advances this iterator by the current expression and its operands.
*/
Expression::Ptr skipOperands()
{
if(m_exprs.isEmpty())
return Expression::Ptr();
Level &lvl = m_exprs.top();
++lvl.second;
if(lvl.second == lvl.first.size())
{
/* We've reached the end of this level, at least. */
m_exprs.pop();
}
return next();
}
private:
Q_DISABLE_COPY(OperandsIterator)
QStack<Level> m_exprs;
};
}
QT_END_NAMESPACE
QT_END_HEADER
#endif
| Java |
package org.hivedb.hibernate;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.shards.session.OpenSessionEvent;
import java.sql.SQLException;
public class RecordNodeOpenSessionEvent implements OpenSessionEvent {
public static ThreadLocal<String> node = new ThreadLocal<String>();
public static String getNode() {
return node.get();
}
public static void setNode(Session session) {
node.set(getNode(session));
}
public void onOpenSession(Session session) {
setNode(session);
}
@SuppressWarnings("deprecation")
private static String getNode(Session session) {
String node = "";
if (session != null) {
try {
node = session.connection().getMetaData().getURL();
} catch (SQLException ex) {
} catch (HibernateException ex) {
}
}
return node;
}
}
| Java |
using System;
using System.Collections;
using System.Collections.Generic;
using NHibernate.Driver;
using NHibernate.Test.SecondLevelCacheTests;
using NUnit.Framework;
namespace NHibernate.Test.QueryTest
{
[TestFixture]
public class MultipleMixedQueriesFixture : TestCase
{
protected override string MappingsAssembly
{
get { return "NHibernate.Test"; }
}
protected override IList Mappings
{
get { return new[] { "SecondLevelCacheTest.Item.hbm.xml" }; }
}
protected override bool AppliesTo(Engine.ISessionFactoryImplementor factory)
{
return factory.ConnectionProvider.Driver.SupportsMultipleQueries;
}
protected override void OnTearDown()
{
using (var session = OpenSession())
using (var transaction = session.BeginTransaction())
{
session.Delete("from System.Object");
session.Flush();
transaction.Commit();
}
}
[Test]
public void NH_1085_WillIgnoreParametersIfDoesNotAppearInQuery()
{
using (var s = Sfi.OpenSession())
{
var multiQuery = s.CreateMultiQuery()
.Add(s.CreateSQLQuery("select * from ITEM where Id in (:ids)").AddEntity(typeof (Item)))
.Add(s.CreateSQLQuery("select * from ITEM where Id in (:ids2)").AddEntity(typeof (Item)))
.SetParameterList("ids", new[] {50})
.SetParameterList("ids2", new[] {50});
multiQuery.List();
}
}
[Test]
public void NH_1085_WillGiveReasonableErrorIfBadParameterName()
{
using (var s = Sfi.OpenSession())
{
var multiQuery = s.CreateMultiQuery()
.Add(s.CreateSQLQuery("select * from ITEM where Id in (:ids)").AddEntity(typeof(Item)))
.Add(s.CreateSQLQuery("select * from ITEM where Id in (:ids2)").AddEntity(typeof(Item)));
var e = Assert.Throws<QueryException>(() => multiQuery.List());
Assert.That(e.Message, Is.EqualTo("Not all named parameters have been set: ['ids'] [select * from ITEM where Id in (:ids)]"));
}
}
[Test]
public void CanGetMultiQueryFromSecondLevelCache()
{
CreateItems();
//set the query in the cache
DoMutiQueryAndAssert();
var cacheHashtable = MultipleQueriesFixture.GetHashTableUsedAsQueryCache(Sfi);
var cachedListEntry = (IList)new ArrayList(cacheHashtable.Values)[0];
var cachedQuery = (IList)cachedListEntry[1];
var firstQueryResults = (IList)cachedQuery[0];
firstQueryResults.Clear();
firstQueryResults.Add(3);
firstQueryResults.Add(4);
var secondQueryResults = (IList)cachedQuery[1];
secondQueryResults[0] = 2L;
using (var s = Sfi.OpenSession())
{
var multiQuery = s.CreateMultiQuery()
.Add(s.CreateSQLQuery("select * from ITEM where Id > ?").AddEntity(typeof(Item))
.SetInt32(0, 50)
.SetFirstResult(10))
.Add(s.CreateQuery("select count(*) from Item i where i.Id > ?")
.SetInt32(0, 50));
multiQuery.SetCacheable(true);
var results = multiQuery.List();
var items = (IList)results[0];
Assert.AreEqual(2, items.Count);
var count = (long)((IList)results[1])[0];
Assert.AreEqual(2L, count);
}
}
[Test]
public void CanSpecifyParameterOnMultiQueryWhenItIsNotUsedInAllQueries()
{
using (var s = OpenSession())
{
s.CreateMultiQuery()
.Add("from Item")
.Add(s.CreateSQLQuery("select * from ITEM where Id > :id").AddEntity(typeof(Item)))
.SetParameter("id", 5)
.List();
}
}
[Test]
public void CanSpecifyParameterOnMultiQueryWhenItIsNotUsedInAllQueries_MoreThanOneParameter()
{
using (var s = OpenSession())
{
s.CreateMultiQuery()
.Add("from Item")
.Add(s.CreateSQLQuery("select * from ITEM where Id = :id or Id = :id2").AddEntity(typeof(Item)))
.Add("from Item i where i.Id = :id2")
.SetParameter("id", 5)
.SetInt32("id2", 5)
.List();
}
}
[Test]
public void TwoMultiQueriesWithDifferentPagingGetDifferentResultsWhenUsingCachedQueries()
{
CreateItems();
using (var s = OpenSession())
{
var multiQuery = s.CreateMultiQuery()
.Add(s.CreateQuery("from Item i where i.Id > ?")
.SetInt32(0, 50)
.SetFirstResult(10))
.Add(s.CreateSQLQuery("select count(*) as count from ITEM where Id > ?").AddScalar("count", NHibernateUtil.Int64)
.SetInt32(0, 50));
multiQuery.SetCacheable(true);
var results = multiQuery.List();
var items = (IList)results[0];
Assert.AreEqual(89, items.Count);
var count = (long)((IList)results[1])[0];
Assert.AreEqual(99L, count);
}
using (var s = OpenSession())
{
var multiQuery = s.CreateMultiQuery()
.Add(s.CreateSQLQuery("select * from ITEM where Id > ?").AddEntity(typeof(Item))
.SetInt32(0, 50)
.SetFirstResult(20))
.Add(s.CreateQuery("select count(*) from Item i where i.Id > ?")
.SetInt32(0, 50));
multiQuery.SetCacheable(true);
var results = multiQuery.List();
var items = (IList)results[0];
Assert.AreEqual(79, items.Count,
"Should have gotten different result here, because the paging is different");
var count = (long)((IList)results[1])[0];
Assert.AreEqual(99L, count);
}
}
[Test]
public void CanUseSecondLevelCacheWithPositionalParameters()
{
var cacheHashtable = MultipleQueriesFixture.GetHashTableUsedAsQueryCache(Sfi);
cacheHashtable.Clear();
CreateItems();
DoMutiQueryAndAssert();
Assert.AreEqual(1, cacheHashtable.Count);
}
private void DoMutiQueryAndAssert()
{
using (var s = OpenSession())
{
var multiQuery = s.CreateMultiQuery()
.Add(s.CreateSQLQuery("select * from ITEM where Id > ?").AddEntity(typeof(Item))
.SetInt32(0, 50)
.SetFirstResult(10))
.Add(s.CreateQuery("select count(*) from Item i where i.Id > ?")
.SetInt32(0, 50));
multiQuery.SetCacheable(true);
var results = multiQuery.List();
var items = (IList)results[0];
Assert.AreEqual(89, items.Count);
var count = (long)((IList)results[1])[0];
Assert.AreEqual(99L, count);
}
}
private void CreateItems()
{
using (var s = OpenSession())
using (var t = s.BeginTransaction())
{
for (var i = 0; i < 150; i++)
{
var item = new Item();
item.Id = i;
s.Save(item);
}
t.Commit();
}
}
[Test]
public void CanUseWithParameterizedQueriesAndLimit()
{
using (var s = OpenSession())
{
for (var i = 0; i < 150; i++)
{
var item = new Item();
item.Id = i;
s.Save(item);
}
s.Flush();
}
using (var s = OpenSession())
{
var getItems = s.CreateSQLQuery("select * from ITEM where Id > :id").AddEntity(typeof(Item)).SetFirstResult(10);
var countItems = s.CreateQuery("select count(*) from Item i where i.Id > :id");
var results = s.CreateMultiQuery()
.Add(getItems)
.Add(countItems)
.SetInt32("id", 50)
.List();
var items = (IList)results[0];
Assert.AreEqual(89, items.Count);
var count = (long)((IList)results[1])[0];
Assert.AreEqual(99L, count);
}
}
[Test]
public void CanUseSetParameterList()
{
using (var s = OpenSession())
{
var item = new Item();
item.Id = 1;
s.Save(item);
s.Flush();
}
using (var s = OpenSession())
{
var results = s.CreateMultiQuery()
.Add(s.CreateSQLQuery("select * from ITEM where Id in (:items)").AddEntity(typeof(Item)))
.Add("select count(*) from Item i where i.id in (:items)")
.SetParameterList("items", new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 })
.List();
var items = (IList)results[0];
var fromDb = (Item)items[0];
Assert.AreEqual(1, fromDb.Id);
var counts = (IList)results[1];
var count = (long)counts[0];
Assert.AreEqual(1L, count);
}
}
[Test]
public void CanExecuteMultiplyQueriesInSingleRoundTrip()
{
using (var s = OpenSession())
{
var item = new Item();
item.Id = 1;
s.Save(item);
s.Flush();
}
using (var s = OpenSession())
{
var getItems = s.CreateSQLQuery("select * from ITEM").AddEntity(typeof(Item));
var countItems = s.CreateQuery("select count(*) from Item");
var results = s.CreateMultiQuery()
.Add(getItems)
.Add(countItems)
.List();
var items = (IList)results[0];
var fromDb = (Item)items[0];
Assert.AreEqual(1, fromDb.Id);
var counts = (IList)results[1];
var count = (long)counts[0];
Assert.AreEqual(1L, count);
}
}
[Test]
public void CanAddIQueryWithKeyAndRetrieveResultsWithKey()
{
CreateItems();
using (var session = OpenSession())
{
var multiQuery = session.CreateMultiQuery();
var firstQuery = session.CreateSQLQuery("select * from ITEM where Id < :id").AddEntity(typeof(Item))
.SetInt32("id", 50);
var secondQuery = session.CreateQuery("from Item");
multiQuery.Add("first", firstQuery).Add("second", secondQuery);
var secondResult = (IList)multiQuery.GetResult("second");
var firstResult = (IList)multiQuery.GetResult("first");
Assert.Greater(secondResult.Count, firstResult.Count);
}
}
[Test]
public void CanNotAddQueryWithKeyThatAlreadyExists()
{
using (var session = OpenSession())
{
var multiQuery = session.CreateMultiQuery();
var firstQuery = session.CreateSQLQuery("select * from ITEM where Id < :id").AddEntity(typeof(Item))
.SetInt32("id", 50);
try
{
IQuery secondQuery = session.CreateSQLQuery("select * from ITEM").AddEntity(typeof(Item));
multiQuery.Add("first", firstQuery).Add("second", secondQuery);
}
catch (InvalidOperationException)
{
}
catch (Exception)
{
Assert.Fail("This should've thrown an InvalidOperationException");
}
}
}
[Test]
public void CanNotRetrieveQueryResultWithUnknownKey()
{
using (var session = OpenSession())
{
var multiQuery = session.CreateMultiQuery();
multiQuery.Add("firstQuery", session.CreateSQLQuery("select * from ITEM").AddEntity(typeof(Item)));
try
{
multiQuery.GetResult("unknownKey");
Assert.Fail("This should've thrown an InvalidOperationException");
}
catch (InvalidOperationException)
{
}
catch (Exception)
{
Assert.Fail("This should've thrown an InvalidOperationException");
}
}
}
[Test]
public void ExecutingQueryThroughMultiQueryTransformsResults()
{
CreateItems();
using (var session = OpenSession())
{
var transformer = new ResultTransformerStub();
var query = session.CreateSQLQuery("select * from ITEM").AddEntity(typeof(Item))
.SetResultTransformer(transformer);
session.CreateMultiQuery()
.Add(query)
.List();
Assert.IsTrue(transformer.WasTransformTupleCalled, "Transform Tuple was not called");
Assert.IsTrue(transformer.WasTransformListCalled, "Transform List was not called");
}
}
[Test]
public void ExecutingQueryThroughMultiQueryTransformsResults_When_setting_on_multi_query_directly()
{
CreateItems();
using (var session = OpenSession())
{
var transformer = new ResultTransformerStub();
IQuery query = session.CreateSQLQuery("select * from ITEM").AddEntity(typeof(Item));
session.CreateMultiQuery()
.Add(query)
.SetResultTransformer(transformer)
.List();
Assert.IsTrue(transformer.WasTransformTupleCalled, "Transform Tuple was not called");
Assert.IsTrue(transformer.WasTransformListCalled, "Transform List was not called");
}
}
[Test]
public void CanGetResultsInAGenericList()
{
using (var s = OpenSession())
{
var getItems = s.CreateQuery("from Item");
var countItems = s.CreateSQLQuery("select count(*) as count from ITEM").AddScalar("count", NHibernateUtil.Int64);
var results = s.CreateMultiQuery()
.Add(getItems)
.Add<long>(countItems)
.List();
Assert.That(results[0], Is.InstanceOf<List<object>>());
Assert.That(results[1], Is.InstanceOf<List<long>>());
}
}
}
}
| Java |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, [email protected], All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program 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 terms and
# conditions of 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 program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import spack.cmd.location
import spack.modules
description = "cd to spack directories in the shell"
section = "environment"
level = "long"
def setup_parser(subparser):
"""This is for decoration -- spack cd is used through spack's
shell support. This allows spack cd to print a descriptive
help message when called with -h."""
spack.cmd.location.setup_parser(subparser)
def cd(parser, args):
spack.modules.print_help()
| Java |
/**
* Copyright (c) 2014, 2015, Oracle and/or its affiliates.
* All rights reserved.
*/
"use strict";
/*
Copyright 2013 jQuery Foundation and other contributors
Released under the MIT license.
http://jquery.org/license
Copyright 2013 jQuery Foundation and other contributors
Released under the MIT license.
http://jquery.org/license
*/
define(["ojs/ojcore","jquery","ojs/ojcomponentcore","ojs/ojpopupcore","jqueryui-amd/draggable"],function(a,f){(function(){a.Da("oj.ojDialog",f.oj.baseComponent,{version:"1.0.0",widgetEventPrefix:"oj",options:{cancelBehavior:"icon",dragAffordance:"title-bar",initialVisibility:"hide",modality:"modal",position:{my:"center",at:"center",of:window,collision:"fit",tja:function(a){var b=f(this).css(a).offset().top;0>b&&f(this).css("top",a.top-b)}},resizeBehavior:"resizable",role:"dialog",title:null,beforeClose:null,
beforeOpen:null,close:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},_ComponentCreate:function(){this._super();this.Wga={display:this.element[0].style.display,width:this.element[0].style.width,height:this.element[0].style.height};this.xn={parent:this.element.parent(),index:this.element.parent().children().index(this.element)};this.OK=this.element.attr("title");this.options.title=this.options.title||this.OK;this.j6();this.element.show().removeAttr("title").addClass("oj-dialog-content oj-dialog-default-content").appendTo(this.Ga);
this.Ls=!1;if(this.element.find(".oj-dialog").length){var d=this;this.element.find(".oj-dialog-header").each(function(a,c){var e=f(c);if(!e.closest(".oj-dialog-body").length)return d.gl=e,d.Ls=!0,!1})}else this.gl=this.element.find(".oj-dialog-header"),this.gl.length&&(this.Ls=!0);this.Ls?(this.Y5(this.gl),this.gl.prependTo(this.Ga),"icon"===this.options.cancelBehavior&&(this.uy(this.gl),this.Rv=this.gl.find(".oj-dialog-title"),this.Rv.length&&this.Rv.insertAfter(this.Gn))):this.i6();this.ij=this.element.children(".oj-dialog-footer");
this.X5(this.ij);this.ij.length&&(this.ij.addClass("oj-helper-clearfix"),this.ij.appendTo(this.Ga));"title-bar"===this.options.dragAffordance&&f.fn.draggable&&this.Po();this.er=!1;this.FS=this.tV.bind(this);this.Ga.length&&(a.C.jh(this.Ga[0],this.FS,30),this.er=!0);this.Dm=!1},uM:function(){"show"===this.options.initialVisibility&&this.open()},_destroy:function(){this.bQ&&window.clearTimeout(this.bQ);this.isOpen()&&this.Dq();this.er&&(a.C.gj(this.Ga[0],this.FS),this.er=!1);var d=this.Ga.hasClass("oj-draggable");
this.Ga.draggable&&d&&this.Ga.draggable("destroy");this.$o&&(this.$o("destroy"),this.$o=null);this.ij.length&&(this.ij.removeClass("oj-helper-clearfix"),f("#"+this.tU).replaceWith(this.ij));this.Dy();this.Ls&&(d=this.Ga.find(".oj-dialog-header"))&&f("#"+this.uU).replaceWith(d);this.Z_&&(this.Z_.remove(),this.Z_=null);this.element.removeUniqueId().removeClass("oj-dialog-content oj-dialog-default-content").css(this.Wga);this.Ga&&this.Ga.stop(!0,!0);this.element.unwrap();this.OK&&this.element.attr("title",
this.OK);this.ik&&(this.ik.remove(),this.ik=null);delete this.Ni;delete this.Dm;this._super()},widget:function(){return this.Ga},disable:f.noop,enable:f.noop,close:function(d){if(this.isOpen()&&(!1!==this._trigger("beforeClose",d)||this.Mu)){this.Dm=!1;this.n7=null;this.opener.filter(":focusable").focus().length||f(this.document[0].activeElement).blur();var b={};b[a.T.bb.Cf]=this.Ga;a.T.le().close(b);this._trigger("close",d)}},isOpen:function(){return this.Dm},open:function(d){!1!==this._trigger("beforeOpen",
d)&&(this.isOpen()||(this.Dm=!0,this.opener=f(this.document[0].activeElement),this.Qi(),"resizable"===this.options.resizeBehavior&&this.WT(),d={},d[a.T.bb.Cf]=this.Ga,d[a.T.bb.Rs]=this.opener,d[a.T.bb.Vs]=this.options.position,d[a.T.bb.mi]=this.options.modality,d[a.T.bb.Kn]=this.$q(),d[a.T.bb.Pl]="oj-dialog-layer",a.T.le().open(d),this._trigger("open")),this.VQ())},refresh:function(){this._super();this.Qi();this.tV()},VQ:function(){var d=this.n7;d&&0<d.length&&a.C.nn(this.Ga[0],d[0])||(d||(d=this.element.find("[autofocus]")),
d.length||(d=this.element.find(":tabbable")),d.length||this.ij.length&&(d=this.ij.find(":tabbable")),d.length||this.pL&&(d=this.pL.filter(":tabbable")),d.length||(d=this.Ga),d.eq(0).focus(),this._trigger("focus"))},_keepFocus:function(a){a.preventDefault();a=this.document[0].activeElement;this.Ga[0]===a||f.contains(this.Ga[0],a)||this.VQ()},Md:function(a){return!isNaN(parseInt(a,10))},j6:function(){this.gH=!1;this.element.uniqueId();this.lF=this.element.attr("id");this.Qea="ojDialogWrapper-"+this.lF;
this.Ga=f("\x3cdiv\x3e");this.Ga.addClass("oj-dialog oj-component").hide().attr({tabIndex:-1,role:this.options.role,id:this.Qea});this.Ga.insertBefore(this.element);this._on(this.Ga,{keyup:function(){},keydown:function(a){if("none"!=this.options.cancelBehavior&&!a.isDefaultPrevented()&&a.keyCode&&a.keyCode===f.ui.keyCode.ESCAPE)a.preventDefault(),a.stopImmediatePropagation(),this.close(a);else if(a.keyCode===f.ui.keyCode.TAB&&"modeless"!==this.options.modality){var b=this.Ga.find(":tabbable"),c=b.filter(":first"),
e=b.filter(":last");a.shiftKey?a.shiftKey&&(a.target===c[0]||a.target===this.Ga[0]?(e.focus(),a.preventDefault()):(c=b.index(document.activeElement),1==c&&b[0]&&(b[0].focus(),a.preventDefault()))):a.target===e[0]||a.target===this.Ga[0]?(c.focus(),a.preventDefault()):(c=b.index(document.activeElement),0==c&&b[1]&&(b[1].focus(),a.preventDefault()))}}});this.element.find("[aria-describedby]").length||this.Ga.attr({"aria-describedby":this.element.uniqueId().attr("id")})},Dy:function(){this.Gn&&(this.Gn.remove(),
this.pL=this.Gn=null)},uy:function(a){this.Gn=f("\x3cdiv\x3e").addClass("oj-dialog-header-close-wrapper").attr("tabindex","1").attr("aria-label","close").attr("role","button").appendTo(a);this.pL=f("\x3cspan\x3e").addClass("oj-component-icon oj-clickable-icon oj-dialog-close-icon").attr("alt","close icon").prependTo(this.Gn);this._on(this.Gn,{click:function(a){a.preventDefault();a.stopImmediatePropagation();this.close(a)},mousedown:function(a){f(a.currentTarget).addClass("oj-active")},mouseup:function(a){f(a.currentTarget).removeClass("oj-active")},
mouseenter:function(a){f(a.currentTarget).addClass("oj-hover")},mouseleave:function(a){a=a.currentTarget;f(a).removeClass("oj-hover");f(a).removeClass("oj-active")},keyup:function(a){if(a.keyCode&&a.keyCode===f.ui.keyCode.SPACE||a.keyCode===f.ui.keyCode.ENTER)a.preventDefault(),a.stopImmediatePropagation(),this.close(a)}})},i6:function(){var a;this.ik=f("\x3cdiv\x3e").addClass("oj-dialog-header oj-helper-clearfix").prependTo(this.Ga);this._on(this.ik,{mousedown:function(a){f(a.target).closest(".oj-dialog-close-icon")||
this.Ga.focus()}});"icon"===this.options.cancelBehavior&&this.uy(this.ik);a=f("\x3cspan\x3e").uniqueId().addClass("oj-dialog-title").appendTo(this.ik);this.SW(a);this.Ga.attr({"aria-labelledby":a.attr("id")})},SW:function(a){this.options.title||a.html("\x26#160;");a.text(this.options.title)},Po:function(){function a(b){return{position:b.position,offset:b.offset}}var b=this,c=this.options;this.Ga.draggable({Jia:!1,cancel:".oj-dialog-content, .oj-dialog-header-close",handle:".oj-dialog-header",containment:"document",
start:function(c,g){f(this).addClass("oj-dialog-dragging");b.LO();b._trigger("dragStart",c,a(g))},drag:function(c,f){b._trigger("drag",c,a(f))},stop:function(e,g){c.position=[g.position.left-b.document.scrollLeft(),g.position.top-b.document.scrollTop()];f(this).removeClass("oj-dialog-dragging");b.$W();b._trigger("dragStop",e,a(g))}});this.Ga.addClass("oj-draggable")},WT:function(){function a(b){return{originalPosition:b.xn,originalSize:b.fj,position:b.position,size:b.size}}var b=this;this.Ga.css("position");
this.$o=this.Ga.ojResizable.bind(this.Ga);this.$o({cancel:".oj-dialog-content",containment:"document",handles:"n,e,s,w,se,sw,ne,nw",start:function(c,e){b.gH=!0;f(this).addClass("oj-dialog-resizing");b.LO();b._trigger("resizeStart",c,a(e))},resize:function(c,e){b._trigger("resize",c,a(e))},stop:function(c,e){b.gH=!1;f(this).removeClass("oj-dialog-resizing");b.$W();b._trigger("resizeStop",c,a(e))}})},IH:function(){var d="rtl"===this.hc(),d=a.jd.Kg(this.options.position,d);this.Ga.position(d);this.vU()},
vU:function(){a.T.le().oL(this.Ga,a.T.sc.Rl)},_setOption:function(d,b,c){var e;e=this.Ga;if("disabled"!==d)switch(this._super(d,b,c),d){case "dragAffordance":(d=e.hasClass("oj-draggable"))&&"none"===b&&(e.draggable("destroy"),this.Ga.removeClass("oj-draggable"));d||"title-bar"!==b||this.Po();break;case "position":this.IH();break;case "resizeBehavior":e=!1;this.$o&&(e=!0);e&&"resizable"!=b&&(this.$o("destroy"),this.$o=null);e||"resizable"!==b||this.WT();break;case "title":this.SW(this.ik.find(".oj-dialog-title"));
break;case "role":e.attr("role",b);break;case "modality":this.isOpen()&&(e={},e[a.T.bb.Cf]=this.Ga,e[a.T.bb.mi]=b,a.T.le().$v(e));break;case "cancelBehavior":"none"===b||"escape"===b?this.Dy():"icon"===b&&(this.Ls?(this.Dy(),this.uy(this.gl),this.Rv=this.gl.find(".oj-dialog-title"),this.Rv.length&&this.Rv.insertAfter(this.Gn)):(this.Dy(),this.uy(this.ik),this.F_=this.ik.find(".oj-dialog-title"),this.F_.length&&this.F_.insertAfter(this.Gn)))}},tV:function(){var a=!1;this.Ga.length&&this.Ga[0].style.height&&
(a=this.Ga[0].style.height.indexOf("%"));this.gH&&a&&(a=this.y7(),this.element.css({height:a}))},y7:function(){this.bQ=null;var a=(this.Ls?this.gl:this.ik).outerHeight(),b=0;this.ij.length&&(b=this.ij.outerHeight());return this.Ga.height()-a-b},Saa:function(){var a=f("\x3cdiv\x3e");this.RP=this.Ga.css("height");"auto"!=this.RP?(a.height(this.RP),this.Xt=a.height(),this.Md(this.Xt)&&(this.Xt=Math.ceil(this.Xt))):this.Xt="auto";a.remove()},Qi:function(){this.Saa();var a=this.Ga[0].style.height,b=this.Ga[0].style.width,
c=this.Ga[0].style.minHeight,e=this.Ga[0].style.maxHeight;this.element.css({width:"auto",minHeight:0,maxHeight:"none",height:0});var f;f=this.Ga.css({minHeight:0,maxHeight:"none",height:"auto"}).outerHeight();this.element.css({width:"",minHeight:"",maxHeight:"",height:""});this.Ga.css({width:b});this.Ga.css({height:a});this.Ga.css({minHeight:c});this.Ga.css({maxHeight:e});"auto"!=a&&""!=a&&this.element.height(Math.max(0,this.Xt+0-f))},LO:function(){this.eK=this.document.find("iframe").map(function(){var a=
f(this),b=a.offset();return f("\x3cdiv\x3e").css({width:a.outerWidth(),height:a.outerHeight()}).appendTo(a.parent()).offset(b)[0]})},$W:function(){this.eK&&(this.eK.remove(),delete this.eK)},X5:function(a){this.tU="ojDialogPlaceHolderFooter-"+this.lF;this.zba=f("\x3cdiv\x3e").hide().attr({id:this.tU});this.zba.insertBefore(a)},Y5:function(a){this.uU="ojDialogPlaceHolderHeader-"+this.lF;this.Aba=f("\x3cdiv\x3e").hide().attr({id:this.uU});this.Aba.insertBefore(a)},getNodeBySubId:function(a){if(null==
a)return this.element?this.element[0]:null;a=a.subId;switch(a){case "oj-dialog":case "oj-dialog-header":case "oj-dialog-body":case "oj-dialog-footer":case "oj-dialog-content":case "oj-dialog-header-close-wrapper":case "oj-dialog-close-icon":case "oj-resizable-n":case "oj-resizable-e":case "oj-resizable-s":case "oj-resizable-w":case "oj-resizable-se":case "oj-resizable-sw":case "oj-resizable-ne":case "oj-resizable-nw":return a="."+a,this.widget().find(a)[0]}return null},ep:function(){this.element.remove()},
$q:function(){if(!this.Ni){var d=this.Ni={};d[a.T.sc.Tp]=f.proxy(this.Dq,this);d[a.T.sc.Up]=f.proxy(this.ep,this);d[a.T.sc.Rl]=f.proxy(this.vU,this)}return this.Ni},Dq:function(){this.Mu=!0;this.close();delete this.Mu}})})();(function(){var d=!1;f(document).mouseup(function(){d=!1});a.Da("oj.ojResizable",f.oj.baseComponent,{version:"1.0.0",widgetEventPrefix:"oj",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,alsoResize:!1,
animate:!1,animateDuration:"slow",animateEasing:"swing",containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,resize:null,start:null,stop:null},eba:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(c){return a.dba(c)}).bind("click."+this.widgetName,function(c){if(!0===f.data(c.target,a.widgetName+".preventClickEvent"))return f.removeData(c.target,a.widgetName+".preventClickEvent"),c.stopImmediatePropagation(),!1})},cba:function(){this.element.unbind("."+this.widgetName);
this.Xz&&this.document.unbind("mousemove."+this.widgetName,this.Xz).unbind("mouseup."+this.widgetName,this.rH)},dba:function(a){if(!d){this.Jm&&this.Yz(a);this.Vz=a;var c=this,e=1===a.which,g="string"===typeof this.options.cancel&&a.target.nodeName?f(a.target).closest(this.options.cancel).length:!1;if(!e||g||!this.bba(a))return!0;(this.Iw=!this.options.delay)||setTimeout(function(){c.Iw=!0},this.options.delay);if(this.dU(a)&&this.Iw&&(this.Jm=!1!==this.qH(a),!this.Jm))return a.preventDefault(),!0;
!0===f.data(a.target,this.widgetName+".preventClickEvent")&&f.removeData(a.target,this.widgetName+".preventClickEvent");this.Xz=function(a){return c.fba(a)};this.rH=function(a){return c.Yz(a)};this.document.bind("mousemove."+this.widgetName,this.Xz).bind("mouseup."+this.widgetName,this.rH);a.preventDefault();return d=!0}},fba:function(a){if(f.ui.Wia&&(!document.documentMode||9>document.documentMode)&&!a.button||!a.which)return this.Yz(a);if(this.Jm)return this.Wz(a),a.preventDefault();this.dU(a)&&
this.Iw&&((this.Jm=!1!==this.qH(this.Vz,a))?this.Wz(a):this.Yz(a));return!this.Jm},Yz:function(a){this.document.unbind("mousemove."+this.widgetName,this.Xz).unbind("mouseup."+this.widgetName,this.rH);this.Jm&&(this.Jm=!1,a.target===this.Vz.target&&f.data(a.target,this.widgetName+".preventClickEvent",!0),this.bv(a));return d=!1},dU:function(a){return Math.max(Math.abs(this.Vz.pageX-a.pageX),Math.abs(this.Vz.pageY-a.pageY))>=this.options.distance},Cia:function(){return this.Iw},vH:function(a){return parseInt(a,
10)||0},Md:function(a){return!isNaN(parseInt(a,10))},JS:function(a,c){if("hidden"===f(a).css("overflow"))return!1;var d=c&&"left"===c?"scrollLeft":"scrollTop",g=!1;if(0<a[d])return!0;a[d]=1;g=0<a[d];a[d]=0;return g},_ComponentCreate:function(){this._super();var a,c,d,g,h,k=this;a=this.options;this.element.addClass("oj-resizable");f.extend(this,{PB:this.element,jA:[],Gj:null});this.handles=a.handles||(f(".oj-resizable-handle",this.element).length?{cja:".oj-resizable-n",Oia:".oj-resizable-e",lja:".oj-resizable-s",
Gc:".oj-resizable-w",nja:".oj-resizable-se",pja:".oj-resizable-sw",dja:".oj-resizable-ne",gja:".oj-resizable-nw"}:"e,s,se");if(this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),a=this.handles.split(","),this.handles={},c=0;c<a.length;c++)d=f.trim(a[c]),h="oj-resizable-"+d,g=f("\x3cdiv class\x3d'oj-resizable-handle "+h+"'\x3e\x3c/div\x3e"),this.handles[d]=".oj-resizable-"+d,this.element.append(g);this.Ica=function(){for(var a in this.handles)this.handles[a].constructor===
String&&(this.handles[a]=this.element.children(this.handles[a]).first().show())};this.Ica();this.l$=f(".oj-resizable-handle",this.element);this.l$.mouseover(function(){k.k_||(this.className&&(g=this.className.match(/oj-resizable-(se|sw|ne|nw|n|e|s|w)/i)),k.axis=g&&g[1]?g[1]:"se")});this.eba()},_destroy:function(){this.cba();f(this.PB).removeClass("oj-resizable oj-resizable-disabled oj-resizable-resizing").removeData("resizable").removeData("oj-resizable").unbind(".resizable").find(".oj-resizable-handle").remove();
return this},bba:function(a){var c,d,g=!1;for(c in this.handles)if(d=f(this.handles[c])[0],d===a.target||f.contains(d,a.target))g=!0;return!this.options.disabled&&g},qH:function(a){var c,d,g;g=this.options;c=this.element.position();var h=this.element;this.k_=!0;/absolute/.test(h.css("position"))?h.css({position:"absolute",top:h.css("top"),left:h.css("left")}):h.is(".oj-draggable")&&h.css({position:"absolute",top:c.top,left:c.left});this.Jca();c=this.vH(this.helper.css("left"));d=this.vH(this.helper.css("top"));
g.containment&&(c+=f(g.containment).scrollLeft()||0,d+=f(g.containment).scrollTop()||0);this.offset=this.helper.offset();this.position={left:c,top:d};this.size={width:h.width(),height:h.height()};this.fj={width:h.width(),height:h.height()};this.xn={left:c,top:d};this.YB={width:h.outerWidth()-h.width(),height:h.outerHeight()-h.height()};this.Xga={left:a.pageX,top:a.pageY};this.Sj=this.fj.width/this.fj.height||1;g=f(".oj-resizable-"+this.axis).css("cursor");f("body").css("cursor","auto"===g?this.axis+
"-resize":g);h.addClass("oj-resizable-resizing");this.MH("start",a);this.g4(a);this.u5(a);return!0},Wz:function(a){var c,d=this.helper,g={},h=this.Xga;c=a.pageX-h.left||0;var h=a.pageY-h.top||0,k=this.rg[this.axis];this.Fs={top:this.position.top,left:this.position.left};this.Gs={width:this.size.width,height:this.size.height};if(!k)return!1;c=k.apply(this,[a,c,h]);this.Hea(a.shiftKey);a.shiftKey&&(c=this.Gea(c,a));c=this.Uca(c,a);this.Aea(c);this.MH("resize",a);this.f4(a,this.ui());this.t5(a,this.ui());
this.position.top!==this.Fs.top&&(g.top=this.position.top+"px");this.position.left!==this.Fs.left&&(g.left=this.position.left+"px");this.size.width!==this.Gs.width&&(g.width=this.size.width+"px");this.size.height!==this.Gs.height&&(g.height=this.size.height+"px");d.css(g);!this.Gj&&this.jA.length&&this.Vba();f.isEmptyObject(g)||this._trigger("resize",a,this.ui());return!1},bv:function(a){this.k_=!1;f("body").css("cursor","auto");this.element.removeClass("oj-resizable-resizing");this.MH("stop",a);
this.h4(a);this.v5(a);return!1},Hea:function(a){var c,d,f,h;h=this.options;h={minWidth:this.Md(h.minWidth)?h.minWidth:0,maxWidth:this.Md(h.maxWidth)?h.maxWidth:Infinity,minHeight:this.Md(h.minHeight)?h.minHeight:0,maxHeight:this.Md(h.maxHeight)?h.maxHeight:Infinity};a&&(a=h.minHeight*this.Sj,d=h.minWidth/this.Sj,c=h.maxHeight*this.Sj,f=h.maxWidth/this.Sj,a>h.minWidth&&(h.minWidth=a),d>h.minHeight&&(h.minHeight=d),c<h.maxWidth&&(h.maxWidth=c),f<h.maxHeight&&(h.maxHeight=f));this.Kea=h},Aea:function(a){this.offset=
this.helper.offset();this.Md(a.left)&&(this.position.left=a.left);this.Md(a.top)&&(this.position.top=a.top);this.Md(a.height)&&(this.size.height=a.height);this.Md(a.width)&&(this.size.width=a.width)},Gea:function(a){var c=this.position,d=this.size,f=this.axis;this.Md(a.height)?a.width=a.height*this.Sj:this.Md(a.width)&&(a.height=a.width/this.Sj);"sw"===f&&(a.left=c.left+(d.width-a.width),a.top=null);"nw"===f&&(a.top=c.top+(d.height-a.height),a.left=c.left+(d.width-a.width));return a},Uca:function(a){var c=
this.Kea,d=this.axis,f=this.Md(a.width)&&c.maxWidth&&c.maxWidth<a.width,h=this.Md(a.height)&&c.maxHeight&&c.maxHeight<a.height,k=this.Md(a.width)&&c.minWidth&&c.minWidth>a.width,l=this.Md(a.height)&&c.minHeight&&c.minHeight>a.height,m=this.xn.left+this.fj.width,n=this.position.top+this.size.height,q=/sw|nw|w/.test(d),d=/nw|ne|n/.test(d);k&&(a.width=c.minWidth);l&&(a.height=c.minHeight);f&&(a.width=c.maxWidth);h&&(a.height=c.maxHeight);k&&q&&(a.left=m-c.minWidth);f&&q&&(a.left=m-c.maxWidth);l&&d&&
(a.top=n-c.minHeight);h&&d&&(a.top=n-c.maxHeight);a.width||a.height||a.left||!a.top?a.width||a.height||a.top||!a.left||(a.left=null):a.top=null;return a},Vba:function(){if(this.jA.length){var a,c,d,f,h,k=this.helper||this.element;for(a=0;a<this.jA.length;a++){h=this.jA[a];if(!this.as)for(this.as=[],d=[h.css("borderTopWidth"),h.css("borderRightWidth"),h.css("borderBottomWidth"),h.css("borderLeftWidth")],f=[h.css("paddingTop"),h.css("paddingRight"),h.css("paddingBottom"),h.css("paddingLeft")],c=0;c<
d.length;c++)this.as[c]=(parseInt(d[c],10)||0)+(parseInt(f[c],10)||0);h.css({height:k.height()-this.as[0]-this.as[2]||0,width:k.width()-this.as[1]-this.as[3]||0})}}},Jca:function(){this.element.offset();this.helper=this.element},rg:{e:function(a,c){return{width:this.fj.width+c}},w:function(a,c){return{left:this.xn.left+c,width:this.fj.width-c}},n:function(a,c,d){return{top:this.xn.top+d,height:this.fj.height-d}},s:function(a,c,d){return{height:this.fj.height+d}},se:function(a,c,d){return f.extend(this.rg.s.apply(this,
arguments),this.rg.e.apply(this,[a,c,d]))},sw:function(a,c,d){return f.extend(this.rg.s.apply(this,arguments),this.rg.w.apply(this,[a,c,d]))},ne:function(a,c,d){return f.extend(this.rg.n.apply(this,arguments),this.rg.e.apply(this,[a,c,d]))},nw:function(a,c,d){return f.extend(this.rg.n.apply(this,arguments),this.rg.w.apply(this,[a,c,d]))}},MH:function(a,c){"resize"!==a&&this._trigger(a,c,this.ui())},g4:function(){function a(b){f(b).each(function(){var a=f(this);a.data("oj-resizable-alsoresize",{width:parseInt(a.width(),
10),height:parseInt(a.height(),10),left:parseInt(a.css("left"),10),top:parseInt(a.css("top"),10)})})}var c=this.options;"object"!==typeof c.alsoResize||c.alsoResize.parentNode?a(c.alsoResize):c.alsoResize.length?(c.alsoResize=c.alsoResize[0],a(c.alsoResize)):f.each(c.alsoResize,function(c){a(c)})},f4:function(a,c){function d(a,b){f(a).each(function(){var a=f(this),d=f(this).data("oj-resizable-alsoresize"),e={};f.each(b&&b.length?b:a.parents(c.PB[0]).length?["width","height"]:["width","height","top",
"left"],function(a,b){var c=(d[b]||0)+(l[b]||0);c&&0<=c&&(e[b]=c||null)});a.css(e)})}var g=this.options,h=this.fj,k=this.xn,l={height:this.size.height-h.height||0,width:this.size.width-h.width||0,top:this.position.top-k.top||0,left:this.position.left-k.left||0};"object"!==typeof g.alsoResize||g.alsoResize.nodeType?d(g.alsoResize,null):f.each(g.alsoResize,function(a,b){d(a,b)})},h4:function(){f(this).removeData("oj-resizable-alsoresize")},u5:function(){var a,c,d,g,h,k=this,l=k.element;d=k.options.containment;
if(l=d instanceof f?d.get(0):/parent/.test(d)?l.parent().get(0):d)k.iB=f(l),/document/.test(d)||d===document?(k.jB={left:0,top:0},k.HX={left:0,top:0},k.yn={element:f(document),left:0,top:0,width:f(document).width(),height:f(document).height()||document.body.parentNode.scrollHeight}):(a=f(l),c=[],f(["Top","Right","Left","Bottom"]).each(function(d,e){c[d]=k.vH(a.css("padding"+e))}),k.jB=a.offset(),k.HX=a.position(),k.IX={height:a.innerHeight()-c[3],width:a.innerWidth()-c[1]},d=k.jB,g=k.IX.height,h=
k.IX.width,h=k.JS(l,"left")?l.scrollWidth:h,g=k.JS(l)?l.scrollHeight:g,k.yn={element:l,left:d.left,top:d.top,width:h,height:g})},t5:function(a,c){var d,f,h,k;d=this.options;f=this.jB;k=this.position;var l=a.shiftKey;h={top:0,left:0};var m=this.iB,n=!0;m[0]!==document&&/static/.test(m.css("position"))&&(h=f);k.left<(this.Gj?f.left:0)&&(this.size.width+=this.Gj?this.position.left-f.left:this.position.left-h.left,l&&(this.size.height=this.size.width/this.Sj,n=!1),this.position.left=d.helper?f.left:0);
k.top<(this.Gj?f.top:0)&&(this.size.height+=this.Gj?this.position.top-f.top:this.position.top,l&&(this.size.width=this.size.height*this.Sj,n=!1),this.position.top=this.Gj?f.top:0);this.offset.left=this.yn.left+this.position.left;this.offset.top=this.yn.top+this.position.top;d=Math.abs((this.Gj?this.offset.left-h.left:this.offset.left-f.left)+this.YB.width);f=Math.abs((this.Gj?this.offset.top-h.top:this.offset.top-f.top)+this.YB.height);h=this.iB.get(0)===this.element.parent().get(0);k=/relative|absolute/.test(this.iB.css("position"));
h&&k&&(d-=Math.abs(this.yn.left));d+this.size.width>=this.yn.width&&(this.size.width=this.yn.width-d,l&&(this.size.height=this.size.width/this.Sj,n=!1));f+this.size.height>=this.yn.height&&(this.size.height=this.yn.height-f,l&&(this.size.width=this.size.height*this.Sj,n=!1));n||(this.position.left=c.Fs.left,this.position.top=c.Fs.top,this.size.width=c.Gs.width,this.size.height=c.Gs.height)},v5:function(){var a=this.options,c=this.jB,d=this.HX,g=this.iB,h=f(this.helper),k=h.offset(),l=h.outerWidth()-
this.YB.width,h=h.outerHeight()-this.YB.height;this.Gj&&!a.animate&&/relative/.test(g.css("position"))&&f(this).css({left:k.left-d.left-c.left,width:l,height:h});this.Gj&&!a.animate&&/static/.test(g.css("position"))&&f(this).css({left:k.left-d.left-c.left,width:l,height:h})},ui:function(){return{PB:this.PB,element:this.element,helper:this.helper,position:this.position,size:this.size,fj:this.fj,xn:this.xn,Gs:this.Gs,Fs:this.Fs}}})})()}); | Java |
/* $XConsortium: xrmLib.h /main/5 1995/07/15 20:46:59 drk $ */
/*
* Motif
*
* Copyright (c) 1987-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they 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 these librararies and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/*
* HISTORY
*/
#ifndef xrmLib_h
#define xrmLib_h
/* Function Name: InitializeXrm
*
* Description: Open the Xrm database
*
* Arguments: file_name - name of xrm database file
*
*
*/
extern Boolean InitializeXrm(
char *
);
/* Function Name: GetWorkspaceResources
*
* Description: Gets the workspace resources for a window
*
* Arguments: widget - any widget
* specifier - A list of quarks that specifies the
* window (SM_CLIENT_ID, WM_ROLE).
* room_list - returns a quark list of room names that
* the window is in.
* all_workspaces - returns allWorkspaces resource
* linked - returns linked resource
*
*/
extern Boolean GetWorkspaceResources(
Widget w,
XrmQuarkList specifier,
XrmQuarkList *room_qlist,
Boolean *all_workspaces,
Boolean *linked
);
extern Boolean GetSpaceListResources(
Widget w,
char ***,
char ***,
char ***,
char**,
Boolean*
);
/* Function Name: GetWindowConfigurationEntry
*
* Description: Gets the configuration information for a specified
* window.
*
* Arguments: specifier - A list of quarks that specifies the
* window (SM_CLIENT_ID, WM_ROLE).
* attribute_list - A quark list of attribute names
* to search for in database.
* room_name - Room name that the window is in.
* if it is linked then the linkedRoom
* quark should be passed.
* attributes_values - Returns array of values
* found in the database. The array
* length is equal to attribute_list length.
* (If no value is found for an attribute then
* a value with 0 length and NULL addr is passed)
*
* Returns: True if any resources found, else False.
*
*
*/
extern Boolean GetWindowConfigurationEntry(
XrmQuarkList specifier,
XrmQuarkList attribute_list,
XrmQuark room_name,
XrmValue **attribute_values
);
/* Function Name: GetWindowStackedEntry
*
* Description: Gets the stacked resource for a specified
* window.
*
* Arguments: specifier - A list of quarks that specifies the
* window (SM_CLIENT_ID, WM_ROLE).
* room_name - Room name that the window is in.
* if it is linked then the linkedRoom
* quark should be passed.
* attributes_value - Returns a stacked value
*
* Returns: True if resources found, else False.
*
*
*/
extern Boolean GetWindowStackedEntry(
XrmQuarkList specifier,
XrmQuark room_name,
XrmValue *attribute_value
);
/*
* Function Name: GetAllWindowConfigurationEntry
*
* Description: Gets the configuration information for a specified
* window.
*
* Arguments: specifier - A list of quarks that specifies the
* window (SM_CLIENT_ID, WM_ROLE).
* attribute_list - A quark list of attribute names
* to search for in database.
* room_list - list of room names that the window is in.
* if it is linked then the linkedRoom
* quark should be passed.
* attributes_values - Returns double array of values
* found in the database. The array
* width is equal to the number of rooms. The array
* length is equal to attribute_list length.
* (If no value is found for an attribute then
* a value with 0 length and NULL addr is passed)
*
* Returns: True if any resources found, else False.
*
*
*
*/
extern Boolean GetAllWindowConfigurationEntry(
XrmQuarkList specifier,
XrmQuarkList attribute_list,
XrmQuarkList room_list,
XrmValue ***attribute_values
);
/*
*
* Function Name: SaveWorkspaceResources
*
* Description: Save the workspaces resources in the xrm database
* window.
*
* Arguments: widget - any widget
* specifier - A list of quarks that specifies the
* window (SM_CLIENT_ID, WM_ROLE).
* room_nameq - Room name quark to be added to database.
* all_workspaces - allWorkspaces resource
* linked - linked resource
*
*/
extern Boolean SaveWorkspaceResources(
Widget,
XrmQuarkList,
XrmQuark,
XrmQuark,
Boolean,
Boolean
);
extern Boolean SaveSpaceListResources(
char *,
char *,
char *,
char *
);
/*
*
* Function Name: SaveWindowConfiguration
*
* Description: Save the window configuration in the xrm database
*
* Arguments: specifier - A list of quarks that specifies the
* window (SM_CLIENT_ID, WM_ROLE).
* attribute_qlist - A quark list of attribute names to
* be saved in database.
* room_nameq - Room name quark that the configuration is in.
* if it is linked then the linkedRoom
* quark should be passed.
* attr_values - list of attribute values (matches attrib_qlist)
*
*/
extern Boolean SaveWindowConfiguration(
XrmQuarkList,
XrmQuarkList,
XrmQuark,
XrmValue *
);
/*
*
* Function Name: PurgeWindowConfiguration
*
* Description: Remove the window configuration from the xrm database
*
* Arguments: specifier - A list of quarks that specifies the
* window (SM_CLIENT_ID, WM_ROLE).
* attribute_qlist - A quark list of attribute names to
* be removed in database.
* room_nameq - the room that the configuration
*
*/
extern Boolean
PurgeWindowConfiguration(
Widget w,
XrmQuarkList specifier_list,
XrmQuarkList attribute_qlist,
XrmQuark room_nameq
);
/*
*
* Function Name: PurgeAllWindowConfiguration
*
* Description: Remove the window configuration from the xrm database
*
* Arguments: specifier - A list of quarks that specifies the
* window (SM_CLIENT_ID, WM_ROLE).
* attribute_qlist - A quark list of attribute names to
* be removed in database.
* room_nameq - the room that the configuration
*
*/
extern Boolean
PurgeAllWindowConfiguration(
Widget w,
XrmQuarkList specifier_list,
XrmQuarkList attribute_qlist
);
/*
*
* Function Name: SaveWsmToFile
*
* Description: Saves the Xrm database to a specified file
*
* Arguments: file_name - file name
*
*/
extern void
SaveWsmToFile(
char *file_name
);
#endif
| Java |
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "qmlprofilertraceview.h"
#include "qmlprofilertool.h"
#include "qmlprofilerstatemanager.h"
#include "qmlprofilerdatamodel.h"
// Needed for the load&save actions in the context menu
#include <analyzerbase/ianalyzertool.h>
// Comunication with the other views (limit events to range)
#include "qmlprofilerviewmanager.h"
#include <utils/styledbar.h>
#include <QDeclarativeContext>
#include <QToolButton>
#include <QEvent>
#include <QVBoxLayout>
#include <QGraphicsObject>
#include <QScrollBar>
#include <QSlider>
#include <QMenu>
#include <math.h>
using namespace QmlDebug;
namespace QmlProfiler {
namespace Internal {
const int sliderTicks = 10000;
const qreal sliderExp = 3;
/////////////////////////////////////////////////////////
bool MouseWheelResizer::eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::Wheel) {
QWheelEvent *ev = static_cast<QWheelEvent *>(event);
if (ev->modifiers() & Qt::ControlModifier) {
emit mouseWheelMoved(ev->pos().x(), ev->pos().y(), ev->delta());
return true;
}
}
return QObject::eventFilter(obj, event);
}
/////////////////////////////////////////////////////////
void ZoomControl::setRange(qint64 startTime, qint64 endTime)
{
if (m_startTime != startTime || m_endTime != endTime) {
m_startTime = startTime;
m_endTime = endTime;
emit rangeChanged();
}
}
/////////////////////////////////////////////////////////
ScrollableDeclarativeView::ScrollableDeclarativeView(QWidget *parent)
: QDeclarativeView(parent)
{
}
ScrollableDeclarativeView::~ScrollableDeclarativeView()
{
}
void ScrollableDeclarativeView::scrollContentsBy(int dx, int dy)
{
// special workaround to track the scrollbar
if (rootObject()) {
int scrollY = rootObject()->property("scrollY").toInt();
rootObject()->setProperty("scrollY", QVariant(scrollY - dy));
}
QDeclarativeView::scrollContentsBy(dx,dy);
}
/////////////////////////////////////////////////////////
class QmlProfilerTraceView::QmlProfilerTraceViewPrivate
{
public:
QmlProfilerTraceViewPrivate(QmlProfilerTraceView *qq) : q(qq) {}
QmlProfilerTraceView *q;
QmlProfilerStateManager *m_profilerState;
Analyzer::IAnalyzerTool *m_profilerTool;
QmlProfilerViewManager *m_viewContainer;
QSize m_sizeHint;
ScrollableDeclarativeView *m_mainView;
QDeclarativeView *m_timebar;
QDeclarativeView *m_overview;
QmlProfilerDataModel *m_profilerDataModel;
ZoomControl *m_zoomControl;
QToolButton *m_buttonRange;
QToolButton *m_buttonLock;
QWidget *m_zoomToolbar;
int m_currentZoomLevel;
};
QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerTool *profilerTool, QmlProfilerViewManager *container, QmlProfilerDataModel *model, QmlProfilerStateManager *profilerState)
: QWidget(parent), d(new QmlProfilerTraceViewPrivate(this))
{
setObjectName(QLatin1String("QML Profiler"));
d->m_zoomControl = new ZoomControl(this);
connect(d->m_zoomControl, SIGNAL(rangeChanged()), this, SLOT(updateRange()));
QVBoxLayout *groupLayout = new QVBoxLayout;
groupLayout->setContentsMargins(0, 0, 0, 0);
groupLayout->setSpacing(0);
d->m_mainView = new ScrollableDeclarativeView(this);
d->m_mainView->setResizeMode(QDeclarativeView::SizeViewToRootObject);
d->m_mainView->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
d->m_mainView->setBackgroundBrush(QBrush(Qt::white));
d->m_mainView->setAlignment(Qt::AlignLeft | Qt::AlignTop);
d->m_mainView->setFocus();
MouseWheelResizer *resizer = new MouseWheelResizer(this);
connect(resizer,SIGNAL(mouseWheelMoved(int,int,int)), this, SLOT(mouseWheelMoved(int,int,int)));
d->m_mainView->viewport()->installEventFilter(resizer);
QHBoxLayout *toolsLayout = new QHBoxLayout;
d->m_timebar = new QDeclarativeView(this);
d->m_timebar->setResizeMode(QDeclarativeView::SizeRootObjectToView);
d->m_timebar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
d->m_timebar->setFixedHeight(24);
d->m_overview = new QDeclarativeView(this);
d->m_overview->setResizeMode(QDeclarativeView::SizeRootObjectToView);
d->m_overview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
d->m_overview->setMaximumHeight(50);
d->m_zoomToolbar = createZoomToolbar();
d->m_zoomToolbar->move(0, d->m_timebar->height());
d->m_zoomToolbar->setVisible(false);
toolsLayout->addWidget(createToolbar());
toolsLayout->addWidget(d->m_timebar);
emit enableToolbar(false);
groupLayout->addLayout(toolsLayout);
groupLayout->addWidget(d->m_mainView);
groupLayout->addWidget(d->m_overview);
setLayout(groupLayout);
d->m_profilerTool = profilerTool;
d->m_viewContainer = container;
d->m_profilerDataModel = model;
connect(d->m_profilerDataModel, SIGNAL(stateChanged()),
this, SLOT(profilerDataModelStateChanged()));
d->m_mainView->rootContext()->setContextProperty(QLatin1String("qmlProfilerDataModel"),
d->m_profilerDataModel);
d->m_overview->rootContext()->setContextProperty(QLatin1String("qmlProfilerDataModel"),
d->m_profilerDataModel);
d->m_profilerState = profilerState;
connect(d->m_profilerState, SIGNAL(stateChanged()),
this, SLOT(profilerStateChanged()));
connect(d->m_profilerState, SIGNAL(clientRecordingChanged()),
this, SLOT(clientRecordingChanged()));
connect(d->m_profilerState, SIGNAL(serverRecordingChanged()),
this, SLOT(serverRecordingChanged()));
// Minimum height: 5 rows of 20 pixels + scrollbar of 50 pixels + 20 pixels margin
setMinimumHeight(170);
d->m_currentZoomLevel = 0;
}
QmlProfilerTraceView::~QmlProfilerTraceView()
{
delete d;
}
/////////////////////////////////////////////////////////
// Initialize widgets
void QmlProfilerTraceView::reset()
{
d->m_mainView->rootContext()->setContextProperty(QLatin1String("zoomControl"), d->m_zoomControl);
d->m_timebar->rootContext()->setContextProperty(QLatin1String("zoomControl"), d->m_zoomControl);
d->m_overview->rootContext()->setContextProperty(QLatin1String("zoomControl"), d->m_zoomControl);
d->m_timebar->setSource(QUrl(QLatin1String("qrc:/qmlprofiler/TimeDisplay.qml")));
d->m_overview->setSource(QUrl(QLatin1String("qrc:/qmlprofiler/Overview.qml")));
d->m_mainView->setSource(QUrl(QLatin1String("qrc:/qmlprofiler/MainView.qml")));
QGraphicsObject *rootObject = d->m_mainView->rootObject();
rootObject->setProperty("width", QVariant(width()));
rootObject->setProperty("candidateHeight", QVariant(height() - d->m_timebar->height() - d->m_overview->height()));
connect(rootObject, SIGNAL(updateCursorPosition()), this, SLOT(updateCursorPosition()));
connect(rootObject, SIGNAL(updateRangeButton()), this, SLOT(updateRangeButton()));
connect(rootObject, SIGNAL(updateLockButton()), this, SLOT(updateLockButton()));
connect(this, SIGNAL(jumpToPrev()), rootObject, SLOT(prevEvent()));
connect(this, SIGNAL(jumpToNext()), rootObject, SLOT(nextEvent()));
connect(rootObject, SIGNAL(selectedEventChanged(int)), this, SIGNAL(selectedEventChanged(int)));
connect(rootObject, SIGNAL(changeToolTip(QString)), this, SLOT(updateToolTip(QString)));
connect(rootObject, SIGNAL(updateVerticalScroll(int)), this, SLOT(updateVerticalScroll(int)));
}
QWidget *QmlProfilerTraceView::createToolbar()
{
Utils::StyledBar *bar = new Utils::StyledBar(this);
bar->setStyleSheet(QLatin1String("background: #9B9B9B"));
bar->setSingleRow(true);
bar->setFixedWidth(150);
bar->setFixedHeight(24);
QHBoxLayout *toolBarLayout = new QHBoxLayout(bar);
toolBarLayout->setMargin(0);
toolBarLayout->setSpacing(0);
QToolButton *buttonPrev= new QToolButton;
buttonPrev->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_prev.png")));
buttonPrev->setToolTip(tr("Jump to previous event"));
connect(buttonPrev, SIGNAL(clicked()), this, SIGNAL(jumpToPrev()));
connect(this, SIGNAL(enableToolbar(bool)), buttonPrev, SLOT(setEnabled(bool)));
QToolButton *buttonNext= new QToolButton;
buttonNext->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_next.png")));
buttonNext->setToolTip(tr("Jump to next event"));
connect(buttonNext, SIGNAL(clicked()), this, SIGNAL(jumpToNext()));
connect(this, SIGNAL(enableToolbar(bool)), buttonNext, SLOT(setEnabled(bool)));
QToolButton *buttonZoomControls = new QToolButton;
buttonZoomControls->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_zoom.png")));
buttonZoomControls->setToolTip(tr("Show zoom slider"));
buttonZoomControls->setCheckable(true);
buttonZoomControls->setChecked(false);
connect(buttonZoomControls, SIGNAL(toggled(bool)), d->m_zoomToolbar, SLOT(setVisible(bool)));
connect(this, SIGNAL(enableToolbar(bool)), buttonZoomControls, SLOT(setEnabled(bool)));
d->m_buttonRange = new QToolButton;
d->m_buttonRange->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_rangeselection.png")));
d->m_buttonRange->setToolTip(tr("Select range"));
d->m_buttonRange->setCheckable(true);
d->m_buttonRange->setChecked(false);
connect(d->m_buttonRange, SIGNAL(clicked(bool)), this, SLOT(toggleRangeMode(bool)));
connect(this, SIGNAL(enableToolbar(bool)), d->m_buttonRange, SLOT(setEnabled(bool)));
connect(this, SIGNAL(rangeModeChanged(bool)), d->m_buttonRange, SLOT(setChecked(bool)));
d->m_buttonLock = new QToolButton;
d->m_buttonLock->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_selectionmode.png")));
d->m_buttonLock->setToolTip(tr("View event information on mouseover"));
d->m_buttonLock->setCheckable(true);
d->m_buttonLock->setChecked(false);
connect(d->m_buttonLock, SIGNAL(clicked(bool)), this, SLOT(toggleLockMode(bool)));
connect(this, SIGNAL(enableToolbar(bool)), d->m_buttonLock, SLOT(setEnabled(bool)));
connect(this, SIGNAL(lockModeChanged(bool)), d->m_buttonLock, SLOT(setChecked(bool)));
toolBarLayout->addWidget(buttonPrev);
toolBarLayout->addWidget(buttonNext);
toolBarLayout->addWidget(new Utils::StyledSeparator());
toolBarLayout->addWidget(buttonZoomControls);
toolBarLayout->addWidget(new Utils::StyledSeparator());
toolBarLayout->addWidget(d->m_buttonRange);
toolBarLayout->addWidget(d->m_buttonLock);
return bar;
}
QWidget *QmlProfilerTraceView::createZoomToolbar()
{
Utils::StyledBar *bar = new Utils::StyledBar(this);
bar->setStyleSheet(QLatin1String("background: #9B9B9B"));
bar->setSingleRow(true);
bar->setFixedWidth(150);
bar->setFixedHeight(24);
QHBoxLayout *toolBarLayout = new QHBoxLayout(bar);
toolBarLayout->setMargin(0);
toolBarLayout->setSpacing(0);
QSlider *zoomSlider = new QSlider(Qt::Horizontal);
zoomSlider->setFocusPolicy(Qt::NoFocus);
zoomSlider->setRange(1, sliderTicks);
zoomSlider->setInvertedAppearance(true);
zoomSlider->setPageStep(sliderTicks/100);
connect(this, SIGNAL(enableToolbar(bool)), zoomSlider, SLOT(setEnabled(bool)));
connect(zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(setZoomLevel(int)));
connect(this, SIGNAL(zoomLevelChanged(int)), zoomSlider, SLOT(setValue(int)));
zoomSlider->setStyleSheet(QLatin1String("\
QSlider:horizontal {\
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #444444, stop: 1 #5a5a5a);\
border: 1px #313131;\
height: 20px;\
margin: 0px 0px 0px 0px;\
}\
QSlider::add-page:horizontal {\
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #5a5a5a, stop: 1 #444444);\
border: 1px #313131;\
}\
QSlider::sub-page:horizontal {\
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #5a5a5a, stop: 1 #444444);\
border: 1px #313131;\
}\
"));
toolBarLayout->addWidget(zoomSlider);
return bar;
}
/////////////////////////////////////////////////////////
bool QmlProfilerTraceView::hasValidSelection() const
{
QGraphicsObject *rootObject = d->m_mainView->rootObject();
if (rootObject)
return rootObject->property("selectionRangeReady").toBool();
return false;
}
qint64 QmlProfilerTraceView::selectionStart() const
{
QGraphicsObject *rootObject = d->m_mainView->rootObject();
if (rootObject)
return rootObject->property("selectionRangeStart").toLongLong();
return 0;
}
qint64 QmlProfilerTraceView::selectionEnd() const
{
QGraphicsObject *rootObject = d->m_mainView->rootObject();
if (rootObject)
return rootObject->property("selectionRangeEnd").toLongLong();
return 0;
}
void QmlProfilerTraceView::clearDisplay()
{
d->m_zoomControl->setRange(0,0);
updateVerticalScroll(0);
d->m_mainView->rootObject()->setProperty("scrollY", QVariant(0));
QMetaObject::invokeMethod(d->m_mainView->rootObject(), "clearAll");
QMetaObject::invokeMethod(d->m_overview->rootObject(), "clearDisplay");
}
void QmlProfilerTraceView::selectNextEventWithId(int eventId)
{
QGraphicsObject *rootObject = d->m_mainView->rootObject();
if (rootObject)
QMetaObject::invokeMethod(rootObject, "selectNextWithId",
Q_ARG(QVariant,QVariant(eventId)));
}
/////////////////////////////////////////////////////////
// Goto source location
void QmlProfilerTraceView::updateCursorPosition()
{
QGraphicsObject *rootObject = d->m_mainView->rootObject();
emit gotoSourceLocation(rootObject->property("fileName").toString(),
rootObject->property("lineNumber").toInt(),
rootObject->property("columnNumber").toInt());
}
/////////////////////////////////////////////////////////
// Toolbar buttons
void QmlProfilerTraceView::toggleRangeMode(bool active)
{
QGraphicsObject *rootObject = d->m_mainView->rootObject();
bool rangeMode = rootObject->property("selectionRangeMode").toBool();
if (active != rangeMode) {
if (active)
d->m_buttonRange->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_rangeselected.png")));
else
d->m_buttonRange->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_rangeselection.png")));
rootObject->setProperty("selectionRangeMode", QVariant(active));
}
}
void QmlProfilerTraceView::updateRangeButton()
{
bool rangeMode = d->m_mainView->rootObject()->property("selectionRangeMode").toBool();
if (rangeMode)
d->m_buttonRange->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_rangeselected.png")));
else
d->m_buttonRange->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_rangeselection.png")));
emit rangeModeChanged(rangeMode);
}
void QmlProfilerTraceView::toggleLockMode(bool active)
{
QGraphicsObject *rootObject = d->m_mainView->rootObject();
bool lockMode = !rootObject->property("selectionLocked").toBool();
if (active != lockMode) {
rootObject->setProperty("selectionLocked", QVariant(!active));
rootObject->setProperty("selectedItem", QVariant(-1));
}
}
void QmlProfilerTraceView::updateLockButton()
{
bool lockMode = !d->m_mainView->rootObject()->property("selectionLocked").toBool();
emit lockModeChanged(lockMode);
}
////////////////////////////////////////////////////////
// Zoom control
void QmlProfilerTraceView::setZoomLevel(int zoomLevel)
{
if (d->m_currentZoomLevel != zoomLevel && d->m_mainView->rootObject()) {
QVariant newFactor = pow(qreal(zoomLevel) / qreal(sliderTicks), sliderExp);
d->m_currentZoomLevel = zoomLevel;
QMetaObject::invokeMethod(d->m_mainView->rootObject(), "updateWindowLength", Q_ARG(QVariant, newFactor));
}
}
void QmlProfilerTraceView::updateRange()
{
if (!d->m_profilerDataModel)
return;
qreal duration = d->m_zoomControl->endTime() - d->m_zoomControl->startTime();
if (duration <= 0)
return;
if (d->m_profilerDataModel->traceDuration() <= 0)
return;
int newLevel = pow(duration / d->m_profilerDataModel->traceDuration(), 1/sliderExp) * sliderTicks;
if (d->m_currentZoomLevel != newLevel) {
d->m_currentZoomLevel = newLevel;
emit zoomLevelChanged(newLevel);
}
}
void QmlProfilerTraceView::mouseWheelMoved(int mouseX, int mouseY, int wheelDelta)
{
Q_UNUSED(mouseY);
QGraphicsObject *rootObject = d->m_mainView->rootObject();
if (rootObject) {
QMetaObject::invokeMethod(rootObject, "wheelZoom",
Q_ARG(QVariant, QVariant(mouseX)),
Q_ARG(QVariant, QVariant(wheelDelta)));
}
}
////////////////////////////////////////////////////////
void QmlProfilerTraceView::updateToolTip(const QString &text)
{
setToolTip(text);
}
void QmlProfilerTraceView::updateVerticalScroll(int newPosition)
{
d->m_mainView->verticalScrollBar()->setValue(newPosition);
}
void QmlProfilerTraceView::resizeEvent(QResizeEvent *event)
{
QWidget::resizeEvent(event);
QGraphicsObject *rootObject = d->m_mainView->rootObject();
if (rootObject) {
rootObject->setProperty("width", QVariant(event->size().width()));
int newHeight = event->size().height() - d->m_timebar->height() - d->m_overview->height();
rootObject->setProperty("candidateHeight", QVariant(newHeight));
}
emit resized();
}
////////////////////////////////////////////////////////////////
// Context menu
void QmlProfilerTraceView::contextMenuEvent(QContextMenuEvent *ev)
{
QMenu menu;
QAction *viewAllAction = 0;
QmlProfilerTool *profilerTool = qobject_cast<QmlProfilerTool *>(d->m_profilerTool);
if (profilerTool)
menu.addActions(profilerTool->profilerContextMenuActions());
menu.addSeparator();
QAction *getLocalStatsAction = menu.addAction(tr("Limit Events Pane to Current Range"));
if (!d->m_viewContainer->hasValidSelection())
getLocalStatsAction->setEnabled(false);
QAction *getGlobalStatsAction = menu.addAction(tr("Reset Events Pane"));
if (d->m_viewContainer->hasGlobalStats())
getGlobalStatsAction->setEnabled(false);
if (d->m_profilerDataModel->count() > 0) {
menu.addSeparator();
viewAllAction = menu.addAction(tr("Reset Zoom"));
}
QAction *selectedAction = menu.exec(ev->globalPos());
if (selectedAction) {
if (selectedAction == viewAllAction) {
d->m_zoomControl->setRange(
d->m_profilerDataModel->traceStartTime(),
d->m_profilerDataModel->traceEndTime());
}
if (selectedAction == getLocalStatsAction) {
d->m_viewContainer->getStatisticsInRange(
d->m_viewContainer->selectionStart(),
d->m_viewContainer->selectionEnd());
}
if (selectedAction == getGlobalStatsAction) {
d->m_viewContainer->getStatisticsInRange(
d->m_profilerDataModel->traceStartTime(),
d->m_profilerDataModel->traceEndTime());
}
}
}
/////////////////////////////////////////////////
// Tell QML the state of the profiler
void QmlProfilerTraceView::setRecording(bool recording)
{
QGraphicsObject *rootObject = d->m_mainView->rootObject();
if (rootObject)
rootObject->setProperty("recordingEnabled", QVariant(recording));
}
void QmlProfilerTraceView::setAppKilled()
{
QGraphicsObject *rootObject = d->m_mainView->rootObject();
if (rootObject)
rootObject->setProperty("appKilled",QVariant(true));
}
////////////////////////////////////////////////////////////////
// Profiler State
void QmlProfilerTraceView::profilerDataModelStateChanged()
{
switch (d->m_profilerDataModel->currentState()) {
case QmlProfilerDataModel::Empty :
emit enableToolbar(false);
break;
case QmlProfilerDataModel::AcquiringData :
// nothing to be done
break;
case QmlProfilerDataModel::ProcessingData :
// nothing to be done
break;
case QmlProfilerDataModel::Done :
emit enableToolbar(true);
break;
default:
break;
}
}
void QmlProfilerTraceView::profilerStateChanged()
{
switch (d->m_profilerState->currentState()) {
case QmlProfilerStateManager::AppKilled : {
if (d->m_profilerDataModel->currentState() == QmlProfilerDataModel::AcquiringData)
setAppKilled();
break;
}
default:
// no special action needed for other states
break;
}
}
void QmlProfilerTraceView::clientRecordingChanged()
{
// nothing yet
}
void QmlProfilerTraceView::serverRecordingChanged()
{
setRecording(d->m_profilerState->serverRecording());
}
} // namespace Internal
} // namespace QmlProfiler
| Java |
// @(#)root/tmva $Id$
// Author: Peter Speckmayer
/**********************************************************************************
* Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
* Package: TMVA *
* Class : MethodDNN *
* Web : http://tmva.sourceforge.net *
* *
* Description: *
* NeuralNetwork *
* *
* Authors (alphabetical): *
* Peter Speckmayer <[email protected]> - CERN, Switzerland *
* Simon Pfreundschuh <[email protected]> - CERN, Switzerland *
* *
* Copyright (c) 2005-2015: *
* CERN, Switzerland *
* U. of Victoria, Canada *
* MPI-K Heidelberg, Germany *
* U. of Bonn, Germany *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted according to the terms listed in LICENSE *
* (http://tmva.sourceforge.net/LICENSE) *
**********************************************************************************/
//#pragma once
#ifndef ROOT_TMVA_MethodDNN
#define ROOT_TMVA_MethodDNN
//////////////////////////////////////////////////////////////////////////
// //
// MethodDNN //
// //
// Neural Network implementation //
// //
//////////////////////////////////////////////////////////////////////////
#include <vector>
#include <map>
#include <string>
#include <sstream>
#include "TString.h"
#include "TTree.h"
#include "TRandom3.h"
#include "TH1F.h"
#include "TMVA/MethodBase.h"
#include "TMVA/NeuralNet.h"
#include "TMVA/Tools.h"
#include "TMVA/DNN/Net.h"
#include "TMVA/DNN/Minimizers.h"
#include "TMVA/DNN/Architectures/Reference.h"
#ifdef R__HAS_TMVACPU
#define DNNCPU
#endif
#ifdef R__HAS_TMVAGPU
#define DNNCUDA
#endif
#ifdef DNNCPU
#include "TMVA/DNN/Architectures/Cpu.h"
#endif
#ifdef DNNCUDA
#include "TMVA/DNN/Architectures/Cuda.h"
#endif
namespace TMVA {
class MethodDNN : public MethodBase
{
friend struct TestMethodDNNValidationSize;
using Architecture_t = DNN::TReference<Float_t>;
using Net_t = DNN::TNet<Architecture_t>;
using Matrix_t = typename Architecture_t::Matrix_t;
using Scalar_t = typename Architecture_t::Scalar_t;
private:
using LayoutVector_t = std::vector<std::pair<int, DNN::EActivationFunction>>;
using KeyValueVector_t = std::vector<std::map<TString, TString>>;
struct TTrainingSettings
{
size_t batchSize;
size_t testInterval;
size_t convergenceSteps;
DNN::ERegularization regularization;
Double_t learningRate;
Double_t momentum;
Double_t weightDecay;
std::vector<Double_t> dropoutProbabilities;
bool multithreading;
};
// the option handling methods
void DeclareOptions();
void ProcessOptions();
UInt_t GetNumValidationSamples();
// general helper functions
void Init();
Net_t fNet;
DNN::EInitialization fWeightInitialization;
DNN::EOutputFunction fOutputFunction;
TString fLayoutString;
TString fErrorStrategy;
TString fTrainingStrategyString;
TString fWeightInitializationString;
TString fArchitectureString;
TString fValidationSize;
LayoutVector_t fLayout;
std::vector<TTrainingSettings> fTrainingSettings;
bool fResume;
KeyValueVector_t fSettings;
ClassDef(MethodDNN,0); // neural network
static inline void WriteMatrixXML(void *parent, const char *name,
const TMatrixT<Double_t> &X);
static inline void ReadMatrixXML(void *xml, const char *name,
TMatrixT<Double_t> &X);
protected:
void MakeClassSpecific( std::ostream&, const TString& ) const;
void GetHelpMessage() const;
public:
// Standard Constructors
MethodDNN(const TString& jobName,
const TString& methodTitle,
DataSetInfo& theData,
const TString& theOption);
MethodDNN(DataSetInfo& theData,
const TString& theWeightFile);
virtual ~MethodDNN();
virtual Bool_t HasAnalysisType(Types::EAnalysisType type,
UInt_t numberClasses,
UInt_t numberTargets );
LayoutVector_t ParseLayoutString(TString layerSpec);
KeyValueVector_t ParseKeyValueString(TString parseString,
TString blockDelim,
TString tokenDelim);
void Train();
void TrainGpu();
void TrainCpu();
virtual Double_t GetMvaValue( Double_t* err=0, Double_t* errUpper=0 );
virtual const std::vector<Float_t>& GetRegressionValues();
virtual const std::vector<Float_t>& GetMulticlassValues();
using MethodBase::ReadWeightsFromStream;
// write weights to stream
void AddWeightsXMLTo ( void* parent ) const;
// read weights from stream
void ReadWeightsFromStream( std::istream & i );
void ReadWeightsFromXML ( void* wghtnode );
// ranking of input variables
const Ranking* CreateRanking();
};
inline void MethodDNN::WriteMatrixXML(void *parent,
const char *name,
const TMatrixT<Double_t> &X)
{
std::stringstream matrixStringStream("");
matrixStringStream.precision( 16 );
for (size_t i = 0; i < (size_t) X.GetNrows(); i++)
{
for (size_t j = 0; j < (size_t) X.GetNcols(); j++)
{
matrixStringStream << std::scientific << X(i,j) << " ";
}
}
std::string s = matrixStringStream.str();
void* matxml = gTools().xmlengine().NewChild(parent, 0, name);
gTools().xmlengine().NewAttr(matxml, 0, "rows",
gTools().StringFromInt((int)X.GetNrows()));
gTools().xmlengine().NewAttr(matxml, 0, "cols",
gTools().StringFromInt((int)X.GetNcols()));
gTools().xmlengine().AddRawLine (matxml, s.c_str());
}
inline void MethodDNN::ReadMatrixXML(void *xml,
const char *name,
TMatrixT<Double_t> &X)
{
void *matrixXML = gTools().GetChild(xml, name);
size_t rows, cols;
gTools().ReadAttr(matrixXML, "rows", rows);
gTools().ReadAttr(matrixXML, "cols", cols);
const char * matrixString = gTools().xmlengine().GetNodeContent(matrixXML);
std::stringstream matrixStringStream(matrixString);
for (size_t i = 0; i < rows; i++)
{
for (size_t j = 0; j < cols; j++)
{
matrixStringStream >> X(i,j);
}
}
}
} // namespace TMVA
#endif
| Java |
/* GIO - GLib Input, Output and Streaming Library
*
* Copyright (C) 2006-2007 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Alexander Larsson <[email protected]>
*/
#include "config.h"
#include "gappinfo.h"
#include "glibintl.h"
#include <gioerror.h>
#include <gfile.h>
/**
* SECTION:gappinfo
* @short_description: Application information and launch contexts
* @include: gio/gio.h
*
* #GAppInfo and #GAppLaunchContext are used for describing and launching
* applications installed on the system.
*
* As of GLib 2.20, URIs will always be converted to POSIX paths
* (using g_file_get_path()) when using g_app_info_launch() even if
* the application requested an URI and not a POSIX path. For example
* for an desktop-file based application with Exec key <literal>totem
* %U</literal> and a single URI,
* <literal>sftp://foo/file.avi</literal>, then
* <literal>/home/user/.gvfs/sftp on foo/file.avi</literal> will be
* passed. This will only work if a set of suitable GIO extensions
* (such as gvfs 2.26 compiled with FUSE support), is available and
* operational; if this is not the case, the URI will be passed
* unmodified to the application. Some URIs, such as
* <literal>mailto:</literal>, of course cannot be mapped to a POSIX
* path (in gvfs there's no FUSE mount for it); such URIs will be
* passed unmodified to the application.
*
* Specifically for gvfs 2.26 and later, the POSIX URI will be mapped
* back to the GIO URI in the #GFile constructors (since gvfs
* implements the #GVfs extension point). As such, if the application
* needs to examine the URI, it needs to use g_file_get_uri() or
* similar on #GFile. In other words, an application cannot assume
* that the URI passed to e.g. g_file_new_for_commandline_arg() is
* equal to the result of g_file_get_uri(). The following snippet
* illustrates this:
*
* <programlisting>
* GFile *f;
* char *uri;
*
* file = g_file_new_for_commandline_arg (uri_from_commandline);
*
* uri = g_file_get_uri (file);
* strcmp (uri, uri_from_commandline) == 0; // FALSE
* g_free (uri);
*
* if (g_file_has_uri_scheme (file, "cdda"))
* {
* // do something special with uri
* }
* g_object_unref (file);
* </programlisting>
*
* This code will work when both <literal>cdda://sr0/Track
* 1.wav</literal> and <literal>/home/user/.gvfs/cdda on sr0/Track
* 1.wav</literal> is passed to the application. It should be noted
* that it's generally not safe for applications to rely on the format
* of a particular URIs. Different launcher applications (e.g. file
* managers) may have different ideas of what a given URI means.
*
**/
typedef GAppInfoIface GAppInfoInterface;
G_DEFINE_INTERFACE (GAppInfo, g_app_info, G_TYPE_OBJECT)
static void
g_app_info_default_init (GAppInfoInterface *iface)
{
}
/**
* g_app_info_dup:
* @appinfo: a #GAppInfo.
*
* Creates a duplicate of a #GAppInfo.
*
* Returns: (transfer full): a duplicate of @appinfo.
**/
GAppInfo *
g_app_info_dup (GAppInfo *appinfo)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), NULL);
iface = G_APP_INFO_GET_IFACE (appinfo);
return (* iface->dup) (appinfo);
}
/**
* g_app_info_equal:
* @appinfo1: the first #GAppInfo.
* @appinfo2: the second #GAppInfo.
*
* Checks if two #GAppInfo<!-- -->s are equal.
*
* Returns: %TRUE if @appinfo1 is equal to @appinfo2. %FALSE otherwise.
**/
gboolean
g_app_info_equal (GAppInfo *appinfo1,
GAppInfo *appinfo2)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo1), FALSE);
g_return_val_if_fail (G_IS_APP_INFO (appinfo2), FALSE);
if (G_TYPE_FROM_INSTANCE (appinfo1) != G_TYPE_FROM_INSTANCE (appinfo2))
return FALSE;
iface = G_APP_INFO_GET_IFACE (appinfo1);
return (* iface->equal) (appinfo1, appinfo2);
}
/**
* g_app_info_get_id:
* @appinfo: a #GAppInfo.
*
* Gets the ID of an application. An id is a string that
* identifies the application. The exact format of the id is
* platform dependent. For instance, on Unix this is the
* desktop file id from the xdg menu specification.
*
* Note that the returned ID may be %NULL, depending on how
* the @appinfo has been constructed.
*
* Returns: a string containing the application's ID.
**/
const char *
g_app_info_get_id (GAppInfo *appinfo)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), NULL);
iface = G_APP_INFO_GET_IFACE (appinfo);
return (* iface->get_id) (appinfo);
}
/**
* g_app_info_get_name:
* @appinfo: a #GAppInfo.
*
* Gets the installed name of the application.
*
* Returns: the name of the application for @appinfo.
**/
const char *
g_app_info_get_name (GAppInfo *appinfo)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), NULL);
iface = G_APP_INFO_GET_IFACE (appinfo);
return (* iface->get_name) (appinfo);
}
/**
* g_app_info_get_display_name:
* @appinfo: a #GAppInfo.
*
* Gets the display name of the application. The display name is often more
* descriptive to the user than the name itself.
*
* Returns: the display name of the application for @appinfo, or the name if
* no display name is available.
*
* Since: 2.24
**/
const char *
g_app_info_get_display_name (GAppInfo *appinfo)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), NULL);
iface = G_APP_INFO_GET_IFACE (appinfo);
if (iface->get_display_name == NULL)
return (* iface->get_name) (appinfo);
return (* iface->get_display_name) (appinfo);
}
/**
* g_app_info_get_description:
* @appinfo: a #GAppInfo.
*
* Gets a human-readable description of an installed application.
*
* Returns: a string containing a description of the
* application @appinfo, or %NULL if none.
**/
const char *
g_app_info_get_description (GAppInfo *appinfo)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), NULL);
iface = G_APP_INFO_GET_IFACE (appinfo);
return (* iface->get_description) (appinfo);
}
/**
* g_app_info_get_executable:
* @appinfo: a #GAppInfo
*
* Gets the executable's name for the installed application.
*
* Returns: a string containing the @appinfo's application
* binaries name
**/
const char *
g_app_info_get_executable (GAppInfo *appinfo)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), NULL);
iface = G_APP_INFO_GET_IFACE (appinfo);
return (* iface->get_executable) (appinfo);
}
/**
* g_app_info_get_commandline:
* @appinfo: a #GAppInfo
*
* Gets the commandline with which the application will be
* started.
*
* Returns: a string containing the @appinfo's commandline,
* or %NULL if this information is not available
*
* Since: 2.20
**/
const char *
g_app_info_get_commandline (GAppInfo *appinfo)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), NULL);
iface = G_APP_INFO_GET_IFACE (appinfo);
if (iface->get_commandline)
return (* iface->get_commandline) (appinfo);
return NULL;
}
/**
* g_app_info_set_as_default_for_type:
* @appinfo: a #GAppInfo.
* @content_type: the content type.
* @error: a #GError.
*
* Sets the application as the default handler for a given type.
*
* Returns: %TRUE on success, %FALSE on error.
**/
gboolean
g_app_info_set_as_default_for_type (GAppInfo *appinfo,
const char *content_type,
GError **error)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE);
g_return_val_if_fail (content_type != NULL, FALSE);
iface = G_APP_INFO_GET_IFACE (appinfo);
return (* iface->set_as_default_for_type) (appinfo, content_type, error);
}
/**
* g_app_info_set_as_last_used_for_type:
* @appinfo: a #GAppInfo.
* @content_type: the content type.
* @error: a #GError.
*
* Sets the application as the last used application for a given type.
* This will make the application appear as first in the list returned
* by g_app_info_get_recommended_for_type(), regardless of the default
* application for that content type.
*
* Returns: %TRUE on success, %FALSE on error.
**/
gboolean
g_app_info_set_as_last_used_for_type (GAppInfo *appinfo,
const char *content_type,
GError **error)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE);
g_return_val_if_fail (content_type != NULL, FALSE);
iface = G_APP_INFO_GET_IFACE (appinfo);
return (* iface->set_as_last_used_for_type) (appinfo, content_type, error);
}
/**
* g_app_info_set_as_default_for_extension:
* @appinfo: a #GAppInfo.
* @extension: a string containing the file extension (without the dot).
* @error: a #GError.
*
* Sets the application as the default handler for the given file extension.
*
* Returns: %TRUE on success, %FALSE on error.
**/
gboolean
g_app_info_set_as_default_for_extension (GAppInfo *appinfo,
const char *extension,
GError **error)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE);
g_return_val_if_fail (extension != NULL, FALSE);
iface = G_APP_INFO_GET_IFACE (appinfo);
if (iface->set_as_default_for_extension)
return (* iface->set_as_default_for_extension) (appinfo, extension, error);
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
"g_app_info_set_as_default_for_extension not supported yet");
return FALSE;
}
/**
* g_app_info_add_supports_type:
* @appinfo: a #GAppInfo.
* @content_type: a string.
* @error: a #GError.
*
* Adds a content type to the application information to indicate the
* application is capable of opening files with the given content type.
*
* Returns: %TRUE on success, %FALSE on error.
**/
gboolean
g_app_info_add_supports_type (GAppInfo *appinfo,
const char *content_type,
GError **error)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE);
g_return_val_if_fail (content_type != NULL, FALSE);
iface = G_APP_INFO_GET_IFACE (appinfo);
if (iface->add_supports_type)
return (* iface->add_supports_type) (appinfo, content_type, error);
g_set_error_literal (error, G_IO_ERROR,
G_IO_ERROR_NOT_SUPPORTED,
"g_app_info_add_supports_type not supported yet");
return FALSE;
}
/**
* g_app_info_can_remove_supports_type:
* @appinfo: a #GAppInfo.
*
* Checks if a supported content type can be removed from an application.
*
* Returns: %TRUE if it is possible to remove supported
* content types from a given @appinfo, %FALSE if not.
**/
gboolean
g_app_info_can_remove_supports_type (GAppInfo *appinfo)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE);
iface = G_APP_INFO_GET_IFACE (appinfo);
if (iface->can_remove_supports_type)
return (* iface->can_remove_supports_type) (appinfo);
return FALSE;
}
/**
* g_app_info_remove_supports_type:
* @appinfo: a #GAppInfo.
* @content_type: a string.
* @error: a #GError.
*
* Removes a supported type from an application, if possible.
*
* Returns: %TRUE on success, %FALSE on error.
**/
gboolean
g_app_info_remove_supports_type (GAppInfo *appinfo,
const char *content_type,
GError **error)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE);
g_return_val_if_fail (content_type != NULL, FALSE);
iface = G_APP_INFO_GET_IFACE (appinfo);
if (iface->remove_supports_type)
return (* iface->remove_supports_type) (appinfo, content_type, error);
g_set_error_literal (error, G_IO_ERROR,
G_IO_ERROR_NOT_SUPPORTED,
"g_app_info_remove_supports_type not supported yet");
return FALSE;
}
/**
* g_app_info_get_supported_types:
* @appinfo: a #GAppInfo that can handle files
*
* Retrieves the list of content types that @app_info claims to support.
* If this information is not provided by the environment, this function
* will return %NULL.
* This function does not take in consideration associations added with
* g_app_info_add_supports_type(), but only those exported directly by
* the application.
*
* Returns: (transfer none) (array zero-terminated=1) (element-type utf8):
* a list of content types.
*
* Since: 2.34
*/
const char **
g_app_info_get_supported_types (GAppInfo *appinfo)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), NULL);
iface = G_APP_INFO_GET_IFACE (appinfo);
if (iface->get_supported_types)
return iface->get_supported_types (appinfo);
else
return NULL;
}
/**
* g_app_info_get_icon:
* @appinfo: a #GAppInfo.
*
* Gets the icon for the application.
*
* Returns: (transfer none): the default #GIcon for @appinfo or %NULL
* if there is no default icon.
**/
GIcon *
g_app_info_get_icon (GAppInfo *appinfo)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), NULL);
iface = G_APP_INFO_GET_IFACE (appinfo);
return (* iface->get_icon) (appinfo);
}
/**
* g_app_info_launch:
* @appinfo: a #GAppInfo
* @files: (allow-none) (element-type GFile): a #GList of #GFile objects
* @launch_context: (allow-none): a #GAppLaunchContext or %NULL
* @error: a #GError
*
* Launches the application. Passes @files to the launched application
* as arguments, using the optional @launch_context to get information
* about the details of the launcher (like what screen it is on).
* On error, @error will be set accordingly.
*
* To launch the application without arguments pass a %NULL @files list.
*
* Note that even if the launch is successful the application launched
* can fail to start if it runs into problems during startup. There is
* no way to detect this.
*
* Some URIs can be changed when passed through a GFile (for instance
* unsupported URIs with strange formats like mailto:), so if you have
* a textual URI you want to pass in as argument, consider using
* g_app_info_launch_uris() instead.
*
* The launched application inherits the environment of the launching
* process, but it can be modified with g_app_launch_context_setenv() and
* g_app_launch_context_unsetenv().
*
* On UNIX, this function sets the <envar>GIO_LAUNCHED_DESKTOP_FILE</envar>
* environment variable with the path of the launched desktop file and
* <envar>GIO_LAUNCHED_DESKTOP_FILE_PID</envar> to the process
* id of the launched process. This can be used to ignore
* <envar>GIO_LAUNCHED_DESKTOP_FILE</envar>, should it be inherited
* by further processes. The <envar>DISPLAY</envar> and
* <envar>DESKTOP_STARTUP_ID</envar> environment variables are also
* set, based on information provided in @launch_context.
*
* Returns: %TRUE on successful launch, %FALSE otherwise.
**/
gboolean
g_app_info_launch (GAppInfo *appinfo,
GList *files,
GAppLaunchContext *launch_context,
GError **error)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE);
iface = G_APP_INFO_GET_IFACE (appinfo);
return (* iface->launch) (appinfo, files, launch_context, error);
}
/**
* g_app_info_supports_uris:
* @appinfo: a #GAppInfo.
*
* Checks if the application supports reading files and directories from URIs.
*
* Returns: %TRUE if the @appinfo supports URIs.
**/
gboolean
g_app_info_supports_uris (GAppInfo *appinfo)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE);
iface = G_APP_INFO_GET_IFACE (appinfo);
return (* iface->supports_uris) (appinfo);
}
/**
* g_app_info_supports_files:
* @appinfo: a #GAppInfo.
*
* Checks if the application accepts files as arguments.
*
* Returns: %TRUE if the @appinfo supports files.
**/
gboolean
g_app_info_supports_files (GAppInfo *appinfo)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE);
iface = G_APP_INFO_GET_IFACE (appinfo);
return (* iface->supports_files) (appinfo);
}
/**
* g_app_info_launch_uris:
* @appinfo: a #GAppInfo
* @uris: (allow-none) (element-type utf8): a #GList containing URIs to launch.
* @launch_context: (allow-none): a #GAppLaunchContext or %NULL
* @error: a #GError
*
* Launches the application. This passes the @uris to the launched application
* as arguments, using the optional @launch_context to get information
* about the details of the launcher (like what screen it is on).
* On error, @error will be set accordingly.
*
* To launch the application without arguments pass a %NULL @uris list.
*
* Note that even if the launch is successful the application launched
* can fail to start if it runs into problems during startup. There is
* no way to detect this.
*
* Returns: %TRUE on successful launch, %FALSE otherwise.
**/
gboolean
g_app_info_launch_uris (GAppInfo *appinfo,
GList *uris,
GAppLaunchContext *launch_context,
GError **error)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE);
iface = G_APP_INFO_GET_IFACE (appinfo);
return (* iface->launch_uris) (appinfo, uris, launch_context, error);
}
/**
* g_app_info_should_show:
* @appinfo: a #GAppInfo.
*
* Checks if the application info should be shown in menus that
* list available applications.
*
* Returns: %TRUE if the @appinfo should be shown, %FALSE otherwise.
**/
gboolean
g_app_info_should_show (GAppInfo *appinfo)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE);
iface = G_APP_INFO_GET_IFACE (appinfo);
return (* iface->should_show) (appinfo);
}
/**
* g_app_info_launch_default_for_uri:
* @uri: the uri to show
* @launch_context: (allow-none): an optional #GAppLaunchContext.
* @error: a #GError.
*
* Utility function that launches the default application
* registered to handle the specified uri. Synchronous I/O
* is done on the uri to detect the type of the file if
* required.
*
* Returns: %TRUE on success, %FALSE on error.
**/
gboolean
g_app_info_launch_default_for_uri (const char *uri,
GAppLaunchContext *launch_context,
GError **error)
{
char *uri_scheme;
GAppInfo *app_info = NULL;
GList l;
gboolean res;
/* g_file_query_default_handler() calls
* g_app_info_get_default_for_uri_scheme() too, but we have to do it
* here anyway in case GFile can't parse @uri correctly.
*/
uri_scheme = g_uri_parse_scheme (uri);
if (uri_scheme && uri_scheme[0] != '\0')
app_info = g_app_info_get_default_for_uri_scheme (uri_scheme);
g_free (uri_scheme);
if (!app_info)
{
GFile *file;
file = g_file_new_for_uri (uri);
app_info = g_file_query_default_handler (file, NULL, error);
g_object_unref (file);
if (app_info == NULL)
return FALSE;
/* We still use the original @uri rather than calling
* g_file_get_uri(), because GFile might have modified the URI
* in ways we don't want (eg, removing the fragment identifier
* from a file: URI).
*/
}
l.data = (char *)uri;
l.next = l.prev = NULL;
res = g_app_info_launch_uris (app_info, &l,
launch_context, error);
g_object_unref (app_info);
return res;
}
/**
* g_app_info_can_delete:
* @appinfo: a #GAppInfo
*
* Obtains the information whether the #GAppInfo can be deleted.
* See g_app_info_delete().
*
* Returns: %TRUE if @appinfo can be deleted
*
* Since: 2.20
*/
gboolean
g_app_info_can_delete (GAppInfo *appinfo)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE);
iface = G_APP_INFO_GET_IFACE (appinfo);
if (iface->can_delete)
return (* iface->can_delete) (appinfo);
return FALSE;
}
/**
* g_app_info_delete:
* @appinfo: a #GAppInfo
*
* Tries to delete a #GAppInfo.
*
* On some platforms, there may be a difference between user-defined
* #GAppInfo<!-- -->s which can be deleted, and system-wide ones which
* cannot. See g_app_info_can_delete().
*
* Virtual: do_delete
* Returns: %TRUE if @appinfo has been deleted
*
* Since: 2.20
*/
gboolean
g_app_info_delete (GAppInfo *appinfo)
{
GAppInfoIface *iface;
g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE);
iface = G_APP_INFO_GET_IFACE (appinfo);
if (iface->do_delete)
return (* iface->do_delete) (appinfo);
return FALSE;
}
enum {
LAUNCH_FAILED,
LAUNCHED,
LAST_SIGNAL
};
guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (GAppLaunchContext, g_app_launch_context, G_TYPE_OBJECT);
struct _GAppLaunchContextPrivate {
char **envp;
};
/**
* g_app_launch_context_new:
*
* Creates a new application launch context. This is not normally used,
* instead you instantiate a subclass of this, such as #GdkAppLaunchContext.
*
* Returns: a #GAppLaunchContext.
**/
GAppLaunchContext *
g_app_launch_context_new (void)
{
return g_object_new (G_TYPE_APP_LAUNCH_CONTEXT, NULL);
}
static void
g_app_launch_context_finalize (GObject *object)
{
GAppLaunchContext *context = G_APP_LAUNCH_CONTEXT (object);
g_strfreev (context->priv->envp);
G_OBJECT_CLASS (g_app_launch_context_parent_class)->finalize (object);
}
static void
g_app_launch_context_class_init (GAppLaunchContextClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (GAppLaunchContextPrivate));
object_class->finalize = g_app_launch_context_finalize;
/*
* GAppLaunchContext::launch-failed:
* @context: the object emitting the signal
* @startup_notify_id: the startup notification id for the failed launch
*
* The ::launch-failed signal is emitted when a #GAppInfo launch
* fails. The startup notification id is provided, so that the launcher
* can cancel the startup notification.
*
* Since: 2.36
*/
signals[LAUNCH_FAILED] = g_signal_new ("launch-failed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GAppLaunchContextClass, launch_failed),
NULL, NULL, NULL,
G_TYPE_NONE, 1, G_TYPE_STRING);
/*
* GAppLaunchContext::launched:
* @context: the object emitting the signal
* @info: the #GAppInfo that was just launched
* @platform_data: additional platform-specific data for this launch
*
* The ::launched signal is emitted when a #GAppInfo is successfully
* launched. The @platform_data is an GVariant dictionary mapping
* strings to variants (ie a{sv}), which contains additional,
* platform-specific data about this launch. On UNIX, at least the
* "pid" and "startup-notification-id" keys will be present.
*
* Since: 2.36
*/
signals[LAUNCHED] = g_signal_new ("launched",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GAppLaunchContextClass, launched),
NULL, NULL, NULL,
G_TYPE_NONE, 2,
G_TYPE_APP_INFO, G_TYPE_VARIANT);
}
static void
g_app_launch_context_init (GAppLaunchContext *context)
{
context->priv = G_TYPE_INSTANCE_GET_PRIVATE (context, G_TYPE_APP_LAUNCH_CONTEXT, GAppLaunchContextPrivate);
}
/**
* g_app_launch_context_setenv:
* @context: a #GAppLaunchContext
* @variable: the environment variable to set
* @value: the value for to set the variable to.
*
* Arranges for @variable to be set to @value in the child's
* environment when @context is used to launch an application.
*
* Since: 2.32
*/
void
g_app_launch_context_setenv (GAppLaunchContext *context,
const char *variable,
const char *value)
{
if (!context->priv->envp)
context->priv->envp = g_get_environ ();
context->priv->envp =
g_environ_setenv (context->priv->envp, variable, value, TRUE);
}
/**
* g_app_launch_context_unsetenv:
* @context: a #GAppLaunchContext
* @variable: the environment variable to remove
*
* Arranges for @variable to be unset in the child's environment
* when @context is used to launch an application.
*
* Since: 2.32
*/
void
g_app_launch_context_unsetenv (GAppLaunchContext *context,
const char *variable)
{
if (!context->priv->envp)
context->priv->envp = g_get_environ ();
context->priv->envp =
g_environ_unsetenv (context->priv->envp, variable);
}
/**
* g_app_launch_context_get_environment:
* @context: a #GAppLaunchContext
*
* Gets the complete environment variable list to be passed to
* the child process when @context is used to launch an application.
* This is a %NULL-terminated array of strings, where each string has
* the form <literal>KEY=VALUE</literal>.
*
* Return value: (array zero-terminated=1) (transfer full): the
* child's environment
*
* Since: 2.32
*/
char **
g_app_launch_context_get_environment (GAppLaunchContext *context)
{
if (!context->priv->envp)
context->priv->envp = g_get_environ ();
return g_strdupv (context->priv->envp);
}
/**
* g_app_launch_context_get_display:
* @context: a #GAppLaunchContext
* @info: a #GAppInfo
* @files: (element-type GFile): a #GList of #GFile objects
*
* Gets the display string for the @context. This is used to ensure new
* applications are started on the same display as the launching
* application, by setting the <envar>DISPLAY</envar> environment variable.
*
* Returns: a display string for the display.
*/
char *
g_app_launch_context_get_display (GAppLaunchContext *context,
GAppInfo *info,
GList *files)
{
GAppLaunchContextClass *class;
g_return_val_if_fail (G_IS_APP_LAUNCH_CONTEXT (context), NULL);
g_return_val_if_fail (G_IS_APP_INFO (info), NULL);
class = G_APP_LAUNCH_CONTEXT_GET_CLASS (context);
if (class->get_display == NULL)
return NULL;
return class->get_display (context, info, files);
}
/**
* g_app_launch_context_get_startup_notify_id:
* @context: a #GAppLaunchContext
* @info: a #GAppInfo
* @files: (element-type GFile): a #GList of of #GFile objects
*
* Initiates startup notification for the application and returns the
* <envar>DESKTOP_STARTUP_ID</envar> for the launched operation,
* if supported.
*
* Startup notification IDs are defined in the <ulink
* url="http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt">
* FreeDesktop.Org Startup Notifications standard</ulink>.
*
* Returns: a startup notification ID for the application, or %NULL if
* not supported.
**/
char *
g_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
GAppInfo *info,
GList *files)
{
GAppLaunchContextClass *class;
g_return_val_if_fail (G_IS_APP_LAUNCH_CONTEXT (context), NULL);
g_return_val_if_fail (G_IS_APP_INFO (info), NULL);
class = G_APP_LAUNCH_CONTEXT_GET_CLASS (context);
if (class->get_startup_notify_id == NULL)
return NULL;
return class->get_startup_notify_id (context, info, files);
}
/**
* g_app_launch_context_launch_failed:
* @context: a #GAppLaunchContext.
* @startup_notify_id: the startup notification id that was returned by g_app_launch_context_get_startup_notify_id().
*
* Called when an application has failed to launch, so that it can cancel
* the application startup notification started in g_app_launch_context_get_startup_notify_id().
*
**/
void
g_app_launch_context_launch_failed (GAppLaunchContext *context,
const char *startup_notify_id)
{
g_return_if_fail (G_IS_APP_LAUNCH_CONTEXT (context));
g_return_if_fail (startup_notify_id != NULL);
g_signal_emit (context, signals[LAUNCH_FAILED], 0, startup_notify_id);
}
| Java |
/* -*- mode: C++; c-file-style: "gnu" -*-
This file is part of KMail, the KDE mail client.
Copyright (c) 2009 Martin Koller <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef MESSAGEVIEWERT_ATTACHMENTDIALOG_H
#define MESSAGEVIEWERT_ATTACHMENTDIALOG_H
#include <QObject>
class KDialog;
/** A class which handles the dialog used to present the user a choice what to do
with an attachment.
*/
class AttachmentDialog : public QObject
{
Q_OBJECT
public:
/// returncodes for exec()
enum
{
Save = 2,
Open,
OpenWith,
Cancel
};
// if @application is non-empty, the "open with <application>" button will also be shown,
// otherwise only save, open with, cancel
AttachmentDialog( QWidget *parent, const QString &filenameText, const QString &application,
const QString &dontAskAgainName );
// executes the modal dialog
int exec();
private slots:
void saveClicked();
void openClicked();
void openWithClicked();
private:
QString text, dontAskName;
KDialog *dialog;
};
#endif
| Java |
package railo.runtime.functions.dateTime;
import java.util.TimeZone;
import railo.runtime.PageContext;
import railo.runtime.exp.ExpressionException;
import railo.runtime.ext.function.Function;
import railo.runtime.tag.util.DeprecatedUtil;
import railo.runtime.type.dt.DateTime;
import railo.runtime.type.dt.DateTimeImpl;
/**
* Implements the CFML Function now
* @deprecated removed with no replacement
*/
public final class NowServer implements Function {
/**
* @param pc
* @return server time
* @throws ExpressionException
*/
public static DateTime call(PageContext pc ) throws ExpressionException {
DeprecatedUtil.function(pc,"nowServer");
long now = System.currentTimeMillis();
int railo = pc.getTimeZone().getOffset(now);
int server = TimeZone.getDefault().getOffset(now);
return new DateTimeImpl(pc,now-(railo-server),false);
}
} | Java |
/*
* gstvaapidisplay_egl_priv.h - Internal VA/EGL interface
*
* Copyright (C) 2014 Splitted-Desktop Systems
* Author: Gwenole Beauchesne <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef GST_VAAPI_DISPLAY_EGL_PRIV_H
#define GST_VAAPI_DISPLAY_EGL_PRIV_H
#include <gst/vaapi/gstvaapiwindow.h>
#include <gst/vaapi/gstvaapitexturemap.h>
#include "gstvaapidisplay_egl.h"
#include "gstvaapidisplay_priv.h"
#include "gstvaapiutils_egl.h"
G_BEGIN_DECLS
#define GST_VAAPI_IS_DISPLAY_EGL(display) \
(G_TYPE_CHECK_INSTANCE_TYPE ((display), GST_TYPE_VAAPI_DISPLAY_EGL))
#define GST_VAAPI_DISPLAY_EGL_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VAAPI_DISPLAY_EGL, GstVaapiDisplayEGLClass))
#define GST_VAAPI_DISPLAY_EGL_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VAAPI_DISPLAY_EGL, GstVaapiDisplayEGLClass))
#define GST_VAAPI_DISPLAY_EGL_CAST(obj) \
((GstVaapiDisplayEGL *)(obj))
/**
* GST_VAAPI_DISPLAY_EGL_DISPLAY:
* @display: a #GstVaapiDisplay
*
* Macro that evaluates to #EglDisplay wrapper for @display.
* This is an internal macro that does not do any run-time type check.
*/
#undef GST_VAAPI_DISPLAY_EGL_DISPLAY
#define GST_VAAPI_DISPLAY_EGL_DISPLAY(display) \
(GST_VAAPI_DISPLAY_EGL_CAST (display)->egl_display)
/**
* GST_VAAPI_DISPLAY_EGL_CONTEXT:
* @display: a #GstVaapiDisplay
*
* Macro that evaluates to #EglContext wrapper for @display.
* This is an internal macro that does not do any run-time type check.
*/
#undef GST_VAAPI_DISPLAY_EGL_CONTEXT
#define GST_VAAPI_DISPLAY_EGL_CONTEXT(display) \
gst_vaapi_display_egl_get_context (GST_VAAPI_DISPLAY_EGL (display))
typedef struct _GstVaapiDisplayEGLClass GstVaapiDisplayEGLClass;
/**
* GstVaapiDisplayEGL:
*
* VA/EGL display wrapper.
*/
struct _GstVaapiDisplayEGL
{
/*< private >*/
GstVaapiDisplay parent_instance;
gpointer loader;
GstVaapiDisplay *display;
EglDisplay *egl_display;
EglContext *egl_context;
guint gles_version;
GstVaapiTextureMap *texture_map;
};
/**
* GstVaapiDisplayEGLClass:
*
* VA/EGL display wrapper clas.
*/
struct _GstVaapiDisplayEGLClass
{
/*< private >*/
GstVaapiDisplayClass parent_class;
};
G_GNUC_INTERNAL
EglContext *
gst_vaapi_display_egl_get_context (GstVaapiDisplayEGL * display);
G_END_DECLS
#endif /* GST_VAAPI_DISPLAY_EGL_PRIV_H */
| Java |
/*
* Copyright (c) 2012 Citrix Systems, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <xenctrl.h>
#include <surfman.h>
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/extensions/Xinerama.h>
#define GL_GLEXT_PROTOTYPES 1
#include <GL/glx.h>
#include <GL/gl.h>
#include "glgfx.h"
#define MAX_MONITORS 32
#define MAX_SURFACES 256
#define MAX_DISPLAY_CONFIGS 64
#define XORG_TEMPLATE "/etc/X11/xorg.conf-glgfx-nvidia"
static int g_attributes[] = {
GLX_RGBA, GLX_DOUBLEBUFFER,
GLX_RED_SIZE, 8,
GLX_BLUE_SIZE, 8,
GLX_GREEN_SIZE, 8,
None
};
Display *g_display = NULL;
static GLXContext g_context = NULL;
static Colormap g_colormap;
static int g_have_colormap = 0;
static Window g_window = None;
static int g_have_window = 0;
static xc_interface *g_xc = NULL;
static glgfx_surface *g_current_surface = NULL;
static struct event hotplug_timer;
typedef struct {
/* taken from xinerama */
int xoff,yoff,w,h;
} xinemonitor_t;
xinemonitor_t g_monitors[MAX_MONITORS];
int g_num_monitors = 0;
static int g_num_surfaces = 0;
static glgfx_surface* g_surfaces[MAX_SURFACES];
/* current display configuration */
static surfman_display_t g_dispcfg[MAX_DISPLAY_CONFIGS];
static int g_num_dispcfgs = 0;
static int stop_X();
static int
get_gpu_busid(int *b, int *d, int *f)
{
FILE *p;
char buff[1024];
int id = -1;
*b = *d = *f = 0;
p = popen("nvidia-xconfig --query-gpu-info", "r");
if (!p)
{
warning("nvidia-xconfig --query-gpu-info failed\n");
return 0;
}
while (!feof(p))
{
if (!fgets(buff, 1024, p))
break;
sscanf(buff, "GPU #%d:\n", &id);
if (id == 0)
{
if (sscanf(buff, " PCI BusID : PCI:%d:%d:%d\n", b, d, f) == 3)
break;
}
}
pclose(p);
return (*b != 0 || *d != 0 || *f != 0);
}
static char *
generate_xorg_config()
{
int b, d, f;
FILE *in, *out;
char buff[1024];
int id = -1;
int fd = -1;
int generated = 0;
char filename[] = "/tmp/xorg.conf-glgfx-nvidia-XXXXXX";
if (!get_gpu_busid(&b, &d, &f))
{
error("Can't get GPU#0 busid\n");
return NULL;
}
info("Found Nvidia GPU#0 %04x:%02x.%01x", b, d, f);
info("Temp fd %d\n", fd);
fd = mkstemp(filename);
info("Temp fd %d %s\n", fd, filename);
out = fdopen(fd, "w");
info("Generated config file %s\n", filename);
in = fopen(XORG_TEMPLATE, "r");
if (!in || !out)
goto out;
while (!feof(in))
{
if (!fgets(buff, 1024, in))
break;
info(buff);
if (strcmp(buff, " BusID \"PCI:b:d:f\"\n") == 0)
{
fprintf(out, " BusID \"PCI:%d:%d:%d\"\n",
b, d, f);
generated = 1;
}
else
fprintf(out, buff);
}
out:
if (out)
fclose(out);
if (in)
fclose(in);
if (!generated)
return NULL;
return strdup(filename);
}
static void
resize_gl( int w, int h )
{
info("resize_gl");
h = h == 0 ? 1 : h;
glViewport( 0, 0, w, h );
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho( 0, w-1, h-1, 0, -10, 10 );
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
static void
init_gl()
{
info("init_gl");
glClearColor( 0, 0, 0, 0 );
glClear( GL_COLOR_BUFFER_BIT );
glEnable( GL_TEXTURE );
glEnable( GL_TEXTURE_2D );
glFlush();
}
static void
resize_pbo( GLuint id, size_t sz )
{
GLubyte *ptr;
info( "sizing PBO %d to %d bytes", id, sz );
glBindBuffer( GL_PIXEL_UNPACK_BUFFER, id );
glBufferData( GL_PIXEL_UNPACK_BUFFER, sz, 0, GL_DYNAMIC_DRAW );
ptr = (GLubyte*) glMapBuffer( GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY );
info( "PBO %d seems to map onto %p", id, ptr );
glUnmapBuffer( GL_PIXEL_UNPACK_BUFFER );
}
static GLuint
create_pbo( size_t sz )
{
GLuint id;
glGenBuffers( 1, &id );
info( "created PBO %d", id );
return id;
}
static GLuint
create_texobj()
{
GLuint id;
info("creating texture object");
glGenTextures( 1, &id );
glBindTexture( GL_TEXTURE_2D, id );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
info( "created texture object %d", id );
return id;
}
static int get_gl_formats( int surfman_surface_fmt, GLenum *gl_fmt, GLenum *gl_typ )
{
switch (surfman_surface_fmt) {
case SURFMAN_FORMAT_BGRX8888:
*gl_fmt = GL_BGRA;
*gl_typ = GL_UNSIGNED_BYTE;
return 0;
case SURFMAN_FORMAT_RGBX8888:
*gl_fmt = GL_RGBA;
*gl_typ = GL_UNSIGNED_BYTE;
return 0;
case SURFMAN_FORMAT_BGR565:
*gl_fmt = GL_BGR;
*gl_typ = GL_UNSIGNED_SHORT_5_6_5;
return 0;
default:
error("unsupported surfman surface format %d", surfman_surface_fmt );
return -1;
}
}
static void
upload_pbo_to_texture(
GLuint pbo,
GLenum pbo_format,
GLenum pbo_type,
GLuint tex,
int recreate_texture,
int x,
int y,
int w,
int h,
int stride_in_bytes )
{
glBindBuffer( GL_PIXEL_UNPACK_BUFFER, pbo );
glBindTexture( GL_TEXTURE_2D, tex );
glPixelStorei( GL_UNPACK_ALIGNMENT, 4 );
glPixelStorei( GL_UNPACK_ROW_LENGTH, stride_in_bytes / 4 ); // assume 4bpp for now
if (recreate_texture) {
glTexImage2D( GL_TEXTURE_2D, 0, 4, w, h, 0, pbo_format, pbo_type, 0 );
} else {
glTexSubImage2D( GL_TEXTURE_2D, 0, x, y, w, h, pbo_format, pbo_type, 0 );
}
}
static int
copy_to_pbo( GLuint pbo, GLubyte *src, size_t len, uint8_t *dirty_bitmap )
{
GLubyte *ptr;
glBindBuffer( GL_PIXEL_UNPACK_BUFFER, pbo );
ptr = (GLubyte*) glMapBuffer( GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY );
if (!ptr) {
error("copy_to_pbo %d %p %d: map buffer FAILED", pbo, src, len);
return -1;
}
if (!dirty_bitmap) {
memcpy( ptr, src, len );
} else {
/* FIXME: this is bit suboptimal */
int num_pages = (len+XC_PAGE_SIZE-1) / XC_PAGE_SIZE;
int num_bytes = num_pages/8;
uint8_t* p = dirty_bitmap;
int i = 0, j;
while (i < num_bytes) {
switch (*p) {
case 0x00:
break;
default:
memcpy( ptr + XC_PAGE_SIZE*i*8, src + XC_PAGE_SIZE*i*8, XC_PAGE_SIZE*8 );
break;
}
++p;
++i;
}
ptr = ptr + XC_PAGE_SIZE*i*8;
src = src + XC_PAGE_SIZE*i*8;
i = 0;
while (i < num_pages%8) {
if (*p & (1<<i)) {
memcpy( ptr + XC_PAGE_SIZE*i, src + XC_PAGE_SIZE*i, XC_PAGE_SIZE );
}
++i;
}
}
glUnmapBuffer( GL_PIXEL_UNPACK_BUFFER );
return 0;
}
static void
upload_to_gpu( surfman_surface_t *src, glgfx_surface *dst, uint8_t *dirty_bitmap )
{
GLenum fb_format, fb_type;
int recreate=0, rv;
if ( !dst->initialised ) {
error("gpu surface not initialised");
return;
}
if ( !dst->mapped_fb ) {
error("framebuffer does not appear to be mapped");
return;
}
if ( dst->mapped_fb_size < dst->stride * dst->h ) {
error("framebuffer mapping appears to be too short");
return;
}
if ( get_gl_formats( src->format, &fb_format, &fb_type ) < 0 ) {
error("unsupported/unknown surface format");
return;
}
if ( dst->last_w != dst->w || dst->last_h != dst->h ) {
recreate = 1;
}
if ( recreate ) {
info("stride: %d, height: %d", dst->stride, dst->h);
resize_pbo( dst->pbo, dst->stride*dst->h );
}
rv = copy_to_pbo( dst->pbo, dst->mapped_fb, dst->stride * dst->h, recreate ? NULL : dirty_bitmap );
upload_pbo_to_texture( dst->pbo, fb_format, fb_type, dst->tex, recreate, 0, 0, dst->w, dst->h, dst->stride );
/* only overwrite if success from previous ops */
if (rv == 0) {
dst->last_w = dst->w;
dst->last_h = dst->h;
}
}
static void
map_fb( surfman_surface_t *src, glgfx_surface *dst )
{
if ( !( dst->mapped_fb = surface_map( src ) ) ) {
error("failed to map framebuffer pages");
}
}
static int
init_surface_resources( glgfx_surface *surface )
{
GLubyte *buf;
info("init surface resources for %p", surface);
if (surface->initialised) {
error("surface already initialised");
return -1;
}
surface->tex = create_texobj();
surface->pbo = create_pbo( surface->w*surface->stride );
map_fb( surface->src, surface );
surface->initialised = 1;
return 0;
}
static void
free_surface_resources( glgfx_surface *surf )
{
if (surf) {
info("free surface resources %p", surf);
if (surf->anim_next && surf->anim_next->anim_prev == surf) {
surf->anim_next->anim_prev = NULL;
}
if (surf->anim_prev && surf->anim_prev->anim_next == surf) {
surf->anim_prev->anim_next = NULL;
}
glDeleteTextures( 1, &surf->tex );
glBufferData( GL_PIXEL_UNPACK_BUFFER, 0, NULL, GL_DYNAMIC_DRAW );
glDeleteBuffers( 1, &surf->pbo );
surface_unmap( surf );
surf->initialised = 0;
}
}
static void
render( glgfx_surface *surface, int w, int h )
{
glBindTexture( GL_TEXTURE_2D, surface->tex );
glColor3f( 1,1,1 );
glBegin( GL_QUADS );
glTexCoord2f( 0,0 ); glVertex2f( 0, 0 );
glTexCoord2f( 1,0 ); glVertex2f( w-1, 0 );
glTexCoord2f( 1,1 ); glVertex2f( w-1, h-1 );
glTexCoord2f( 0,1 ); glVertex2f( 0, h-1 );
glEnd();
glFlush();
}
static void
render_as_tiles( glgfx_surface *surface, int xtiles, int ytiles, float z, int rev,
int w, int h, float phase )
{
int x,y;
float xstep = 1.0 / xtiles;
float ystep = 1.0 / ytiles;
float xc = xstep*xtiles/2;
float yc = ystep*ytiles/2;
glBindTexture( GL_TEXTURE_2D, surface->tex );
glColor3f( 1,1,1 );
for (y = 0; y < ytiles; ++y) {
for (x = 0; x < xtiles; ++x) {
float x0 = xstep*x;
float y0 = ystep*y;
float x1 = x0+xstep;
float y1 = y0+xstep;
float dst = sqrtf(sqrtf((x1-xc)*(x1-xc)+(y1-yc)*(y1-yc)));
float speed = cos(dst*3.14159/2)*2;
if (speed<1) speed=1;
float rot = phase * speed * 180;
if (rev) {
rot = 180-rot;
}
glLoadIdentity();
glTranslatef( x0*(w-1), y0*(h-1), z );
if (rot > 180) rot=180;
if (rot < 0) rot=0;
glRotatef( rot, 1, 1, 0 );
glBegin( GL_QUADS );
glTexCoord2f( x0,y0 ); glVertex3f( 0,0,0 );
glTexCoord2f( x1,y0 ); glVertex3f( xstep*(w-1),0,0 );
glTexCoord2f( x1,y1 ); glVertex3f( xstep*(w-1),ystep*(h-1),0 );
glTexCoord2f( x0,y1 ); glVertex3f( 0,ystep*(h-1),0 );
glEnd();
}
}
}
static void
render_animated( glgfx_surface *surface, int w, int h )
{
if ( !surface->anim_active ) {
render( surface, w, h );
} else {
glPushAttrib( GL_DEPTH_BUFFER_BIT );
glEnable( GL_CULL_FACE );
glClearColor( 0, 0, 0, 0 );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glFrontFace( GL_CW );
render_as_tiles( surface, 16, 16, 1, 1, w, h, surface->anim_phase );
if ( surface->anim_prev ) {
glFrontFace( GL_CW );
render_as_tiles( surface->anim_prev, 16, 16, -1, 0, w, h, surface->anim_phase );
}
/* update animation frame */
surface->anim_phase += 0.02;
if (surface->anim_phase > 1) {
surface->anim_phase = 0;
surface->anim_active = 0;
surface->anim_next = NULL;
if (surface->anim_prev) {
surface->anim_prev->anim_next = NULL;
}
}
glPopAttrib();
glDisable( GL_CULL_FACE );
}
glFlush();
}
static void
hide_x_cursor(Display *display, Window window)
{
Cursor invis_cur;
Pixmap empty_pix;
XColor black;
static char empty_data[] = { 0,0,0,0,0,0,0,0 };
black.red = black.green = black.blue = 0;
empty_pix = XCreateBitmapFromData(display, window, empty_data, 8, 8);
invis_cur = XCreatePixmapCursor(
display, empty_pix, empty_pix,
&black, &black, 0, 0);
XDefineCursor(display, window, invis_cur);
XFreeCursor(display, invis_cur);
}
static void
dump_visuals(Display *display)
{
XVisualInfo template;
XVisualInfo *vi = NULL;
int count;
vi = XGetVisualInfo( display, 0, &template, &count );
if (vi) {
int i;
for ( i = 0; i < count; ++i ) {
XVisualInfo *v = &vi[i];
info( "visual %d: depth=%d bits_per_rgb=%d, screen=%d, class=%d", i, v->depth, v->bits_per_rgb, v->screen, v->class );
}
XFree( vi );
}
}
static int
init_window(int w, int h)
{
int screen;
XVisualInfo *vi;
XSetWindowAttributes winattr;
info( "create X window");
if (!g_display) {
error("init_window: no display");
return -1;
}
screen = DefaultScreen(g_display);
info( "screen=%d", screen);
dump_visuals( g_display );
vi = glXChooseVisual( g_display, screen, g_attributes );
if (!vi) {
error("failed to choose appropriate visual");
return -1;
}
g_context = glXCreateContext( g_display, vi, 0, GL_TRUE );
g_colormap = XCreateColormap( g_display, RootWindow(g_display, vi->screen), vi->visual, AllocNone );
g_have_colormap = 1;
winattr.colormap = g_colormap;
winattr.border_pixel = 0;
winattr.event_mask = ExposureMask | StructureNotifyMask;
g_window = XCreateWindow(
g_display, RootWindow(g_display, vi->screen),
0, 0, w, h, 0, vi->depth, InputOutput, vi->visual,
CWBorderPixel | CWColormap | CWEventMask, &winattr
);
XMapRaised( g_display, g_window );
glXMakeCurrent( g_display, g_window, g_context );
if ( glXIsDirect( g_display, g_context ) ) {
info( "DRI enabled");
} else {
info( "no DRI available");
}
hide_x_cursor( g_display, g_window );
info ("GL extensions: %s", glGetString( GL_EXTENSIONS ));
init_gl();
resize_gl( w, h );
info ("window init completed");
XFree( vi );
return 0;
}
static void
update_monitors()
{
if (!g_display) {
error("update_monitors: NO DISPLAY");
return;
}
if (XineramaIsActive(g_display)) {
int num_screens = 0, i;
XineramaScreenInfo *info = XineramaQueryScreens( g_display, &num_screens );
XineramaScreenInfo *scr = info;
g_num_monitors = 0;
for (i = 0; i < num_screens && i < MAX_MONITORS; ++i) {
xinemonitor_t *m = &g_monitors[i];
info( "Xinerama screen %d: x_org=%d y_org=%d width=%d height=%d",
i, scr->x_org, scr->y_org, scr->width, scr->height );
m->xoff = scr->x_org;
m->yoff = scr->y_org;
m->w = scr->width;
m->h = scr->height;
++scr;
++g_num_monitors;
}
XFree( info );
} else {
/* one monitor then */
int scr;
xinemonitor_t *m;
info("XINERAMA is inactive");
scr = XDefaultScreen(g_display);
if (!scr) {
error("update_monitors w/o xinerama: NO DEFAULT SCREEN?");
return;
}
m = &g_monitors[0];
m->xoff = m->yoff = 0;
m->w = DisplayWidth(g_display, scr);
m->h = DisplayHeight(g_display, scr);
g_num_monitors = 1;
}
}
static int
start_X()
{
Display *display = NULL;
int i;
int rv;
const int TRIES = 10;
char *config_filename;
char cmd[1024];
config_filename = generate_xorg_config();
if (!config_filename)
{
error("Can't generate xorg config file");
return SURFMAN_ERROR;
}
info( "starting X server (config:%s)", config_filename);
snprintf(cmd, 1024, "start-stop-daemon -S -b --exec /usr/bin/X -- -config %s",
config_filename);
free(config_filename);
unlink(config_filename);
rv = system(cmd);
if (rv < 0) {
return rv;
}
for (i = 0; i < TRIES; ++i) {
display = XOpenDisplay( ":0" );
if (display) {
info( "opened X display");
break;
}
sleep(1);
}
if (!display) {
error("failed to open X display");
return SURFMAN_ERROR;
}
g_display = display;
if (XineramaIsActive(display)) {
info("XINERAMA is active");
int num_screens = 0;
XineramaScreenInfo *info = XineramaQueryScreens( display, &num_screens );
XineramaScreenInfo *scr = info;
for (i = 0; i < num_screens; ++i) {
info( "Xinerama screen %d: x_org=%d y_org=%d width=%d height=%d",
i, scr->x_org, scr->y_org, scr->width, scr->height );
++scr;
}
XFree( info );
} else {
info("XINERAMA is inactive");
}
return SURFMAN_SUCCESS;
}
static int
start_X_and_create_window()
{
int rv = start_X();
if (rv < 0) {
return rv;
}
if (!g_have_window) {
int screen, w, h;
screen = DefaultScreen(g_display);
w = DisplayWidth(g_display, screen);
h = DisplayHeight(g_display, screen);
info("creating window %d %d screen=%d", w, h, screen);
rv = init_window(w,h);
if (rv < 0) {
error("failed to create window");
return SURFMAN_ERROR;
}
g_have_window = 1;
}
return 0;
}
static int
stop_X()
{
int rv, tries=0,i;
info( "stopping X server");
/* free all surface resources */
for (i = 0; i < g_num_surfaces; ++i) {
info("freeing surface %d", i);
free_surface_resources( g_surfaces[i] );
}
if (g_context) {
info("freeing context");
glXMakeCurrent( g_display, None, NULL );
glXDestroyContext( g_display, g_context );
g_context = NULL;
}
if (g_window != None) {
info("freeing window");
XUnmapWindow( g_display, g_window );
XDestroyWindow( g_display, g_window );
g_window = None;
g_have_window = 0;
}
if (g_have_colormap) {
info("freeing colormap");
XFreeColormap( g_display, g_colormap );
g_have_colormap = 0;
}
if (g_display) {
info("closing display");
XCloseDisplay( g_display );
g_display = NULL;
}
rv = system("start-stop-daemon -K --exec /usr/bin/X");
if (rv != 0) {
return SURFMAN_ERROR;
}
while (tries < 10) {
rv = system("pidof X");
if (rv == 0) {
info("waiting for X server to disappear..");
sleep(1);
++tries;
} else {
info("X server disappeared");
return SURFMAN_SUCCESS;
}
}
error("timeout waiting for X server to disappear");
return SURFMAN_ERROR;
}
static int
check_monitor_hotplug(surfman_plugin_t *plugin)
{
static int monitors = 1;
int l_monitor;
int id;
FILE *f = NULL;
char buff[1024];
struct timeval tv = {1, 0};
event_add(&hotplug_timer, &tv);
f = popen("nvidia-xconfig --query-gpu-info", "r");
if (!f)
{
warning("nvidia-xconfig --query-gpu-info failed\n");
return monitors;
}
while (!feof(f))
{
if (!fgets(buff, 1024, f))
break;
if (sscanf(buff, "GPU #%d:\n", &id) == 1 &&
id != 0)
break;
if (sscanf(buff, " Number of Display Devices: %d\n", &l_monitor) == 1)
{
if (monitors != l_monitor)
{
if (monitors != -1)
{
info("Detect monitor hotplug, %d monitors, before was %d\n",
l_monitor, monitors);
stop_X();
start_X_and_create_window();
plugin->notify = SURFMAN_NOTIFY_MONITOR_RESCAN;
}
monitors = l_monitor;
break;
}
}
}
pclose(f);
return monitors;
}
static void
check_monitor_hotplug_cb(int fd, short event, void *opaque)
{
check_monitor_hotplug(opaque);
}
static int
have_nvidia()
{
return system("lspci -d 10de:* -mm -n | cut -d \" \" -f 2 | grep 0300") == 0;
}
static int
glgfx_init (surfman_plugin_t * p)
{
int rv;
struct timeval tv = {1, 0};
info( "glgfx_init");
if (!have_nvidia()) {
error("NVIDIA device not present");
return SURFMAN_ERROR;
}
g_xc = xc_interface_open(NULL, NULL, 0);
if (!g_xc) {
error("failed to open XC interface");
return SURFMAN_ERROR;
}
rv = start_X_and_create_window();
if (rv < 0) {
error("starting X failed");
return SURFMAN_ERROR;
}
event_set(&hotplug_timer, -1, EV_TIMEOUT,
check_monitor_hotplug_cb, p);
event_add(&hotplug_timer, &tv);
return SURFMAN_SUCCESS;
}
static void
glgfx_shutdown (surfman_plugin_t * p)
{
int rv;
info("shutting down");
if ( g_context ) {
if ( !glXMakeCurrent(g_display, None, NULL)) {
error("could not release drawing context");
}
glXDestroyContext( g_display, g_context );
}
if ( g_display ) {
XCloseDisplay( g_display );
g_display = NULL;
}
rv = stop_X();
if (rv < 0) {
error("stopping X failed");
}
xc_interface_close(g_xc);
g_xc = NULL;
}
static int
glgfx_display (surfman_plugin_t * p,
surfman_display_t * config,
size_t size)
{
int rv;
glgfx_surface *surf = NULL;
size_t i;
info("glgfx_display, num config=%d", (int)size);
/* initialise surfaces should that be necessary */
for (i = 0; i < size; ++i) {
surfman_display_t *d = &config[i];
info("surface %p on monitor %p", d->psurface, d->monitor);
if (d->psurface) {
surf = (glgfx_surface*) d->psurface;
if (!surf->initialised) {
info("initialising surface");
if (init_surface_resources(surf) < 0) {
error("FAILED to initialise surface!");
return SURFMAN_ERROR;
}
}
/* perhaps begin animation sequence if we changed surface on i-th display */
if (i < (size_t)g_num_dispcfgs) {
glgfx_surface *prev_surf = (glgfx_surface*) g_dispcfg[i].psurface;
if (prev_surf && prev_surf != surf) {
/* yes */
prev_surf->anim_next = surf;
prev_surf->anim_prev = NULL;
prev_surf->anim_active = 0;
surf->anim_prev = prev_surf;
surf->anim_next = NULL;
surf->anim_phase = 0;
surf->anim_active = 1;
}
}
}
}
/* cache the display config for actual rendering done during refresh callback */
memcpy( g_dispcfg, config, sizeof(surfman_display_t) * size );
g_num_dispcfgs = size;
return SURFMAN_SUCCESS;
}
static int
glgfx_get_monitors (surfman_plugin_t * p,
surfman_monitor_t * monitors,
size_t size)
{
static surfman_monitor_t m = NULL;
int i;
info( "glgfx_get_monitors");
update_monitors();
for (i = 0; i < g_num_monitors && i < (int)size; ++i) {
monitors[i] = &g_monitors[i];
}
info( "found %d monitors", g_num_monitors );
return g_num_monitors;
}
static int
glgfx_set_monitor_modes (surfman_plugin_t * p,
surfman_monitor_t monitor,
surfman_monitor_mode_t * mode)
{
info( "glgfx_set_monitor_modes");
return SURFMAN_SUCCESS;
}
static int
glgfx_get_monitor_info_by_monitor (surfman_plugin_t * p,
surfman_monitor_t monitor,
surfman_monitor_info_t * info,
unsigned int modes_count)
{
int w,h,screen;
xinemonitor_t *m;
// info( "glgfx_get_monitor_info_by_monitor" );
m = (xinemonitor_t*) monitor;
w = m->w; h = m->h;
info->modes[0].htimings[SURFMAN_TIMING_ACTIVE] = w;
info->modes[0].htimings[SURFMAN_TIMING_SYNC_START] = w;
info->modes[0].htimings[SURFMAN_TIMING_SYNC_END] = w;
info->modes[0].htimings[SURFMAN_TIMING_TOTAL] = w;
info->modes[0].vtimings[SURFMAN_TIMING_ACTIVE] = h;
info->modes[0].vtimings[SURFMAN_TIMING_SYNC_START] = h;
info->modes[0].vtimings[SURFMAN_TIMING_SYNC_END] = h;
info->modes[0].vtimings[SURFMAN_TIMING_TOTAL] = h;
info->prefered_mode = &info->modes[0];
info->current_mode = &info->modes[0];
info->mode_count = 1;
return SURFMAN_SUCCESS;
}
static int
glgfx_get_monitor_edid_by_monitor (surfman_plugin_t * p,
surfman_monitor_t monitor,
surfman_monitor_edid_t * edid)
{
info( "glgfx_get_edid_by_monitor");
return SURFMAN_SUCCESS;
}
static surfman_psurface_t
glgfx_get_psurface_from_surface (surfman_plugin_t * p,
surfman_surface_t * surfman_surface)
{
glgfx_surface *surface = NULL;
info("glgfx_get_psurface_from_surface");
if (g_num_surfaces >= MAX_SURFACES) {
error("too many surfaces");
return NULL;
}
surface = calloc(1, sizeof(glgfx_surface));
if (!surface) {
return NULL;
}
surface->last_w = 0;
surface->last_h = 0;
surface->w = surfman_surface->width;
surface->h = surfman_surface->height;
surface->stride = surfman_surface->stride;
surface->src = surfman_surface;
surface->initialised = 0;
surface->mapped_fb = NULL;
surface->anim_next = NULL;
surface->anim_prev = NULL;
surface->anim_active = 0;
surface->anim_phase = 0;
info("allocated psurface %p", surface);
map_fb( surfman_surface, surface );
g_surfaces[g_num_surfaces++] = surface;
return surface;
}
static void
glgfx_update_psurface (surfman_plugin_t *plugin,
surfman_psurface_t psurface,
surfman_surface_t *surface,
unsigned int flags)
{
glgfx_surface *glsurf = (glgfx_surface*)psurface;
info( "glgfx_update_psurface %p", surface);
if (!psurface) {
return;
}
glsurf->last_w = 0;
glsurf->last_h = 0;
glsurf->w = surface->width;
glsurf->h = surface->height;
glsurf->stride = surface->stride;
glsurf->src = surface;
if (flags & SURFMAN_UPDATE_PAGES) {
surface_unmap( psurface );
map_fb( surface, psurface );
}
}
static void
glgfx_refresh_surface(struct surfman_plugin *plugin,
surfman_psurface_t psurface,
uint8_t *refresh_bitmap)
{
glgfx_surface *dst = (glgfx_surface*) psurface;
int i;
if (!dst) {
return;
}
glLoadIdentity();
/* upload the surface which requires refresh into GPU */
upload_to_gpu( dst->src, dst, refresh_bitmap );
/* then render all currently visible surfaces */
for (i = 0; i < g_num_dispcfgs; ++i) {
surfman_display_t *d = &g_dispcfg[i];
xinemonitor_t *m = (xinemonitor_t*) d->monitor;
glgfx_surface *surf = (glgfx_surface*) d->psurface;
if (surf && surf == psurface && surf->initialised) {
/* translate onto monitor */
glLoadIdentity();
glTranslatef( m->xoff, m->yoff, 0 );
render_animated( dst, m->w, m->h );
}
}
/* deus ex machina */
glXSwapBuffers( g_display, g_window );
}
static void
glgfx_free_psurface_pages(surfman_plugin_t * p,
surfman_psurface_t psurface)
{
info( "%s", __func__);
}
static int
glgfx_get_pages_from_psurface (surfman_plugin_t * p,
surfman_psurface_t psurface,
uint64_t * pages)
{
info( "glgfx_get_pages_from_psurface");
return SURFMAN_ERROR;
}
static int
glgfx_copy_surface_on_psurface (surfman_plugin_t * p,
surfman_psurface_t psurface)
{
info( "glgfx_copy_surface_on_psurface");
return SURFMAN_ERROR;
}
static int
glgfx_copy_psurface_on_surface (surfman_plugin_t * p,
surfman_psurface_t psurface)
{
info( "glgfx_copy_psurface_on_surface");
return SURFMAN_ERROR;
}
static void
glgfx_free_psurface (surfman_plugin_t * plugin,
surfman_psurface_t psurface)
{
int i;
glgfx_surface *surf = (glgfx_surface*) psurface;
info( "glgfx_free_psurface");
if (surf) {
free_surface_resources( surf );
surface_unmap( surf );
for (i = 0; i < g_num_surfaces; ++i) {
if (g_surfaces[i] == surf) {
info ("removing surface at %d", i);
if (i != MAX_SURFACES-1 ) {
memcpy( &g_surfaces[i], &g_surfaces[i+1], (g_num_surfaces-i-1)*sizeof(glgfx_surface*) );
}
--g_num_surfaces;
break;
}
}
free(surf);
}
}
surfman_plugin_t surfman_plugin = {
.init = glgfx_init,
.shutdown = glgfx_shutdown,
.display = glgfx_display,
.get_monitors = glgfx_get_monitors,
.set_monitor_modes = glgfx_set_monitor_modes,
.get_monitor_info = glgfx_get_monitor_info_by_monitor,
.get_monitor_edid = glgfx_get_monitor_edid_by_monitor,
.get_psurface_from_surface = glgfx_get_psurface_from_surface,
.update_psurface = glgfx_update_psurface,
.refresh_psurface = glgfx_refresh_surface,
.get_pages_from_psurface = glgfx_get_pages_from_psurface,
.free_psurface_pages = glgfx_free_psurface_pages,
.copy_surface_on_psurface = glgfx_copy_surface_on_psurface,
.copy_psurface_on_surface = glgfx_copy_psurface_on_surface,
.free_psurface = glgfx_free_psurface,
.options = {1, SURFMAN_FEATURE_NEED_REFRESH},
.notify = SURFMAN_NOTIFY_NONE
};
| Java |
/*****************************************************************************
* schroedinger.c: Dirac decoder module making use of libschroedinger.
* (http://www.bbc.co.uk/rd/projects/dirac/index.shtml)
* (http://diracvideo.org)
*****************************************************************************
* Copyright (C) 2008-2011 VLC authors and VideoLAN
*
* Authors: Jonathan Rosser <[email protected]>
* David Flynn <davidf at rd dot bbc.co.uk>
* Anuradha Suraparaju <asuraparaju at gmail dot com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program 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 program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <assert.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
#include <schroedinger/schro.h>
/*****************************************************************************
* Module descriptor
*****************************************************************************/
static int OpenDecoder ( vlc_object_t * );
static void CloseDecoder ( vlc_object_t * );
static int OpenEncoder ( vlc_object_t * );
static void CloseEncoder ( vlc_object_t * );
#define ENC_CFG_PREFIX "sout-schro-"
#define ENC_CHROMAFMT "chroma-fmt"
#define ENC_CHROMAFMT_TEXT N_("Chroma format")
#define ENC_CHROMAFMT_LONGTEXT N_("Picking chroma format will force a " \
"conversion of the video into that format")
static const char *const enc_chromafmt_list[] =
{ "420", "422", "444" };
static const char *const enc_chromafmt_list_text[] =
{ N_("4:2:0"), N_("4:2:2"), N_("4:4:4") };
#define ENC_RATE_CONTROL "rate-control"
#define ENC_RATE_CONTROL_TEXT N_("Rate control method")
#define ENC_RATE_CONTROL_LONGTEXT N_("Method used to encode the video sequence")
static const char *enc_rate_control_list[] = {
"constant_noise_threshold",
"constant_bitrate",
"low_delay",
"lossless",
"constant_lambda",
"constant_error",
"constant_quality"
};
static const char *enc_rate_control_list_text[] = {
N_("Constant noise threshold mode"),
N_("Constant bitrate mode (CBR)"),
N_("Low Delay mode"),
N_("Lossless mode"),
N_("Constant lambda mode"),
N_("Constant error mode"),
N_("Constant quality mode")
};
#define ENC_GOP_STRUCTURE "gop-structure"
#define ENC_GOP_STRUCTURE_TEXT N_("GOP structure")
#define ENC_GOP_STRUCTURE_LONGTEXT N_("GOP structure used to encode the video sequence")
static const char *enc_gop_structure_list[] = {
"adaptive",
"intra_only",
"backref",
"chained_backref",
"biref",
"chained_biref"
};
static const char *enc_gop_structure_list_text[] = {
N_("No fixed gop structure. A picture can be intra or inter and refer to previous or future pictures."),
N_("I-frame only sequence"),
N_("Inter pictures refere to previous pictures only"),
N_("Inter pictures refere to previous pictures only"),
N_("Inter pictures can refer to previous or future pictures"),
N_("Inter pictures can refer to previous or future pictures")
};
#define ENC_QUALITY "quality"
#define ENC_QUALITY_TEXT N_("Constant quality factor")
#define ENC_QUALITY_LONGTEXT N_("Quality factor to use in constant quality mode")
#define ENC_NOISE_THRESHOLD "noise-threshold"
#define ENC_NOISE_THRESHOLD_TEXT N_("Noise Threshold")
#define ENC_NOISE_THRESHOLD_LONGTEXT N_("Noise threshold to use in constant noise threshold mode")
#define ENC_BITRATE "bitrate"
#define ENC_BITRATE_TEXT N_("CBR bitrate (kbps)")
#define ENC_BITRATE_LONGTEXT N_("Target bitrate in kbps when encoding in constant bitrate mode")
#define ENC_MAX_BITRATE "max-bitrate"
#define ENC_MAX_BITRATE_TEXT N_("Maximum bitrate (kbps)")
#define ENC_MAX_BITRATE_LONGTEXT N_("Maximum bitrate in kbps when encoding in constant bitrate mode")
#define ENC_MIN_BITRATE "min-bitrate"
#define ENC_MIN_BITRATE_TEXT N_("Minimum bitrate (kbps)")
#define ENC_MIN_BITRATE_LONGTEXT N_("Minimum bitrate in kbps when encoding in constant bitrate mode")
#define ENC_AU_DISTANCE "gop-length"
#define ENC_AU_DISTANCE_TEXT N_("GOP length")
#define ENC_AU_DISTANCE_LONGTEXT N_("Number of pictures between successive sequence headers i.e. length of the group of pictures")
#define ENC_PREFILTER "filtering"
#define ENC_PREFILTER_TEXT N_("Prefilter")
#define ENC_PREFILTER_LONGTEXT N_("Enable adaptive prefiltering")
static const char *enc_filtering_list[] = {
"none",
"center_weighted_median",
"gaussian",
"add_noise",
"adaptive_gaussian",
"lowpass"
};
static const char *enc_filtering_list_text[] = {
N_("No pre-filtering"),
N_("Centre Weighted Median"),
N_("Gaussian Low Pass Filter"),
N_("Add Noise"),
N_("Gaussian Adaptive Low Pass Filter"),
N_("Low Pass Filter"),
};
#define ENC_PREFILTER_STRENGTH "filter-value"
#define ENC_PREFILTER_STRENGTH_TEXT N_("Amount of prefiltering")
#define ENC_PREFILTER_STRENGTH_LONGTEXT N_("Higher value implies more prefiltering")
#define ENC_CODINGMODE "coding-mode"
#define ENC_CODINGMODE_TEXT N_("Picture coding mode")
#define ENC_CODINGMODE_LONGTEXT N_("Field coding is where interlaced fields are coded" \
" separately as opposed to a pseudo-progressive frame")
static const char *const enc_codingmode_list[] =
{ "auto", "progressive", "field" };
static const char *const enc_codingmode_list_text[] =
{ N_("auto - let encoder decide based upon input (Best)"),
N_("force coding frame as single picture"),
N_("force coding frame as separate interlaced fields"),
};
/* advanced option only */
#define ENC_MCBLK_SIZE "motion-block-size"
#define ENC_MCBLK_SIZE_TEXT N_("Size of motion compensation blocks")
static const char *enc_block_size_list[] = {
"automatic",
"small",
"medium",
"large"
};
static const char *const enc_block_size_list_text[] =
{ N_("automatic - let encoder decide based upon input (Best)"),
N_("small - use small motion compensation blocks"),
N_("medium - use medium motion compensation blocks"),
N_("large - use large motion compensation blocks"),
};
/* advanced option only */
#define ENC_MCBLK_OVERLAP "motion-block-overlap"
#define ENC_MCBLK_OVERLAP_TEXT N_("Overlap of motion compensation blocks")
static const char *enc_block_overlap_list[] = {
"automatic",
"none",
"partial",
"full"
};
static const char *const enc_block_overlap_list_text[] =
{ N_("automatic - let encoder decide based upon input (Best)"),
N_("none - Motion compensation blocks do not overlap"),
N_("partial - Motion compensation blocks only partially overlap"),
N_("full - Motion compensation blocks fully overlap"),
};
#define ENC_MVPREC "mv-precision"
#define ENC_MVPREC_TEXT N_("Motion Vector precision")
#define ENC_MVPREC_LONGTEXT N_("Motion Vector precision in pels")
static const char *const enc_mvprec_list[] =
{ "1", "1/2", "1/4", "1/8" };
/* advanced option only */
#define ENC_ME_COMBINED "me-combined"
#define ENC_ME_COMBINED_TEXT N_("Three component motion estimation")
#define ENC_ME_COMBINED_LONGTEXT N_("Use chroma as part of the motion estimation process")
#define ENC_DWTINTRA "intra-wavelet"
#define ENC_DWTINTRA_TEXT N_("Intra picture DWT filter")
#define ENC_DWTINTER "inter-wavelet"
#define ENC_DWTINTER_TEXT N_("Inter picture DWT filter")
static const char *enc_wavelet_list[] = {
"desl_dubuc_9_7",
"le_gall_5_3",
"desl_dubuc_13_7",
"haar_0",
"haar_1",
"fidelity",
"daub_9_7"
};
static const char *enc_wavelet_list_text[] = {
"Deslauriers-Dubuc (9,7)",
"LeGall (5,3)",
"Deslauriers-Dubuc (13,7)",
"Haar with no shift",
"Haar with single shift per level",
"Fidelity filter",
"Daubechies (9,7) integer approximation"
};
#define ENC_DWTDEPTH "transform-depth"
#define ENC_DWTDEPTH_TEXT N_("Number of DWT iterations")
#define ENC_DWTDEPTH_LONGTEXT N_("Also known as DWT levels")
/* advanced option only */
#define ENC_MULTIQUANT "enable-multiquant"
#define ENC_MULTIQUANT_TEXT N_("Enable multiple quantizers")
#define ENC_MULTIQUANT_LONGTEXT N_("Enable multiple quantizers per subband (one per codeblock)")
/* advanced option only */
#define ENC_NOAC "enable-noarith"
#define ENC_NOAC_TEXT N_("Disable arithmetic coding")
#define ENC_NOAC_LONGTEXT N_("Use variable length codes instead, useful for very high bitrates")
/* visual modelling */
/* advanced option only */
#define ENC_PWT "perceptual-weighting"
#define ENC_PWT_TEXT N_("perceptual weighting method")
static const char *enc_perceptual_weighting_list[] = {
"none",
"ccir959",
"moo",
"manos_sakrison"
};
/* advanced option only */
#define ENC_PDIST "perceptual-distance"
#define ENC_PDIST_TEXT N_("perceptual distance")
#define ENC_PDIST_LONGTEXT N_("perceptual distance to calculate perceptual weight")
/* advanced option only */
#define ENC_HSLICES "horiz-slices"
#define ENC_HSLICES_TEXT N_("Horizontal slices per frame")
#define ENC_HSLICES_LONGTEXT N_("Number of horizontal slices per frame in low delay mode")
/* advanced option only */
#define ENC_VSLICES "vert-slices"
#define ENC_VSLICES_TEXT N_("Vertical slices per frame")
#define ENC_VSLICES_LONGTEXT N_("Number of vertical slices per frame in low delay mode")
/* advanced option only */
#define ENC_SCBLK_SIZE "codeblock-size"
#define ENC_SCBLK_SIZE_TEXT N_("Size of code blocks in each subband")
static const char *enc_codeblock_size_list[] = {
"automatic",
"small",
"medium",
"large",
"full"
};
static const char *const enc_codeblock_size_list_text[] =
{ N_("automatic - let encoder decide based upon input (Best)"),
N_("small - use small code blocks"),
N_("medium - use medium sized code blocks"),
N_("large - use large code blocks"),
N_("full - One code block per subband"),
};
/* advanced option only */
#define ENC_ME_HIERARCHICAL "enable-hierarchical-me"
#define ENC_ME_HIERARCHICAL_TEXT N_("Enable hierarchical Motion Estimation")
/* advanced option only */
#define ENC_ME_DOWNSAMPLE_LEVELS "downsample-levels"
#define ENC_ME_DOWNSAMPLE_LEVELS_TEXT N_("Number of levels of downsampling")
#define ENC_ME_DOWNSAMPLE_LEVELS_LONGTEXT N_("Number of levels of downsampling in hierarchical motion estimation mode")
/* advanced option only */
#define ENC_ME_GLOBAL_MOTION "enable-global-me"
#define ENC_ME_GLOBAL_MOTION_TEXT N_("Enable Global Motion Estimation")
/* advanced option only */
#define ENC_ME_PHASECORR "enable-phasecorr-me"
#define ENC_ME_PHASECORR_TEXT N_("Enable Phase Correlation Estimation")
/* advanced option only */
#define ENC_SCD "enable-scd"
#define ENC_SCD_TEXT N_("Enable Scene Change Detection")
/* advanced option only */
#define ENC_FORCE_PROFILE "force-profile"
#define ENC_FORCE_PROFILE_TEXT N_("Force Profile")
static const char *enc_profile_list[] = {
"auto",
"vc2_low_delay",
"vc2_simple",
"vc2_main",
"main"
};
static const char *const enc_profile_list_text[] =
{ N_("automatic - let encoder decide based upon input (Best)"),
N_("VC2 Low Delay Profile"),
N_("VC2 Simple Profile"),
N_("VC2 Main Profile"),
N_("Main Profile"),
};
static const char *const ppsz_enc_options[] = {
ENC_RATE_CONTROL, ENC_GOP_STRUCTURE, ENC_QUALITY, ENC_NOISE_THRESHOLD, ENC_BITRATE,
ENC_MIN_BITRATE, ENC_MAX_BITRATE, ENC_AU_DISTANCE, ENC_CHROMAFMT,
ENC_PREFILTER, ENC_PREFILTER_STRENGTH, ENC_CODINGMODE, ENC_MCBLK_SIZE,
ENC_MCBLK_OVERLAP, ENC_MVPREC, ENC_ME_COMBINED, ENC_DWTINTRA, ENC_DWTINTER,
ENC_DWTDEPTH, ENC_MULTIQUANT, ENC_NOAC, ENC_PWT, ENC_PDIST, ENC_HSLICES,
ENC_VSLICES, ENC_SCBLK_SIZE, ENC_ME_HIERARCHICAL, ENC_ME_DOWNSAMPLE_LEVELS,
ENC_ME_GLOBAL_MOTION, ENC_ME_PHASECORR, ENC_SCD, ENC_FORCE_PROFILE,
NULL
};
/* Module declaration */
vlc_module_begin ()
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_VCODEC )
set_shortname( "Schroedinger" )
set_description( N_("Dirac video decoder using libschroedinger") )
set_capability( "decoder", 200 )
set_callbacks( OpenDecoder, CloseDecoder )
add_shortcut( "schroedinger" )
/* encoder */
add_submodule()
set_section( N_("Encoding") , NULL )
set_description( N_("Dirac video encoder using libschroedinger") )
set_capability( "encoder", 110 )
set_callbacks( OpenEncoder, CloseEncoder )
add_shortcut( "schroedinger", "schro" )
add_string( ENC_CFG_PREFIX ENC_RATE_CONTROL, NULL,
ENC_RATE_CONTROL_TEXT, ENC_RATE_CONTROL_LONGTEXT, false )
change_string_list( enc_rate_control_list, enc_rate_control_list_text )
add_float( ENC_CFG_PREFIX ENC_QUALITY, -1.,
ENC_QUALITY_TEXT, ENC_QUALITY_LONGTEXT, false )
change_float_range(-1., 10.);
add_float( ENC_CFG_PREFIX ENC_NOISE_THRESHOLD, -1.,
ENC_NOISE_THRESHOLD_TEXT, ENC_NOISE_THRESHOLD_LONGTEXT, false )
change_float_range(-1., 100.);
add_integer( ENC_CFG_PREFIX ENC_BITRATE, -1,
ENC_BITRATE_TEXT, ENC_BITRATE_LONGTEXT, false )
change_integer_range(-1, INT_MAX);
add_integer( ENC_CFG_PREFIX ENC_MAX_BITRATE, -1,
ENC_MAX_BITRATE_TEXT, ENC_MAX_BITRATE_LONGTEXT, false )
change_integer_range(-1, INT_MAX);
add_integer( ENC_CFG_PREFIX ENC_MIN_BITRATE, -1,
ENC_MIN_BITRATE_TEXT, ENC_MIN_BITRATE_LONGTEXT, false )
change_integer_range(-1, INT_MAX);
add_string( ENC_CFG_PREFIX ENC_GOP_STRUCTURE, NULL,
ENC_GOP_STRUCTURE_TEXT, ENC_GOP_STRUCTURE_LONGTEXT, false )
change_string_list( enc_gop_structure_list, enc_gop_structure_list_text )
add_integer( ENC_CFG_PREFIX ENC_AU_DISTANCE, -1,
ENC_AU_DISTANCE_TEXT, ENC_AU_DISTANCE_LONGTEXT, false )
change_integer_range(-1, INT_MAX);
add_string( ENC_CFG_PREFIX ENC_CHROMAFMT, "420",
ENC_CHROMAFMT_TEXT, ENC_CHROMAFMT_LONGTEXT, false )
change_string_list( enc_chromafmt_list, enc_chromafmt_list_text )
add_string( ENC_CFG_PREFIX ENC_CODINGMODE, "auto",
ENC_CODINGMODE_TEXT, ENC_CODINGMODE_LONGTEXT, false )
change_string_list( enc_codingmode_list, enc_codingmode_list_text )
add_string( ENC_CFG_PREFIX ENC_MVPREC, NULL,
ENC_MVPREC_TEXT, ENC_MVPREC_LONGTEXT, false )
change_string_list( enc_mvprec_list, enc_mvprec_list )
/* advanced option only */
add_string( ENC_CFG_PREFIX ENC_MCBLK_SIZE, NULL,
ENC_MCBLK_SIZE_TEXT, ENC_MCBLK_SIZE_TEXT, true )
change_string_list( enc_block_size_list, enc_block_size_list_text )
/* advanced option only */
add_string( ENC_CFG_PREFIX ENC_MCBLK_OVERLAP, NULL,
ENC_MCBLK_OVERLAP_TEXT, ENC_MCBLK_OVERLAP_TEXT, true )
change_string_list( enc_block_overlap_list, enc_block_overlap_list_text )
/* advanced option only */
add_integer( ENC_CFG_PREFIX ENC_ME_COMBINED, -1,
ENC_ME_COMBINED_TEXT, ENC_ME_COMBINED_LONGTEXT, true )
change_integer_range(-1, 1 );
/* advanced option only */
add_integer( ENC_CFG_PREFIX ENC_ME_HIERARCHICAL, -1,
ENC_ME_HIERARCHICAL_TEXT, ENC_ME_HIERARCHICAL_TEXT, true )
change_integer_range(-1, 1 );
/* advanced option only */
add_integer( ENC_CFG_PREFIX ENC_ME_DOWNSAMPLE_LEVELS, -1,
ENC_ME_DOWNSAMPLE_LEVELS_TEXT, ENC_ME_DOWNSAMPLE_LEVELS_LONGTEXT, true )
change_integer_range(-1, 8 );
/* advanced option only */
add_integer( ENC_CFG_PREFIX ENC_ME_GLOBAL_MOTION, -1,
ENC_ME_GLOBAL_MOTION_TEXT, ENC_ME_GLOBAL_MOTION_TEXT, true )
change_integer_range(-1, 1 );
/* advanced option only */
add_integer( ENC_CFG_PREFIX ENC_ME_PHASECORR, -1,
ENC_ME_PHASECORR_TEXT, ENC_ME_PHASECORR_TEXT, true )
change_integer_range(-1, 1 );
add_string( ENC_CFG_PREFIX ENC_DWTINTRA, NULL,
ENC_DWTINTRA_TEXT, ENC_DWTINTRA_TEXT, false )
change_string_list( enc_wavelet_list, enc_wavelet_list_text )
add_string( ENC_CFG_PREFIX ENC_DWTINTER, NULL,
ENC_DWTINTER_TEXT, ENC_DWTINTER_TEXT, false )
change_string_list( enc_wavelet_list, enc_wavelet_list_text )
add_integer( ENC_CFG_PREFIX ENC_DWTDEPTH, -1,
ENC_DWTDEPTH_TEXT, ENC_DWTDEPTH_LONGTEXT, false )
change_integer_range(-1, SCHRO_LIMIT_ENCODER_TRANSFORM_DEPTH );
/* advanced option only */
add_integer( ENC_CFG_PREFIX ENC_MULTIQUANT, -1,
ENC_MULTIQUANT_TEXT, ENC_MULTIQUANT_LONGTEXT, true )
change_integer_range(-1, 1 );
/* advanced option only */
add_string( ENC_CFG_PREFIX ENC_SCBLK_SIZE, NULL,
ENC_SCBLK_SIZE_TEXT, ENC_SCBLK_SIZE_TEXT, true )
change_string_list( enc_codeblock_size_list, enc_codeblock_size_list_text )
add_string( ENC_CFG_PREFIX ENC_PREFILTER, NULL,
ENC_PREFILTER_TEXT, ENC_PREFILTER_LONGTEXT, false )
change_string_list( enc_filtering_list, enc_filtering_list_text )
add_float( ENC_CFG_PREFIX ENC_PREFILTER_STRENGTH, -1.,
ENC_PREFILTER_STRENGTH_TEXT, ENC_PREFILTER_STRENGTH_LONGTEXT, false )
change_float_range(-1., 100.0);
/* advanced option only */
add_integer( ENC_CFG_PREFIX ENC_SCD, -1,
ENC_SCD_TEXT, ENC_SCD_TEXT, true )
change_integer_range(-1, 1 );
/* advanced option only */
add_string( ENC_CFG_PREFIX ENC_PWT, NULL,
ENC_PWT_TEXT, ENC_PWT_TEXT, true )
change_string_list( enc_perceptual_weighting_list, enc_perceptual_weighting_list )
/* advanced option only */
add_float( ENC_CFG_PREFIX ENC_PDIST, -1,
ENC_PDIST_TEXT, ENC_PDIST_LONGTEXT, true )
change_float_range(-1., 100.);
/* advanced option only */
add_integer( ENC_CFG_PREFIX ENC_NOAC, -1,
ENC_NOAC_TEXT, ENC_NOAC_LONGTEXT, true )
change_integer_range(-1, 1 );
/* advanced option only */
add_integer( ENC_CFG_PREFIX ENC_HSLICES, -1,
ENC_HSLICES_TEXT, ENC_HSLICES_LONGTEXT, true )
change_integer_range(-1, INT_MAX );
/* advanced option only */
add_integer( ENC_CFG_PREFIX ENC_VSLICES, -1,
ENC_VSLICES_TEXT, ENC_VSLICES_LONGTEXT, true )
change_integer_range(-1, INT_MAX );
/* advanced option only */
add_string( ENC_CFG_PREFIX ENC_FORCE_PROFILE, NULL,
ENC_FORCE_PROFILE_TEXT, ENC_FORCE_PROFILE_TEXT, true )
change_string_list( enc_profile_list, enc_profile_list_text )
vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static picture_t *DecodeBlock ( decoder_t *p_dec, block_t **pp_block );
static void Flush( decoder_t * );
struct picture_free_t
{
picture_t *p_pic;
decoder_t *p_dec;
};
/*****************************************************************************
* decoder_sys_t : Schroedinger decoder descriptor
*****************************************************************************/
struct decoder_sys_t
{
/*
* Dirac properties
*/
mtime_t i_lastpts;
mtime_t i_frame_pts_delta;
SchroDecoder *p_schro;
SchroVideoFormat *p_format;
};
/*****************************************************************************
* OpenDecoder: probe the decoder and return score
*****************************************************************************/
static int OpenDecoder( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*)p_this;
decoder_sys_t *p_sys;
SchroDecoder *p_schro;
if( p_dec->fmt_in.i_codec != VLC_CODEC_DIRAC )
{
return VLC_EGENERIC;
}
/* Allocate the memory needed to store the decoder's structure */
p_sys = malloc(sizeof(decoder_sys_t));
if( p_sys == NULL )
return VLC_ENOMEM;
/* Initialise the schroedinger (and hence liboil libraries */
/* This does no allocation and is safe to call */
schro_init();
/* Initialise the schroedinger decoder */
if( !(p_schro = schro_decoder_new()) )
{
free( p_sys );
return VLC_EGENERIC;
}
p_dec->p_sys = p_sys;
p_sys->p_schro = p_schro;
p_sys->p_format = NULL;
p_sys->i_lastpts = VLC_TS_INVALID;
p_sys->i_frame_pts_delta = 0;
/* Set output properties */
p_dec->fmt_out.i_cat = VIDEO_ES;
p_dec->fmt_out.i_codec = VLC_CODEC_I420;
/* Set callbacks */
p_dec->pf_decode_video = DecodeBlock;
p_dec->pf_flush = Flush;
return VLC_SUCCESS;
}
/*****************************************************************************
* SetPictureFormat: Set the decoded picture params to the ones from the stream
*****************************************************************************/
static void SetVideoFormat( decoder_t *p_dec )
{
decoder_sys_t *p_sys = p_dec->p_sys;
p_sys->p_format = schro_decoder_get_video_format(p_sys->p_schro);
if( p_sys->p_format == NULL ) return;
p_sys->i_frame_pts_delta = CLOCK_FREQ
* p_sys->p_format->frame_rate_denominator
/ p_sys->p_format->frame_rate_numerator;
switch( p_sys->p_format->chroma_format )
{
case SCHRO_CHROMA_420: p_dec->fmt_out.i_codec = VLC_CODEC_I420; break;
case SCHRO_CHROMA_422: p_dec->fmt_out.i_codec = VLC_CODEC_I422; break;
case SCHRO_CHROMA_444: p_dec->fmt_out.i_codec = VLC_CODEC_I444; break;
default:
p_dec->fmt_out.i_codec = 0;
break;
}
p_dec->fmt_out.video.i_visible_width = p_sys->p_format->clean_width;
p_dec->fmt_out.video.i_x_offset = p_sys->p_format->left_offset;
p_dec->fmt_out.video.i_width = p_sys->p_format->width;
p_dec->fmt_out.video.i_visible_height = p_sys->p_format->clean_height;
p_dec->fmt_out.video.i_y_offset = p_sys->p_format->top_offset;
p_dec->fmt_out.video.i_height = p_sys->p_format->height;
/* aspect_ratio_[numerator|denominator] describes the pixel aspect ratio */
p_dec->fmt_out.video.i_sar_num = p_sys->p_format->aspect_ratio_numerator;
p_dec->fmt_out.video.i_sar_den = p_sys->p_format->aspect_ratio_denominator;
p_dec->fmt_out.video.i_frame_rate =
p_sys->p_format->frame_rate_numerator;
p_dec->fmt_out.video.i_frame_rate_base =
p_sys->p_format->frame_rate_denominator;
}
/*****************************************************************************
* SchroFrameFree: schro_frame callback to release the associated picture_t
* When schro_decoder_reset() is called there will be pictures in the
* decoding pipeline that need to be released rather than displayed.
*****************************************************************************/
static void SchroFrameFree( SchroFrame *frame, void *priv)
{
struct picture_free_t *p_free = priv;
if( !p_free )
return;
picture_Release( p_free->p_pic );
free(p_free);
(void)frame;
}
/*****************************************************************************
* CreateSchroFrameFromPic: wrap a picture_t in a SchroFrame
*****************************************************************************/
static SchroFrame *CreateSchroFrameFromPic( decoder_t *p_dec )
{
decoder_sys_t *p_sys = p_dec->p_sys;
SchroFrame *p_schroframe = schro_frame_new();
picture_t *p_pic = NULL;
struct picture_free_t *p_free;
if( !p_schroframe )
return NULL;
if( decoder_UpdateVideoFormat( p_dec ) )
return NULL;
p_pic = decoder_NewPicture( p_dec );
if( !p_pic )
return NULL;
p_schroframe->format = SCHRO_FRAME_FORMAT_U8_420;
if( p_sys->p_format->chroma_format == SCHRO_CHROMA_422 )
{
p_schroframe->format = SCHRO_FRAME_FORMAT_U8_422;
}
else if( p_sys->p_format->chroma_format == SCHRO_CHROMA_444 )
{
p_schroframe->format = SCHRO_FRAME_FORMAT_U8_444;
}
p_schroframe->width = p_sys->p_format->width;
p_schroframe->height = p_sys->p_format->height;
p_free = malloc( sizeof( *p_free ) );
p_free->p_pic = p_pic;
p_free->p_dec = p_dec;
schro_frame_set_free_callback( p_schroframe, SchroFrameFree, p_free );
for( int i=0; i<3; i++ )
{
p_schroframe->components[i].width = p_pic->p[i].i_visible_pitch;
p_schroframe->components[i].stride = p_pic->p[i].i_pitch;
p_schroframe->components[i].height = p_pic->p[i].i_visible_lines;
p_schroframe->components[i].length =
p_pic->p[i].i_pitch * p_pic->p[i].i_lines;
p_schroframe->components[i].data = p_pic->p[i].p_pixels;
if(i!=0)
{
p_schroframe->components[i].v_shift =
SCHRO_FRAME_FORMAT_V_SHIFT( p_schroframe->format );
p_schroframe->components[i].h_shift =
SCHRO_FRAME_FORMAT_H_SHIFT( p_schroframe->format );
}
}
p_pic->b_progressive = !p_sys->p_format->interlaced;
p_pic->b_top_field_first = p_sys->p_format->top_field_first;
p_pic->i_nb_fields = 2;
return p_schroframe;
}
/*****************************************************************************
* SchroBufferFree: schro_buffer callback to release the associated block_t
*****************************************************************************/
static void SchroBufferFree( SchroBuffer *buf, void *priv )
{
block_t *p_block = priv;
if( !p_block )
return;
block_Release( p_block );
(void)buf;
}
/*****************************************************************************
* CloseDecoder: decoder destruction
*****************************************************************************/
static void CloseDecoder( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t *)p_this;
decoder_sys_t *p_sys = p_dec->p_sys;
schro_decoder_free( p_sys->p_schro );
free( p_sys );
}
/*****************************************************************************
* Flush:
*****************************************************************************/
static void Flush( decoder_t *p_dec )
{
decoder_sys_t *p_sys = p_dec->p_sys;
schro_decoder_reset( p_sys->p_schro );
p_sys->i_lastpts = VLC_TS_INVALID;
}
/****************************************************************************
* DecodeBlock: the whole thing
****************************************************************************
* Blocks need not be Dirac dataunit aligned.
* If a block has a PTS signaled, it applies to the first picture at or after p_block
*
* If this function returns a picture (!NULL), it is called again and the
* same block is resubmitted. To avoid this, set *pp_block to NULL;
* If this function returns NULL, the *pp_block is lost (and leaked).
* This function must free all blocks when finished with them.
****************************************************************************/
static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{
decoder_sys_t *p_sys = p_dec->p_sys;
if( !pp_block ) return NULL;
if ( *pp_block ) {
block_t *p_block = *pp_block;
/* reset the decoder when seeking as the decode in progress is invalid */
/* discard the block as it is just a null magic block */
if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY | BLOCK_FLAG_CORRUPTED) ) {
Flush( p_dec );
block_Release( p_block );
*pp_block = NULL;
return NULL;
}
SchroBuffer *p_schrobuffer;
p_schrobuffer = schro_buffer_new_with_data( p_block->p_buffer, p_block->i_buffer );
p_schrobuffer->free = SchroBufferFree;
p_schrobuffer->priv = p_block;
if( p_block->i_pts > VLC_TS_INVALID ) {
mtime_t *p_pts = malloc( sizeof(*p_pts) );
if( p_pts ) {
*p_pts = p_block->i_pts;
/* if this call fails, p_pts is freed automatically */
p_schrobuffer->tag = schro_tag_new( p_pts, free );
}
}
/* this stops the same block being fed back into this function if
* we were on the next iteration of this loop to output a picture */
*pp_block = NULL;
schro_decoder_autoparse_push( p_sys->p_schro, p_schrobuffer );
/* DO NOT refer to p_block after this point, it may have been freed */
}
while( 1 )
{
SchroFrame *p_schroframe;
picture_t *p_pic;
int state = schro_decoder_autoparse_wait( p_sys->p_schro );
switch( state )
{
case SCHRO_DECODER_FIRST_ACCESS_UNIT:
SetVideoFormat( p_dec );
break;
case SCHRO_DECODER_NEED_BITS:
return NULL;
case SCHRO_DECODER_NEED_FRAME:
p_schroframe = CreateSchroFrameFromPic( p_dec );
if( !p_schroframe )
{
msg_Err( p_dec, "Could not allocate picture for decoder");
return NULL;
}
schro_decoder_add_output_picture( p_sys->p_schro, p_schroframe);
break;
case SCHRO_DECODER_OK: {
SchroTag *p_tag = schro_decoder_get_picture_tag( p_sys->p_schro );
p_schroframe = schro_decoder_pull( p_sys->p_schro );
if( !p_schroframe || !p_schroframe->priv )
{
/* frame can't be one that was allocated by us
* -- no private data: discard */
if( p_tag ) schro_tag_free( p_tag );
if( p_schroframe ) schro_frame_unref( p_schroframe );
break;
}
p_pic = ((struct picture_free_t*) p_schroframe->priv)->p_pic;
p_schroframe->priv = NULL;
if( p_tag )
{
/* free is handled by schro_frame_unref */
p_pic->date = *(mtime_t*) p_tag->value;
schro_tag_free( p_tag );
}
else if( p_sys->i_lastpts > VLC_TS_INVALID )
{
/* NB, this shouldn't happen since the packetizer does a
* very thorough job of inventing timestamps. The
* following is just a very rough fall back incase packetizer
* is missing. */
/* maybe it would be better to set p_pic->b_force ? */
p_pic->date = p_sys->i_lastpts + p_sys->i_frame_pts_delta;
}
p_sys->i_lastpts = p_pic->date;
schro_frame_unref( p_schroframe );
return p_pic;
}
case SCHRO_DECODER_EOS:
/* NB, the new api will not emit _EOS, it handles the reset internally */
break;
case SCHRO_DECODER_ERROR:
msg_Err( p_dec, "SCHRO_DECODER_ERROR");
return NULL;
}
}
}
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static block_t *Encode( encoder_t *p_enc, picture_t *p_pict );
/*****************************************************************************
* picture_pts_t : store pts alongside picture number, not carried through
* encoder
*****************************************************************************/
struct picture_pts_t
{
mtime_t i_pts; /* associated pts */
uint32_t u_pnum; /* dirac picture number */
bool b_empty; /* entry is invalid */
};
/*****************************************************************************
* encoder_sys_t : Schroedinger encoder descriptor
*****************************************************************************/
#define SCHRO_PTS_TLB_SIZE 256
struct encoder_sys_t
{
/*
* Schro properties
*/
SchroEncoder *p_schro;
SchroVideoFormat *p_format;
int started;
bool b_auto_field_coding;
uint32_t i_input_picnum;
block_fifo_t *p_dts_fifo;
block_t *p_chain;
struct picture_pts_t pts_tlb[SCHRO_PTS_TLB_SIZE];
mtime_t i_pts_offset;
mtime_t i_field_time;
bool b_eos_signalled;
bool b_eos_pulled;
};
static struct
{
unsigned int i_height;
int i_approx_fps;
SchroVideoFormatEnum i_vf;
} schro_format_guess[] = {
/* Important: Keep this list ordered in ascending picture height */
{1, 0, SCHRO_VIDEO_FORMAT_CUSTOM},
{120, 15, SCHRO_VIDEO_FORMAT_QSIF},
{144, 12, SCHRO_VIDEO_FORMAT_QCIF},
{240, 15, SCHRO_VIDEO_FORMAT_SIF},
{288, 12, SCHRO_VIDEO_FORMAT_CIF},
{480, 30, SCHRO_VIDEO_FORMAT_SD480I_60},
{480, 15, SCHRO_VIDEO_FORMAT_4SIF},
{576, 12, SCHRO_VIDEO_FORMAT_4CIF},
{576, 25, SCHRO_VIDEO_FORMAT_SD576I_50},
{720, 50, SCHRO_VIDEO_FORMAT_HD720P_50},
{720, 60, SCHRO_VIDEO_FORMAT_HD720P_60},
{1080, 24, SCHRO_VIDEO_FORMAT_DC2K_24},
{1080, 25, SCHRO_VIDEO_FORMAT_HD1080I_50},
{1080, 30, SCHRO_VIDEO_FORMAT_HD1080I_60},
{1080, 50, SCHRO_VIDEO_FORMAT_HD1080P_50},
{1080, 60, SCHRO_VIDEO_FORMAT_HD1080P_60},
{2160, 24, SCHRO_VIDEO_FORMAT_DC4K_24},
{0, 0, 0},
};
/*****************************************************************************
* ResetPTStlb: Purge all entries in @p_enc@'s PTS-tlb
*****************************************************************************/
static void ResetPTStlb( encoder_t *p_enc )
{
encoder_sys_t *p_sys = p_enc->p_sys;
for( int i = 0; i < SCHRO_PTS_TLB_SIZE; i++ )
{
p_sys->pts_tlb[i].b_empty = true;
}
}
/*****************************************************************************
* StorePicturePTS: Store the PTS value for a particular picture number
*****************************************************************************/
static void StorePicturePTS( encoder_t *p_enc, uint32_t u_pnum, mtime_t i_pts )
{
encoder_sys_t *p_sys = p_enc->p_sys;
for( int i = 0; i<SCHRO_PTS_TLB_SIZE; i++ )
{
if( p_sys->pts_tlb[i].b_empty )
{
p_sys->pts_tlb[i].u_pnum = u_pnum;
p_sys->pts_tlb[i].i_pts = i_pts;
p_sys->pts_tlb[i].b_empty = false;
return;
}
}
msg_Err( p_enc, "Could not store PTS %"PRId64" for frame %u", i_pts, u_pnum );
}
/*****************************************************************************
* GetPicturePTS: Retrieve the PTS value for a particular picture number
*****************************************************************************/
static mtime_t GetPicturePTS( encoder_t *p_enc, uint32_t u_pnum )
{
encoder_sys_t *p_sys = p_enc->p_sys;
for( int i = 0; i < SCHRO_PTS_TLB_SIZE; i++ )
{
if( !p_sys->pts_tlb[i].b_empty &&
p_sys->pts_tlb[i].u_pnum == u_pnum )
{
p_sys->pts_tlb[i].b_empty = true;
return p_sys->pts_tlb[i].i_pts;
}
}
msg_Err( p_enc, "Could not retrieve PTS for picture %u", u_pnum );
return 0;
}
static inline bool SchroSetEnum( const encoder_t *p_enc, int i_list_size, const char *list[],
const char *psz_name, const char *psz_name_text, const char *psz_value)
{
encoder_sys_t *p_sys = p_enc->p_sys;
if( list && psz_name_text && psz_name && psz_value ) {
for( int i = 0; i < i_list_size; ++i ) {
if( strcmp( list[i], psz_value ) )
continue;
schro_encoder_setting_set_double( p_sys->p_schro, psz_name, i );
return true;
}
msg_Err( p_enc, "Invalid %s: %s", psz_name_text, psz_value );
}
return false;
}
static bool SetEncChromaFormat( encoder_t *p_enc, uint32_t i_codec )
{
encoder_sys_t *p_sys = p_enc->p_sys;
switch( i_codec ) {
case VLC_CODEC_I420:
p_enc->fmt_in.i_codec = i_codec;
p_enc->fmt_in.video.i_bits_per_pixel = 12;
p_sys->p_format->chroma_format = SCHRO_CHROMA_420;
break;
case VLC_CODEC_I422:
p_enc->fmt_in.i_codec = i_codec;
p_enc->fmt_in.video.i_bits_per_pixel = 16;
p_sys->p_format->chroma_format = SCHRO_CHROMA_422;
break;
case VLC_CODEC_I444:
p_enc->fmt_in.i_codec = i_codec;
p_enc->fmt_in.video.i_bits_per_pixel = 24;
p_sys->p_format->chroma_format = SCHRO_CHROMA_444;
break;
default:
return false;
}
return true;
}
#define SCHRO_SET_FLOAT(psz_name, pschro_name) \
f_tmp = var_GetFloat( p_enc, ENC_CFG_PREFIX psz_name ); \
if( f_tmp >= 0.0 ) \
schro_encoder_setting_set_double( p_sys->p_schro, pschro_name, f_tmp );
#define SCHRO_SET_INTEGER(psz_name, pschro_name, ignore_val) \
i_tmp = var_GetInteger( p_enc, ENC_CFG_PREFIX psz_name ); \
if( i_tmp > ignore_val ) \
schro_encoder_setting_set_double( p_sys->p_schro, pschro_name, i_tmp );
#define SCHRO_SET_ENUM(list, psz_name, psz_name_text, pschro_name) \
psz_tmp = var_GetString( p_enc, ENC_CFG_PREFIX psz_name ); \
if( !psz_tmp ) \
goto error; \
else if ( *psz_tmp != '\0' ) { \
int i_list_size = ARRAY_SIZE(list); \
if( !SchroSetEnum( p_enc, i_list_size, list, pschro_name, psz_name_text, psz_tmp ) ) { \
free( psz_tmp ); \
goto error; \
} \
} \
free( psz_tmp );
/*****************************************************************************
* OpenEncoder: probe the encoder and return score
*****************************************************************************/
static int OpenEncoder( vlc_object_t *p_this )
{
encoder_t *p_enc = (encoder_t *)p_this;
encoder_sys_t *p_sys;
int i_tmp;
float f_tmp;
char *psz_tmp;
if( p_enc->fmt_out.i_codec != VLC_CODEC_DIRAC &&
!p_enc->obj.force )
{
return VLC_EGENERIC;
}
if( !p_enc->fmt_in.video.i_frame_rate || !p_enc->fmt_in.video.i_frame_rate_base ||
!p_enc->fmt_in.video.i_visible_height || !p_enc->fmt_in.video.i_visible_width )
{
msg_Err( p_enc, "Framerate and picture dimensions must be non-zero" );
return VLC_EGENERIC;
}
/* Allocate the memory needed to store the decoder's structure */
if( ( p_sys = calloc( 1, sizeof( *p_sys ) ) ) == NULL )
return VLC_ENOMEM;
p_enc->p_sys = p_sys;
p_enc->pf_encode_video = Encode;
p_enc->fmt_out.i_codec = VLC_CODEC_DIRAC;
p_enc->fmt_out.i_cat = VIDEO_ES;
if( ( p_sys->p_dts_fifo = block_FifoNew() ) == NULL )
{
CloseEncoder( p_this );
return VLC_ENOMEM;
}
ResetPTStlb( p_enc );
/* guess the video format based upon number of lines and picture height */
int i = 0;
SchroVideoFormatEnum guessed_video_fmt = SCHRO_VIDEO_FORMAT_CUSTOM;
/* Pick the dirac_video_format in this order of preference:
* 1. an exact match in frame height and an approximate fps match
* 2. the previous preset with a smaller number of lines.
*/
do
{
if( schro_format_guess[i].i_height > p_enc->fmt_in.video.i_height )
{
guessed_video_fmt = schro_format_guess[i-1].i_vf;
break;
}
if( schro_format_guess[i].i_height != p_enc->fmt_in.video.i_height )
continue;
int src_fps = p_enc->fmt_in.video.i_frame_rate / p_enc->fmt_in.video.i_frame_rate_base;
int delta_fps = abs( schro_format_guess[i].i_approx_fps - src_fps );
if( delta_fps > 2 )
continue;
guessed_video_fmt = schro_format_guess[i].i_vf;
break;
} while( schro_format_guess[++i].i_height );
schro_init();
p_sys->p_schro = schro_encoder_new();
if( !p_sys->p_schro ) {
msg_Err( p_enc, "Failed to initialize libschroedinger encoder" );
return VLC_EGENERIC;
}
schro_encoder_set_packet_assembly( p_sys->p_schro, true );
if( !( p_sys->p_format = schro_encoder_get_video_format( p_sys->p_schro ) ) ) {
msg_Err( p_enc, "Failed to get Schroedigner video format" );
schro_encoder_free( p_sys->p_schro );
return VLC_EGENERIC;
}
/* initialise the video format parameters to the guessed format */
schro_video_format_set_std_video_format( p_sys->p_format, guessed_video_fmt );
/* constants set from the input video format */
p_sys->p_format->width = p_enc->fmt_in.video.i_visible_width;
p_sys->p_format->height = p_enc->fmt_in.video.i_visible_height;
p_sys->p_format->frame_rate_numerator = p_enc->fmt_in.video.i_frame_rate;
p_sys->p_format->frame_rate_denominator = p_enc->fmt_in.video.i_frame_rate_base;
unsigned u_asr_num, u_asr_den;
vlc_ureduce( &u_asr_num, &u_asr_den,
p_enc->fmt_in.video.i_sar_num,
p_enc->fmt_in.video.i_sar_den, 0 );
p_sys->p_format->aspect_ratio_numerator = u_asr_num;
p_sys->p_format->aspect_ratio_denominator = u_asr_den;
config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
SCHRO_SET_ENUM(enc_rate_control_list, ENC_RATE_CONTROL, ENC_RATE_CONTROL_TEXT, "rate_control")
SCHRO_SET_ENUM(enc_gop_structure_list, ENC_GOP_STRUCTURE, ENC_GOP_STRUCTURE_TEXT, "gop_structure")
psz_tmp = var_GetString( p_enc, ENC_CFG_PREFIX ENC_CHROMAFMT );
if( !psz_tmp )
goto error;
else {
uint32_t i_codec;
if( !strcmp( psz_tmp, "420" ) ) {
i_codec = VLC_CODEC_I420;
}
else if( !strcmp( psz_tmp, "422" ) ) {
i_codec = VLC_CODEC_I422;
}
else if( !strcmp( psz_tmp, "444" ) ) {
i_codec = VLC_CODEC_I444;
}
else {
msg_Err( p_enc, "Invalid chroma format: %s", psz_tmp );
free( psz_tmp );
goto error;
}
SetEncChromaFormat( p_enc, i_codec );
}
free( psz_tmp );
SCHRO_SET_FLOAT(ENC_QUALITY, "quality")
SCHRO_SET_FLOAT(ENC_NOISE_THRESHOLD, "noise_threshold")
/* use bitrate from sout-transcode-vb in kbps */
i_tmp = var_GetInteger( p_enc, ENC_CFG_PREFIX ENC_BITRATE );
if( i_tmp > -1 )
schro_encoder_setting_set_double( p_sys->p_schro, "bitrate", i_tmp * 1000 );
else
schro_encoder_setting_set_double( p_sys->p_schro, "bitrate", p_enc->fmt_out.i_bitrate );
p_enc->fmt_out.i_bitrate = schro_encoder_setting_get_double( p_sys->p_schro, "bitrate" );
i_tmp = var_GetInteger( p_enc, ENC_CFG_PREFIX ENC_MIN_BITRATE );
if( i_tmp > -1 )
schro_encoder_setting_set_double( p_sys->p_schro, "min_bitrate", i_tmp * 1000 );
i_tmp = var_GetInteger( p_enc, ENC_CFG_PREFIX ENC_MAX_BITRATE );
if( i_tmp > -1 )
schro_encoder_setting_set_double( p_sys->p_schro, "max_bitrate", i_tmp * 1000 );
SCHRO_SET_INTEGER(ENC_AU_DISTANCE, "au_distance", -1)
SCHRO_SET_ENUM(enc_filtering_list, ENC_PREFILTER, ENC_PREFILTER_TEXT, "filtering")
SCHRO_SET_FLOAT(ENC_PREFILTER_STRENGTH, "filter_value")
psz_tmp = var_GetString( p_enc, ENC_CFG_PREFIX ENC_CODINGMODE );
if( !psz_tmp )
goto error;
else if( !strcmp( psz_tmp, "auto" ) ) {
p_sys->b_auto_field_coding = true;
}
else if( !strcmp( psz_tmp, "progressive" ) ) {
p_sys->b_auto_field_coding = false;
schro_encoder_setting_set_double( p_sys->p_schro, "interlaced_coding", false);
}
else if( !strcmp( psz_tmp, "field" ) ) {
p_sys->b_auto_field_coding = false;
schro_encoder_setting_set_double( p_sys->p_schro, "interlaced_coding", true);
}
else {
msg_Err( p_enc, "Invalid codingmode: %s", psz_tmp );
free( psz_tmp );
goto error;
}
free( psz_tmp );
SCHRO_SET_ENUM(enc_block_size_list, ENC_MCBLK_SIZE, ENC_MCBLK_SIZE_TEXT, "motion_block_size")
SCHRO_SET_ENUM(enc_block_overlap_list, ENC_MCBLK_OVERLAP, ENC_MCBLK_OVERLAP_TEXT, "motion_block_overlap")
psz_tmp = var_GetString( p_enc, ENC_CFG_PREFIX ENC_MVPREC );
if( !psz_tmp )
goto error;
else if( *psz_tmp != '\0') {
if( !strcmp( psz_tmp, "1" ) ) {
schro_encoder_setting_set_double( p_sys->p_schro, "mv_precision", 0 );
}
else if( !strcmp( psz_tmp, "1/2" ) ) {
schro_encoder_setting_set_double( p_sys->p_schro, "mv_precision", 1 );
}
else if( !strcmp( psz_tmp, "1/4" ) ) {
schro_encoder_setting_set_double( p_sys->p_schro, "mv_precision", 2 );
}
else if( !strcmp( psz_tmp, "1/8" ) ) {
schro_encoder_setting_set_double( p_sys->p_schro, "mv_precision", 3 );
}
else {
msg_Err( p_enc, "Invalid mv_precision: %s", psz_tmp );
free( psz_tmp );
goto error;
}
}
free( psz_tmp );
SCHRO_SET_INTEGER(ENC_ME_COMBINED, "enable_chroma_me", -1)
SCHRO_SET_ENUM(enc_wavelet_list, ENC_DWTINTRA, ENC_DWTINTRA_TEXT, "intra_wavelet")
SCHRO_SET_ENUM(enc_wavelet_list, ENC_DWTINTER, ENC_DWTINTER_TEXT, "inter_wavelet")
SCHRO_SET_INTEGER(ENC_DWTDEPTH, "transform_depth", -1)
SCHRO_SET_INTEGER(ENC_MULTIQUANT, "enable_multiquant", -1)
SCHRO_SET_INTEGER(ENC_NOAC, "enable_noarith", -1)
SCHRO_SET_ENUM(enc_perceptual_weighting_list, ENC_PWT, ENC_PWT_TEXT, "perceptual_weighting")
SCHRO_SET_FLOAT(ENC_PDIST, "perceptual_distance")
SCHRO_SET_INTEGER(ENC_HSLICES, "horiz_slices", -1)
SCHRO_SET_INTEGER(ENC_VSLICES, "vert_slices", -1)
SCHRO_SET_ENUM(enc_codeblock_size_list, ENC_SCBLK_SIZE, ENC_SCBLK_SIZE_TEXT, "codeblock_size")
SCHRO_SET_INTEGER(ENC_ME_HIERARCHICAL, "enable_hierarchical_estimation", -1)
SCHRO_SET_INTEGER(ENC_ME_DOWNSAMPLE_LEVELS, "downsample_levels", 1)
SCHRO_SET_INTEGER(ENC_ME_GLOBAL_MOTION, "enable_global_motion", -1)
SCHRO_SET_INTEGER(ENC_ME_PHASECORR, "enable_phasecorr_estimation", -1)
SCHRO_SET_INTEGER(ENC_SCD, "enable_scene_change_detection", -1)
SCHRO_SET_ENUM(enc_profile_list, ENC_FORCE_PROFILE, ENC_FORCE_PROFILE_TEXT, "force_profile")
p_sys->started = 0;
return VLC_SUCCESS;
error:
CloseEncoder( p_this );
return VLC_EGENERIC;
}
struct enc_picture_free_t
{
picture_t *p_pic;
encoder_t *p_enc;
};
/*****************************************************************************
* EncSchroFrameFree: schro_frame callback to release the associated picture_t
* When schro_encoder_reset() is called there will be pictures in the
* encoding pipeline that need to be released rather than displayed.
*****************************************************************************/
static void EncSchroFrameFree( SchroFrame *frame, void *priv )
{
struct enc_picture_free_t *p_free = priv;
if( !p_free )
return;
picture_Release( p_free->p_pic );
free( p_free );
(void)frame;
}
/*****************************************************************************
* CreateSchroFrameFromPic: wrap a picture_t in a SchroFrame
*****************************************************************************/
static SchroFrame *CreateSchroFrameFromInputPic( encoder_t *p_enc, picture_t *p_pic )
{
encoder_sys_t *p_sys = p_enc->p_sys;
SchroFrame *p_schroframe = schro_frame_new();
struct enc_picture_free_t *p_free;
if( !p_schroframe )
return NULL;
if( !p_pic )
return NULL;
p_schroframe->format = SCHRO_FRAME_FORMAT_U8_420;
if( p_sys->p_format->chroma_format == SCHRO_CHROMA_422 )
{
p_schroframe->format = SCHRO_FRAME_FORMAT_U8_422;
}
else if( p_sys->p_format->chroma_format == SCHRO_CHROMA_444 )
{
p_schroframe->format = SCHRO_FRAME_FORMAT_U8_444;
}
p_schroframe->width = p_sys->p_format->width;
p_schroframe->height = p_sys->p_format->height;
p_free = malloc( sizeof( *p_free ) );
if( unlikely( p_free == NULL ) ) {
schro_frame_unref( p_schroframe );
return NULL;
}
p_free->p_pic = p_pic;
p_free->p_enc = p_enc;
schro_frame_set_free_callback( p_schroframe, EncSchroFrameFree, p_free );
for( int i=0; i<3; i++ )
{
p_schroframe->components[i].width = p_pic->p[i].i_visible_pitch;
p_schroframe->components[i].stride = p_pic->p[i].i_pitch;
p_schroframe->components[i].height = p_pic->p[i].i_visible_lines;
p_schroframe->components[i].length =
p_pic->p[i].i_pitch * p_pic->p[i].i_lines;
p_schroframe->components[i].data = p_pic->p[i].p_pixels;
if( i!=0 )
{
p_schroframe->components[i].v_shift =
SCHRO_FRAME_FORMAT_V_SHIFT( p_schroframe->format );
p_schroframe->components[i].h_shift =
SCHRO_FRAME_FORMAT_H_SHIFT( p_schroframe->format );
}
}
return p_schroframe;
}
/* Attempt to find dirac picture number in an encapsulation unit */
static int ReadDiracPictureNumber( uint32_t *p_picnum, block_t *p_block )
{
uint32_t u_pos = 4;
/* protect against falling off the edge */
while( u_pos + 13 < p_block->i_buffer )
{
/* find the picture startcode */
if( p_block->p_buffer[u_pos] & 0x08 )
{
*p_picnum = GetDWBE( p_block->p_buffer + u_pos + 9 );
return 1;
}
/* skip to the next dirac data unit */
uint32_t u_npo = GetDWBE( p_block->p_buffer + u_pos + 1 );
assert( u_npo <= UINT32_MAX - u_pos );
if( u_npo == 0 )
u_npo = 13;
u_pos += u_npo;
}
return 0;
}
static block_t *Encode( encoder_t *p_enc, picture_t *p_pic )
{
encoder_sys_t *p_sys = p_enc->p_sys;
block_t *p_block, *p_output_chain = NULL;
SchroFrame *p_frame;
bool b_go = true;
if( !p_pic ) {
if( !p_sys->started || p_sys->b_eos_pulled )
return NULL;
if( !p_sys->b_eos_signalled ) {
p_sys->b_eos_signalled = 1;
schro_encoder_end_of_stream( p_sys->p_schro );
}
} else {
/* we only know if the sequence is interlaced when the first
* picture arrives, so final setup is done here */
/* XXX todo, detect change of interlace */
p_sys->p_format->interlaced = !p_pic->b_progressive;
p_sys->p_format->top_field_first = p_pic->b_top_field_first;
if( p_sys->b_auto_field_coding )
schro_encoder_setting_set_double( p_sys->p_schro, "interlaced_coding", !p_pic->b_progressive );
}
if( !p_sys->started ) {
date_t date;
if( p_pic->format.i_chroma != p_enc->fmt_in.i_codec ) {
char chroma_in[5], chroma_out[5];
vlc_fourcc_to_char( p_pic->format.i_chroma, chroma_in );
chroma_in[4] = '\0';
chroma_out[4] = '\0';
vlc_fourcc_to_char( p_enc->fmt_in.i_codec, chroma_out );
msg_Warn( p_enc, "Resetting chroma from %s to %s", chroma_out, chroma_in );
if( !SetEncChromaFormat( p_enc, p_pic->format.i_chroma ) ) {
msg_Err( p_enc, "Could not reset chroma format to %s", chroma_in );
return NULL;
}
}
date_Init( &date, p_enc->fmt_in.video.i_frame_rate, p_enc->fmt_in.video.i_frame_rate_base );
/* FIXME - Unlike dirac-research codec Schro doesn't have a function that returns the delay in pics yet.
* Use a default of 1
*/
date_Increment( &date, 1 );
p_sys->i_pts_offset = date_Get( &date );
if( schro_encoder_setting_get_double( p_sys->p_schro, "interlaced_coding" ) > 0.0 ) {
date_Set( &date, 0 );
date_Increment( &date, 1);
p_sys->i_field_time = date_Get( &date ) / 2;
}
schro_video_format_set_std_signal_range( p_sys->p_format, SCHRO_SIGNAL_RANGE_8BIT_VIDEO );
schro_encoder_set_video_format( p_sys->p_schro, p_sys->p_format );
schro_encoder_start( p_sys->p_schro );
p_sys->started = 1;
}
if( !p_sys->b_eos_signalled ) {
/* create a schro frame from the input pic and load */
/* Increase ref count by 1 so that the picture is not freed until
Schro finishes with it */
picture_Hold( p_pic );
p_frame = CreateSchroFrameFromInputPic( p_enc, p_pic );
if( !p_frame )
return NULL;
schro_encoder_push_frame( p_sys->p_schro, p_frame );
/* store pts in a lookaside buffer, so that the same pts may
* be used for the picture in coded order */
StorePicturePTS( p_enc, p_sys->i_input_picnum, p_pic->date );
p_sys->i_input_picnum++;
/* store dts in a queue, so that they appear in order in
* coded order */
p_block = block_Alloc( 1 );
if( !p_block )
return NULL;
p_block->i_dts = p_pic->date - p_sys->i_pts_offset;
block_FifoPut( p_sys->p_dts_fifo, p_block );
p_block = NULL;
/* for field coding mode, insert an extra value into both the
* pts lookaside buffer and dts queue, offset to correspond
* to a one field delay. */
if( schro_encoder_setting_get_double( p_sys->p_schro, "interlaced_coding" ) > 0.0 ) {
StorePicturePTS( p_enc, p_sys->i_input_picnum, p_pic->date + p_sys->i_field_time );
p_sys->i_input_picnum++;
p_block = block_Alloc( 1 );
if( !p_block )
return NULL;
p_block->i_dts = p_pic->date - p_sys->i_pts_offset + p_sys->i_field_time;
block_FifoPut( p_sys->p_dts_fifo, p_block );
p_block = NULL;
}
}
do
{
SchroStateEnum state;
state = schro_encoder_wait( p_sys->p_schro );
switch( state )
{
case SCHRO_STATE_NEED_FRAME:
b_go = false;
break;
case SCHRO_STATE_AGAIN:
break;
case SCHRO_STATE_END_OF_STREAM:
p_sys->b_eos_pulled = 1;
b_go = false;
break;
case SCHRO_STATE_HAVE_BUFFER:
{
SchroBuffer *p_enc_buf;
uint32_t u_pic_num;
int i_presentation_frame;
p_enc_buf = schro_encoder_pull( p_sys->p_schro, &i_presentation_frame );
p_block = block_Alloc( p_enc_buf->length );
if( !p_block )
return NULL;
memcpy( p_block->p_buffer, p_enc_buf->data, p_enc_buf->length );
schro_buffer_unref( p_enc_buf );
/* Presence of a Sequence header indicates a seek point */
if( 0 == p_block->p_buffer[4] )
{
p_block->i_flags |= BLOCK_FLAG_TYPE_I;
if( !p_enc->fmt_out.p_extra ) {
const uint8_t eos[] = { 'B','B','C','D',0x10,0,0,0,13,0,0,0,0 };
uint32_t len = GetDWBE( p_block->p_buffer + 5 );
/* if it hasn't been done so far, stash a copy of the
* sequence header for muxers such as ogg */
/* The OggDirac spec advises that a Dirac EOS DataUnit
* is appended to the sequence header to allow guard
* against poor streaming servers */
/* XXX, should this be done using the packetizer ? */
if( len > UINT32_MAX - sizeof( eos ) )
return NULL;
p_enc->fmt_out.p_extra = malloc( len + sizeof( eos ) );
if( !p_enc->fmt_out.p_extra )
return NULL;
memcpy( p_enc->fmt_out.p_extra, p_block->p_buffer, len );
memcpy( (uint8_t*)p_enc->fmt_out.p_extra + len, eos, sizeof( eos ) );
SetDWBE( (uint8_t*)p_enc->fmt_out.p_extra + len + sizeof(eos) - 4, len );
p_enc->fmt_out.i_extra = len + sizeof( eos );
}
}
if( ReadDiracPictureNumber( &u_pic_num, p_block ) ) {
block_t *p_dts_block = block_FifoGet( p_sys->p_dts_fifo );
p_block->i_dts = p_dts_block->i_dts;
p_block->i_pts = GetPicturePTS( p_enc, u_pic_num );
block_Release( p_dts_block );
block_ChainAppend( &p_output_chain, p_block );
} else {
/* End of sequence */
block_ChainAppend( &p_output_chain, p_block );
}
break;
}
default:
break;
}
} while( b_go );
return p_output_chain;
}
/*****************************************************************************
* CloseEncoder: Schro encoder destruction
*****************************************************************************/
static void CloseEncoder( vlc_object_t *p_this )
{
encoder_t *p_enc = (encoder_t *)p_this;
encoder_sys_t *p_sys = p_enc->p_sys;
/* Free the encoder resources */
if( p_sys->p_schro )
schro_encoder_free( p_sys->p_schro );
free( p_sys->p_format );
if( p_sys->p_dts_fifo )
block_FifoRelease( p_sys->p_dts_fifo );
block_ChainRelease( p_sys->p_chain );
free( p_sys );
}
| Java |
/**
******************************************************************************
* @file stm32wbxx_hal_pcd_ex.c
* @author MCD Application Team
* @brief PCD Extended HAL module driver.
* This file provides firmware functions to manage the following
* functionalities of the USB Peripheral Controller:
* + Extended features functions
*
******************************************************************************
* @attention
*
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32wbxx_hal.h"
/** @addtogroup STM32WBxx_HAL_Driver
* @{
*/
/** @defgroup PCDEx PCDEx
* @brief PCD Extended HAL module driver
* @{
*/
#ifdef HAL_PCD_MODULE_ENABLED
#if defined (USB)
/* Private types -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private constants ---------------------------------------------------------*/
/* Private macros ------------------------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
/** @defgroup PCDEx_Exported_Functions PCDEx Exported Functions
* @{
*/
/** @defgroup PCDEx_Exported_Functions_Group1 Peripheral Control functions
* @brief PCDEx control functions
*
@verbatim
===============================================================================
##### Extended features functions #####
===============================================================================
[..] This section provides functions allowing to:
(+) Update FIFO configuration
@endverbatim
* @{
*/
/**
* @brief Configure PMA for EP
* @param hpcd Device instance
* @param ep_addr endpoint address
* @param ep_kind endpoint Kind
* USB_SNG_BUF: Single Buffer used
* USB_DBL_BUF: Double Buffer used
* @param pmaadress: EP address in The PMA: In case of single buffer endpoint
* this parameter is 16-bit value providing the address
* in PMA allocated to endpoint.
* In case of double buffer endpoint this parameter
* is a 32-bit value providing the endpoint buffer 0 address
* in the LSB part of 32-bit value and endpoint buffer 1 address
* in the MSB part of 32-bit value.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd,
uint16_t ep_addr,
uint16_t ep_kind,
uint32_t pmaadress)
{
PCD_EPTypeDef *ep;
/* initialize ep structure*/
if ((0x80U & ep_addr) == 0x80U)
{
ep = &hpcd->IN_ep[ep_addr & EP_ADDR_MSK];
}
else
{
ep = &hpcd->OUT_ep[ep_addr];
}
/* Here we check if the endpoint is single or double Buffer*/
if (ep_kind == PCD_SNG_BUF)
{
/* Single Buffer */
ep->doublebuffer = 0U;
/* Configure the PMA */
ep->pmaadress = (uint16_t)pmaadress;
}
else /* USB_DBL_BUF */
{
/* Double Buffer Endpoint */
ep->doublebuffer = 1U;
/* Configure the PMA */
ep->pmaaddr0 = (uint16_t)(pmaadress & 0xFFFFU);
ep->pmaaddr1 = (uint16_t)((pmaadress & 0xFFFF0000U) >> 16);
}
return HAL_OK;
}
/**
* @brief Activate BatteryCharging feature.
* @param hpcd PCD handle
* @retval HAL status
*/
HAL_StatusTypeDef HAL_PCDEx_ActivateBCD(PCD_HandleTypeDef *hpcd)
{
USB_TypeDef *USBx = hpcd->Instance;
hpcd->battery_charging_active = 1U;
/* Enable BCD feature */
USBx->BCDR |= USB_BCDR_BCDEN;
/* Enable DCD : Data Contact Detect */
USBx->BCDR &= ~(USB_BCDR_PDEN);
USBx->BCDR &= ~(USB_BCDR_SDEN);
USBx->BCDR |= USB_BCDR_DCDEN;
return HAL_OK;
}
/**
* @brief Deactivate BatteryCharging feature.
* @param hpcd PCD handle
* @retval HAL status
*/
HAL_StatusTypeDef HAL_PCDEx_DeActivateBCD(PCD_HandleTypeDef *hpcd)
{
USB_TypeDef *USBx = hpcd->Instance;
hpcd->battery_charging_active = 0U;
/* Disable BCD feature */
USBx->BCDR &= ~(USB_BCDR_BCDEN);
return HAL_OK;
}
/**
* @brief Handle BatteryCharging Process.
* @param hpcd PCD handle
* @retval HAL status
*/
void HAL_PCDEx_BCD_VBUSDetect(PCD_HandleTypeDef *hpcd)
{
USB_TypeDef *USBx = hpcd->Instance;
uint32_t tickstart = HAL_GetTick();
/* Wait Detect flag or a timeout is happen*/
while ((USBx->BCDR & USB_BCDR_DCDET) == 0U)
{
/* Check for the Timeout */
if ((HAL_GetTick() - tickstart) > 1000U)
{
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
hpcd->BCDCallback(hpcd, PCD_BCD_ERROR);
#else
HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_ERROR);
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
return;
}
}
HAL_Delay(200U);
/* Data Pin Contact ? Check Detect flag */
if ((USBx->BCDR & USB_BCDR_DCDET) == USB_BCDR_DCDET)
{
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
hpcd->BCDCallback(hpcd, PCD_BCD_CONTACT_DETECTION);
#else
HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_CONTACT_DETECTION);
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
}
/* Primary detection: checks if connected to Standard Downstream Port
(without charging capability) */
USBx->BCDR &= ~(USB_BCDR_DCDEN);
HAL_Delay(50U);
USBx->BCDR |= (USB_BCDR_PDEN);
HAL_Delay(50U);
/* If Charger detect ? */
if ((USBx->BCDR & USB_BCDR_PDET) == USB_BCDR_PDET)
{
/* Start secondary detection to check connection to Charging Downstream
Port or Dedicated Charging Port */
USBx->BCDR &= ~(USB_BCDR_PDEN);
HAL_Delay(50U);
USBx->BCDR |= (USB_BCDR_SDEN);
HAL_Delay(50U);
/* If CDP ? */
if ((USBx->BCDR & USB_BCDR_SDET) == USB_BCDR_SDET)
{
/* Dedicated Downstream Port DCP */
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
hpcd->BCDCallback(hpcd, PCD_BCD_DEDICATED_CHARGING_PORT);
#else
HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_DEDICATED_CHARGING_PORT);
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
}
else
{
/* Charging Downstream Port CDP */
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
hpcd->BCDCallback(hpcd, PCD_BCD_CHARGING_DOWNSTREAM_PORT);
#else
HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_CHARGING_DOWNSTREAM_PORT);
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
}
}
else /* NO */
{
/* Standard Downstream Port */
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
hpcd->BCDCallback(hpcd, PCD_BCD_STD_DOWNSTREAM_PORT);
#else
HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_STD_DOWNSTREAM_PORT);
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
}
/* Battery Charging capability discovery finished Start Enumeration */
(void)HAL_PCDEx_DeActivateBCD(hpcd);
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
hpcd->BCDCallback(hpcd, PCD_BCD_DISCOVERY_COMPLETED);
#else
HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_DISCOVERY_COMPLETED);
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
}
/**
* @brief Activate LPM feature.
* @param hpcd PCD handle
* @retval HAL status
*/
HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd)
{
USB_TypeDef *USBx = hpcd->Instance;
hpcd->lpm_active = 1U;
hpcd->LPM_State = LPM_L0;
USBx->LPMCSR |= USB_LPMCSR_LMPEN;
USBx->LPMCSR |= USB_LPMCSR_LPMACK;
return HAL_OK;
}
/**
* @brief Deactivate LPM feature.
* @param hpcd PCD handle
* @retval HAL status
*/
HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd)
{
USB_TypeDef *USBx = hpcd->Instance;
hpcd->lpm_active = 0U;
USBx->LPMCSR &= ~(USB_LPMCSR_LMPEN);
USBx->LPMCSR &= ~(USB_LPMCSR_LPMACK);
return HAL_OK;
}
/**
* @brief Send LPM message to user layer callback.
* @param hpcd PCD handle
* @param msg LPM message
* @retval HAL status
*/
__weak void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hpcd);
UNUSED(msg);
/* NOTE : This function should not be modified, when the callback is needed,
the HAL_PCDEx_LPM_Callback could be implemented in the user file
*/
}
/**
* @brief Send BatteryCharging message to user layer callback.
* @param hpcd PCD handle
* @param msg LPM message
* @retval HAL status
*/
__weak void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hpcd);
UNUSED(msg);
/* NOTE : This function should not be modified, when the callback is needed,
the HAL_PCDEx_BCD_Callback could be implemented in the user file
*/
}
/**
* @}
*/
/**
* @}
*/
#endif /* defined (USB) */
#endif /* HAL_PCD_MODULE_ENABLED */
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
| Java |
package org.hivedb.hibernate.simplified;
import org.apache.log4j.Logger;
import org.hibernate.HibernateException;
import org.hibernate.action.Executable;
import org.hibernate.event.PostDeleteEvent;
import org.hibernate.event.PostDeleteEventListener;
import org.hivedb.Hive;
import org.hivedb.HiveLockableException;
import org.hivedb.configuration.EntityConfig;
import org.hivedb.configuration.EntityHiveConfig;
import org.hivedb.hibernate.HiveIndexer;
import org.hivedb.util.classgen.ReflectionTools;
import org.hivedb.util.functional.Transform;
import org.hivedb.util.functional.Unary;
import java.io.Serializable;
/**
* This is an alternative way of deleting the hive indexes after successful
* transaction completion (instead of using a custom Interceptor) and up
* for discussion. Hooked up via org.hibernate.cfg.Configuration.
* getEventListeners().setPostDeleteEventListeners
*
* @author mellwanger
*/
public class PostDeleteEventListenerImpl implements PostDeleteEventListener {
private static final Logger log = Logger.getLogger(PostInsertEventListenerImpl.class);
private final EntityHiveConfig hiveConfig;
private final HiveIndexer indexer;
public PostDeleteEventListenerImpl(EntityHiveConfig hiveConfig, Hive hive) {
this.hiveConfig = hiveConfig;
indexer = new HiveIndexer(hive);
}
public void onPostDelete(final PostDeleteEvent event) {
event.getSession().getActionQueue().execute(new Executable() {
public void afterTransactionCompletion(boolean success) {
if (success) {
deleteIndexes(event.getEntity());
}
}
public void beforeExecutions() throws HibernateException {
// TODO Auto-generated method stub
}
public void execute() throws HibernateException {
// TODO Auto-generated method stub
}
public Serializable[] getPropertySpaces() {
// TODO Auto-generated method stub
return null;
}
public boolean hasAfterTransactionCompletion() {
return true;
}
});
}
@SuppressWarnings("unchecked")
private Class resolveEntityClass(Class clazz) {
return ReflectionTools.whichIsImplemented(
clazz,
Transform.map(new Unary<EntityConfig, Class>() {
public Class f(EntityConfig entityConfig) {
return entityConfig.getRepresentedInterface();
}
},
hiveConfig.getEntityConfigs()));
}
private void deleteIndexes(Object entity) {
try {
final Class<?> resolvedEntityClass = resolveEntityClass(entity.getClass());
if (resolvedEntityClass != null)
indexer.delete(hiveConfig.getEntityConfig(entity.getClass()), entity);
} catch (HiveLockableException e) {
log.warn(e);
}
}
}
| Java |
/****************************************************************/
/* MOOSE - Multiphysics Object Oriented Simulation Environment */
/* */
/* All contents are licensed under LGPL V2.1 */
/* See LICENSE for full restrictions */
/****************************************************************/
#include "KKSACBulkF.h"
template<>
InputParameters validParams<KKSACBulkF>()
{
InputParameters params = validParams<KKSACBulkBase>();
// params.addClassDescription("KKS model kernel for the Bulk Allen-Cahn. This operates on the order parameter 'eta' as the non-linear variable");
params.addRequiredParam<Real>("w", "Double well height parameter");
params.addParam<MaterialPropertyName>("g_name", "g", "Base name for the double well function g(eta)");
return params;
}
KKSACBulkF::KKSACBulkF(const InputParameters & parameters) :
KKSACBulkBase(parameters),
_w(getParam<Real>("w")),
_prop_dg(getMaterialPropertyDerivative<Real>("g_name", _eta_name)),
_prop_d2g(getMaterialPropertyDerivative<Real>("g_name", _eta_name, _eta_name))
{
}
Real
KKSACBulkF::computeDFDOP(PFFunctionType type)
{
Real res = 0.0;
Real A1 = _prop_Fa[_qp] - _prop_Fb[_qp];
switch (type)
{
case Residual:
return -_prop_dh[_qp] * A1 + _w * _prop_dg[_qp];
case Jacobian:
{
res = -_prop_d2h[_qp] * A1
+ _w * _prop_d2g[_qp];
// the -\frac{dh}{d\eta}\left(\frac{dF_a}{d\eta}-\frac{dF_b}{d\eta}\right)
// term is handled in KKSACBulkC!
return _phi[_j][_qp] * res;
}
}
mooseError("Invalid type passed in");
}
Real
KKSACBulkF::computeQpOffDiagJacobian(unsigned int jvar)
{
// get the coupled variable jvar is referring to
unsigned int cvar;
if (!mapJvarToCvar(jvar, cvar))
return 0.0;
Real res = _prop_dh[_qp] * ( (*_derivatives_Fa[cvar])[_qp]
- (*_derivatives_Fb[cvar])[_qp])
* _phi[_j][_qp];
return res * _test[_j][_qp];
}
// DEPRECATED CONSTRUCTOR
KKSACBulkF::KKSACBulkF(const std::string & deprecated_name, InputParameters parameters) :
KKSACBulkBase(deprecated_name, parameters),
_w(getParam<Real>("w")),
_prop_dg(getMaterialPropertyDerivative<Real>("g_name", _eta_name)),
_prop_d2g(getMaterialPropertyDerivative<Real>("g_name", _eta_name, _eta_name))
{
}
| Java |
// Boost.Geometry Index
//
// R-tree spatial query visitor implementation
//
// Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland.
//
// This file was modified by Oracle on 2019-2021.
// Modifications copyright (c) 2019-2021 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
//
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_SPATIAL_QUERY_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_SPATIAL_QUERY_HPP
#include <boost/geometry/index/detail/rtree/node/node_elements.hpp>
#include <boost/geometry/index/detail/predicates.hpp>
#include <boost/geometry/index/parameters.hpp>
namespace boost { namespace geometry { namespace index {
namespace detail { namespace rtree { namespace visitors {
template <typename MembersHolder, typename Predicates, typename OutIter>
struct spatial_query
{
typedef typename MembersHolder::parameters_type parameters_type;
typedef typename MembersHolder::translator_type translator_type;
typedef typename MembersHolder::allocators_type allocators_type;
typedef typename index::detail::strategy_type<parameters_type>::type strategy_type;
typedef typename MembersHolder::node node;
typedef typename MembersHolder::internal_node internal_node;
typedef typename MembersHolder::leaf leaf;
typedef typename allocators_type::node_pointer node_pointer;
typedef typename allocators_type::size_type size_type;
spatial_query(MembersHolder const& members, Predicates const& p, OutIter out_it)
: m_tr(members.translator())
, m_strategy(index::detail::get_strategy(members.parameters()))
, m_pred(p)
, m_out_iter(out_it)
, m_found_count(0)
{}
size_type apply(node_pointer ptr, size_type reverse_level)
{
namespace id = index::detail;
if (reverse_level > 0)
{
internal_node& n = rtree::get<internal_node>(*ptr);
// traverse nodes meeting predicates
for (auto const& p : rtree::elements(n))
{
// if node meets predicates (0 is dummy value)
if (id::predicates_check<id::bounds_tag>(m_pred, 0, p.first, m_strategy))
{
apply(p.second, reverse_level - 1);
}
}
}
else
{
leaf& n = rtree::get<leaf>(*ptr);
// get all values meeting predicates
for (auto const& v : rtree::elements(n))
{
// if value meets predicates
if (id::predicates_check<id::value_tag>(m_pred, v, m_tr(v), m_strategy))
{
*m_out_iter = v;
++m_out_iter;
++m_found_count;
}
}
}
return m_found_count;
}
size_type apply(MembersHolder const& members)
{
return apply(members.root, members.leafs_level);
}
private:
translator_type const& m_tr;
strategy_type m_strategy;
Predicates const& m_pred;
OutIter m_out_iter;
size_type m_found_count;
};
template <typename MembersHolder, typename Predicates>
class spatial_query_incremental
{
typedef typename MembersHolder::value_type value_type;
typedef typename MembersHolder::parameters_type parameters_type;
typedef typename MembersHolder::translator_type translator_type;
typedef typename MembersHolder::allocators_type allocators_type;
typedef typename index::detail::strategy_type<parameters_type>::type strategy_type;
typedef typename MembersHolder::node node;
typedef typename MembersHolder::internal_node internal_node;
typedef typename MembersHolder::leaf leaf;
typedef typename allocators_type::size_type size_type;
typedef typename allocators_type::const_reference const_reference;
typedef typename allocators_type::node_pointer node_pointer;
typedef typename rtree::elements_type<internal_node>::type::const_iterator internal_iterator;
typedef typename rtree::elements_type<leaf>::type leaf_elements;
typedef typename rtree::elements_type<leaf>::type::const_iterator leaf_iterator;
struct internal_data
{
internal_data(internal_iterator f, internal_iterator l, size_type rl)
: first(f), last(l), reverse_level(rl)
{}
internal_iterator first;
internal_iterator last;
size_type reverse_level;
};
public:
spatial_query_incremental()
: m_translator(nullptr)
// , m_strategy()
// , m_pred()
, m_values(nullptr)
, m_current()
{}
spatial_query_incremental(Predicates const& p)
: m_translator(nullptr)
// , m_strategy()
, m_pred(p)
, m_values(nullptr)
, m_current()
{}
spatial_query_incremental(MembersHolder const& members, Predicates const& p)
: m_translator(::boost::addressof(members.translator()))
, m_strategy(index::detail::get_strategy(members.parameters()))
, m_pred(p)
, m_values(nullptr)
, m_current()
{}
const_reference dereference() const
{
BOOST_GEOMETRY_INDEX_ASSERT(m_values, "not dereferencable");
return *m_current;
}
void initialize(MembersHolder const& members)
{
apply(members.root, members.leafs_level);
search_value();
}
void increment()
{
++m_current;
search_value();
}
bool is_end() const
{
return 0 == m_values;
}
friend bool operator==(spatial_query_incremental const& l, spatial_query_incremental const& r)
{
return (l.m_values == r.m_values) && (0 == l.m_values || l.m_current == r.m_current);
}
private:
void apply(node_pointer ptr, size_type reverse_level)
{
namespace id = index::detail;
if (reverse_level > 0)
{
internal_node& n = rtree::get<internal_node>(*ptr);
auto const& elements = rtree::elements(n);
m_internal_stack.push_back(internal_data(elements.begin(), elements.end(), reverse_level - 1));
}
else
{
leaf& n = rtree::get<leaf>(*ptr);
m_values = ::boost::addressof(rtree::elements(n));
m_current = rtree::elements(n).begin();
}
}
void search_value()
{
namespace id = index::detail;
for (;;)
{
// if leaf is choosen, move to the next value in leaf
if ( m_values )
{
if ( m_current != m_values->end() )
{
// return if next value is found
value_type const& v = *m_current;
if (id::predicates_check<id::value_tag>(m_pred, v, (*m_translator)(v), m_strategy))
{
return;
}
++m_current;
}
// no more values, clear current leaf
else
{
m_values = 0;
}
}
// if leaf isn't choosen, move to the next leaf
else
{
// return if there is no more nodes to traverse
if (m_internal_stack.empty())
{
return;
}
internal_data& current_data = m_internal_stack.back();
// no more children in current node, remove it from stack
if (current_data.first == current_data.last)
{
m_internal_stack.pop_back();
continue;
}
internal_iterator it = current_data.first;
++current_data.first;
// next node is found, push it to the stack
if (id::predicates_check<id::bounds_tag>(m_pred, 0, it->first, m_strategy))
{
apply(it->second, current_data.reverse_level);
}
}
}
}
const translator_type * m_translator;
strategy_type m_strategy;
Predicates m_pred;
std::vector<internal_data> m_internal_stack;
const leaf_elements * m_values;
leaf_iterator m_current;
};
}}} // namespace detail::rtree::visitors
}}} // namespace boost::geometry::index
#endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_VISITORS_SPATIAL_QUERY_HPP
| Java |
--Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program 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 program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_mobile_warren_irradiated_worker_s01 = object_mobile_shared_warren_irradiated_worker_s01:new {
}
ObjectTemplates:addTemplate(object_mobile_warren_irradiated_worker_s01, "object/mobile/warren_irradiated_worker_s01.iff")
| Java |
--Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program 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 program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_tangible_wearables_ithorian_ith_pants_s13 = object_tangible_wearables_ithorian_shared_ith_pants_s13:new {
playerRaces = { "object/creature/player/ithorian_male.iff",
"object/creature/player/ithorian_female.iff",
"object/mobile/vendor/ithorian_female.iff",
"object/mobile/vendor/ithorian_male.iff" },
numberExperimentalProperties = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
experimentalProperties = {"XX", "XX", "XX", "XX", "XX", "XX", "XX", "XX", "XX", "XX", "XX", "XX", "XX", "XX", "XX", "XX"},
experimentalWeights = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
experimentalGroupTitles = {"null", "null", "null", "null", "null", "null", "null", "null", "null", "null", "null", "null", "null", "null", "null", "null"},
experimentalSubGroupTitles = {"null", "null", "sockets", "hitpoints", "mod_idx_one", "mod_val_one", "mod_idx_two", "mod_val_two", "mod_idx_three", "mod_val_three", "mod_idx_four", "mod_val_four", "mod_idx_five", "mod_val_five", "mod_idx_six", "mod_val_six"},
experimentalMin = {0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
experimentalMax = {0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
experimentalPrecision = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
experimentalCombineType = {0, 0, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
}
ObjectTemplates:addTemplate(object_tangible_wearables_ithorian_ith_pants_s13, "object/tangible/wearables/ithorian/ith_pants_s13.iff")
| Java |
#
# Secret Labs' Regular Expression Engine
#
# various symbols used by the regular expression engine.
# run this script to update the _sre include files!
#
# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
#
# See the sre.py file for information on usage and redistribution.
#
"""Internal support module for sre"""
# update when constants are added or removed
MAGIC = 20031017
# max code word in this release
MAXREPEAT = 65535
# SRE standard exception (access as sre.error)
# should this really be here?
class error(Exception):
pass
# operators
FAILURE = "failure"
SUCCESS = "success"
ANY = "any"
ANY_ALL = "any_all"
ASSERT = "assert"
ASSERT_NOT = "assert_not"
AT = "at"
BIGCHARSET = "bigcharset"
BRANCH = "branch"
CALL = "call"
CATEGORY = "category"
CHARSET = "charset"
GROUPREF = "groupref"
GROUPREF_IGNORE = "groupref_ignore"
GROUPREF_EXISTS = "groupref_exists"
IN = "in"
IN_IGNORE = "in_ignore"
INFO = "info"
JUMP = "jump"
LITERAL = "literal"
LITERAL_IGNORE = "literal_ignore"
MARK = "mark"
MAX_REPEAT = "max_repeat"
MAX_UNTIL = "max_until"
MIN_REPEAT = "min_repeat"
MIN_UNTIL = "min_until"
NEGATE = "negate"
NOT_LITERAL = "not_literal"
NOT_LITERAL_IGNORE = "not_literal_ignore"
RANGE = "range"
REPEAT = "repeat"
REPEAT_ONE = "repeat_one"
SUBPATTERN = "subpattern"
MIN_REPEAT_ONE = "min_repeat_one"
# positions
AT_BEGINNING = "at_beginning"
AT_BEGINNING_LINE = "at_beginning_line"
AT_BEGINNING_STRING = "at_beginning_string"
AT_BOUNDARY = "at_boundary"
AT_NON_BOUNDARY = "at_non_boundary"
AT_END = "at_end"
AT_END_LINE = "at_end_line"
AT_END_STRING = "at_end_string"
AT_LOC_BOUNDARY = "at_loc_boundary"
AT_LOC_NON_BOUNDARY = "at_loc_non_boundary"
AT_UNI_BOUNDARY = "at_uni_boundary"
AT_UNI_NON_BOUNDARY = "at_uni_non_boundary"
# categories
CATEGORY_DIGIT = "category_digit"
CATEGORY_NOT_DIGIT = "category_not_digit"
CATEGORY_SPACE = "category_space"
CATEGORY_NOT_SPACE = "category_not_space"
CATEGORY_WORD = "category_word"
CATEGORY_NOT_WORD = "category_not_word"
CATEGORY_LINEBREAK = "category_linebreak"
CATEGORY_NOT_LINEBREAK = "category_not_linebreak"
CATEGORY_LOC_WORD = "category_loc_word"
CATEGORY_LOC_NOT_WORD = "category_loc_not_word"
CATEGORY_UNI_DIGIT = "category_uni_digit"
CATEGORY_UNI_NOT_DIGIT = "category_uni_not_digit"
CATEGORY_UNI_SPACE = "category_uni_space"
CATEGORY_UNI_NOT_SPACE = "category_uni_not_space"
CATEGORY_UNI_WORD = "category_uni_word"
CATEGORY_UNI_NOT_WORD = "category_uni_not_word"
CATEGORY_UNI_LINEBREAK = "category_uni_linebreak"
CATEGORY_UNI_NOT_LINEBREAK = "category_uni_not_linebreak"
OPCODES = [
# failure=0 success=1 (just because it looks better that way :-)
FAILURE, SUCCESS,
ANY, ANY_ALL,
ASSERT, ASSERT_NOT,
AT,
BRANCH,
CALL,
CATEGORY,
CHARSET, BIGCHARSET,
GROUPREF, GROUPREF_EXISTS, GROUPREF_IGNORE,
IN, IN_IGNORE,
INFO,
JUMP,
LITERAL, LITERAL_IGNORE,
MARK,
MAX_UNTIL,
MIN_UNTIL,
NOT_LITERAL, NOT_LITERAL_IGNORE,
NEGATE,
RANGE,
REPEAT,
REPEAT_ONE,
SUBPATTERN,
MIN_REPEAT_ONE
]
ATCODES = [
AT_BEGINNING, AT_BEGINNING_LINE, AT_BEGINNING_STRING, AT_BOUNDARY,
AT_NON_BOUNDARY, AT_END, AT_END_LINE, AT_END_STRING,
AT_LOC_BOUNDARY, AT_LOC_NON_BOUNDARY, AT_UNI_BOUNDARY,
AT_UNI_NON_BOUNDARY
]
CHCODES = [
CATEGORY_DIGIT, CATEGORY_NOT_DIGIT, CATEGORY_SPACE,
CATEGORY_NOT_SPACE, CATEGORY_WORD, CATEGORY_NOT_WORD,
CATEGORY_LINEBREAK, CATEGORY_NOT_LINEBREAK, CATEGORY_LOC_WORD,
CATEGORY_LOC_NOT_WORD, CATEGORY_UNI_DIGIT, CATEGORY_UNI_NOT_DIGIT,
CATEGORY_UNI_SPACE, CATEGORY_UNI_NOT_SPACE, CATEGORY_UNI_WORD,
CATEGORY_UNI_NOT_WORD, CATEGORY_UNI_LINEBREAK,
CATEGORY_UNI_NOT_LINEBREAK
]
def makedict(list):
d = {}
i = 0
for item in list:
d[item] = i
i = i + 1
return d
OPCODES = makedict(OPCODES)
ATCODES = makedict(ATCODES)
CHCODES = makedict(CHCODES)
# replacement operations for "ignore case" mode
OP_IGNORE = {
GROUPREF: GROUPREF_IGNORE,
IN: IN_IGNORE,
LITERAL: LITERAL_IGNORE,
NOT_LITERAL: NOT_LITERAL_IGNORE
}
AT_MULTILINE = {
AT_BEGINNING: AT_BEGINNING_LINE,
AT_END: AT_END_LINE
}
AT_LOCALE = {
AT_BOUNDARY: AT_LOC_BOUNDARY,
AT_NON_BOUNDARY: AT_LOC_NON_BOUNDARY
}
AT_UNICODE = {
AT_BOUNDARY: AT_UNI_BOUNDARY,
AT_NON_BOUNDARY: AT_UNI_NON_BOUNDARY
}
CH_LOCALE = {
CATEGORY_DIGIT: CATEGORY_DIGIT,
CATEGORY_NOT_DIGIT: CATEGORY_NOT_DIGIT,
CATEGORY_SPACE: CATEGORY_SPACE,
CATEGORY_NOT_SPACE: CATEGORY_NOT_SPACE,
CATEGORY_WORD: CATEGORY_LOC_WORD,
CATEGORY_NOT_WORD: CATEGORY_LOC_NOT_WORD,
CATEGORY_LINEBREAK: CATEGORY_LINEBREAK,
CATEGORY_NOT_LINEBREAK: CATEGORY_NOT_LINEBREAK
}
CH_UNICODE = {
CATEGORY_DIGIT: CATEGORY_UNI_DIGIT,
CATEGORY_NOT_DIGIT: CATEGORY_UNI_NOT_DIGIT,
CATEGORY_SPACE: CATEGORY_UNI_SPACE,
CATEGORY_NOT_SPACE: CATEGORY_UNI_NOT_SPACE,
CATEGORY_WORD: CATEGORY_UNI_WORD,
CATEGORY_NOT_WORD: CATEGORY_UNI_NOT_WORD,
CATEGORY_LINEBREAK: CATEGORY_UNI_LINEBREAK,
CATEGORY_NOT_LINEBREAK: CATEGORY_UNI_NOT_LINEBREAK
}
# flags
SRE_FLAG_TEMPLATE = 1 # template mode (disable backtracking)
SRE_FLAG_IGNORECASE = 2 # case insensitive
SRE_FLAG_LOCALE = 4 # honour system locale
SRE_FLAG_MULTILINE = 8 # treat target as multiline string
SRE_FLAG_DOTALL = 16 # treat target as a single string
SRE_FLAG_UNICODE = 32 # use unicode "locale"
SRE_FLAG_VERBOSE = 64 # ignore whitespace and comments
SRE_FLAG_DEBUG = 128 # debugging
SRE_FLAG_ASCII = 256 # use ascii "locale"
# flags for INFO primitive
SRE_INFO_PREFIX = 1 # has prefix
SRE_INFO_LITERAL = 2 # entire pattern is literal (given by prefix)
SRE_INFO_CHARSET = 4 # pattern starts with character from given set
if __name__ == "__main__":
def dump(f, d, prefix):
items = d.items()
items.sort(key=lambda a: a[1])
for k, v in items:
f.write("#define %s_%s %s\n" % (prefix, k.upper(), v))
f = open("sre_constants.h", "w")
f.write("""\
/*
* Secret Labs' Regular Expression Engine
*
* regular expression matching engine
*
* NOTE: This file is generated by sre_constants.py. If you need
* to change anything in here, edit sre_constants.py and run it.
*
* Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved.
*
* See the _sre.c file for information on usage and redistribution.
*/
""")
f.write("#define SRE_MAGIC %d\n" % MAGIC)
dump(f, OPCODES, "SRE_OP")
dump(f, ATCODES, "SRE")
dump(f, CHCODES, "SRE")
f.write("#define SRE_FLAG_TEMPLATE %d\n" % SRE_FLAG_TEMPLATE)
f.write("#define SRE_FLAG_IGNORECASE %d\n" % SRE_FLAG_IGNORECASE)
f.write("#define SRE_FLAG_LOCALE %d\n" % SRE_FLAG_LOCALE)
f.write("#define SRE_FLAG_MULTILINE %d\n" % SRE_FLAG_MULTILINE)
f.write("#define SRE_FLAG_DOTALL %d\n" % SRE_FLAG_DOTALL)
f.write("#define SRE_FLAG_UNICODE %d\n" % SRE_FLAG_UNICODE)
f.write("#define SRE_FLAG_VERBOSE %d\n" % SRE_FLAG_VERBOSE)
f.write("#define SRE_INFO_PREFIX %d\n" % SRE_INFO_PREFIX)
f.write("#define SRE_INFO_LITERAL %d\n" % SRE_INFO_LITERAL)
f.write("#define SRE_INFO_CHARSET %d\n" % SRE_INFO_CHARSET)
f.close()
print("done")
| Java |
/* radare - LGPL - Copyright 2014-2015 - pancake */
#include "r_util/r_str.h"
#include <r_util.h>
/* dex/dwarf uleb128 implementation */
R_API const ut8 *r_uleb128(const ut8 *data, int datalen, ut64 *v, const char **error) {
ut8 c;
ut64 s, sum = 0;
const ut8 *data_end;
bool malformed_uleb = true;
if (v) {
*v = 0LL;
}
if (datalen == ST32_MAX) {
// WARNING; possible overflow
datalen = 0xffff;
}
if (datalen < 0) {
return NULL;
}
data_end = data + datalen;
if (data && datalen > 0) {
if (*data) {
for (s = 0; data < data_end; s += 7) {
c = *(data++) & 0xff;
if (s > 63) {
if (error) {
*error = r_str_newf ("r_uleb128: undefined behaviour in %d shift on ut32\n", (int)s);
}
break;
} else {
sum |= ((ut64) (c & 0x7f) << s);
}
if (!(c & 0x80)) {
malformed_uleb = false;
break;
}
}
if (malformed_uleb) {
if (error) {
*error = r_str_newf ("malformed uleb128\n");
}
}
} else {
data++;
}
}
if (v) {
*v = sum;
}
return data;
}
R_API int r_uleb128_len (const ut8 *data, int size) {
int i = 1;
ut8 c = *(data++);
while (c > 0x7f && i < size) {
c = *(data++);
i++;
}
return i;
}
/* data is the char array containing the uleb number
* datalen will point (if not NULL) to the length of the uleb number
* v (if not NULL) will point to the data's value (if fitting the size of an ut64)
*/
R_API const ut8 *r_uleb128_decode(const ut8 *data, int *datalen, ut64 *v) {
ut8 c = 0xff;
ut64 s = 0, sum = 0, l = 0;
do {
c = *(data++) & 0xff;
sum |= ((ut64) (c&0x7f) << s);
s += 7;
l++;
} while (c & 0x80);
if (v) {
*v = sum;
}
if (datalen) {
*datalen = l;
}
return data;
}
R_API ut8 *r_uleb128_encode(const ut64 s, int *len) {
ut8 c = 0;
int l = 0;
ut8 *otarget = NULL, *target = NULL, *tmptarget = NULL;
ut64 source = s;
do {
l++;
if (!(tmptarget = realloc (otarget, l))) {
l = 0;
free (otarget);
otarget = NULL;
break;
}
otarget = tmptarget;
target = otarget+l-1;
c = source & 0x7f;
source >>= 7;
if (source) {
c |= 0x80;
}
*(target) = c;
} while (source);
if (len) {
*len = l;
}
return otarget;
}
R_API const ut8 *r_leb128(const ut8 *data, int datalen, st64 *v) {
ut8 c = 0;
st64 s = 0, sum = 0;
const ut8 *data_end = data + datalen;
if (data && datalen > 0) {
if (!*data) {
data++;
goto beach;
}
while (data < data_end) {
c = *(data++) & 0x0ff;
sum |= ((st64) (c & 0x7f) << s);
s += 7;
if (!(c & 0x80)) {
break;
}
}
}
if ((s < (8 * sizeof (sum))) && (c & 0x40)) {
sum |= -((st64)1 << s);
}
beach:
if (v) {
*v = sum;
}
return data;
}
R_API st64 r_sleb128(const ut8 **data, const ut8 *end) {
const ut8 *p = *data;
st64 result = 0;
int offset = 0;
ut8 value;
bool cond;
do {
st64 chunk;
value = *p;
chunk = value & 0x7f;
result |= (chunk << offset);
offset += 7;
} while (cond = *p & 0x80 && p + 1 < end, p++, cond);
if ((value & 0x40) != 0) {
result |= ~0ULL << offset;
}
*data = p;
return result;
}
// API from https://github.com/WebAssembly/wabt/blob/master/src/binary-reader.cc
#define BYTE_AT(type, i, shift) (((type)(p[i]) & 0x7f) << (shift))
#define LEB128_1(type) (BYTE_AT (type, 0, 0))
#define LEB128_2(type) (BYTE_AT (type, 1, 7) | LEB128_1 (type))
#define LEB128_3(type) (BYTE_AT (type, 2, 14) | LEB128_2 (type))
#define LEB128_4(type) (BYTE_AT (type, 3, 21) | LEB128_3 (type))
#define LEB128_5(type) (BYTE_AT (type, 4, 28) | LEB128_4 (type))
#define LEB128_6(type) (BYTE_AT (type, 5, 35) | LEB128_5 (type))
#define LEB128_7(type) (BYTE_AT (type, 6, 42) | LEB128_6 (type))
#define LEB128_8(type) (BYTE_AT (type, 7, 49) | LEB128_7 (type))
#define LEB128_9(type) (BYTE_AT (type, 8, 56) | LEB128_8 (type))
#define LEB128_10(type) (BYTE_AT (type, 9, 63) | LEB128_9 (type))
#define SHIFT_AMOUNT(type, sign_bit) (sizeof(type) * 8 - 1 - (sign_bit))
#define SIGN_EXTEND(type, value, sign_bit) \
((type)((value) << SHIFT_AMOUNT (type, sign_bit)) >> \
SHIFT_AMOUNT (type, sign_bit))
R_API size_t read_u32_leb128 (const ut8* p, const ut8* max, ut32* out_value) {
if (p < max && !(p[0] & 0x80)) {
*out_value = LEB128_1 (ut32);
return 1;
} else if (p + 1 < max && !(p[1] & 0x80)) {
*out_value = LEB128_2 (ut32);
return 2;
} else if (p + 2 < max && !(p[2] & 0x80)) {
*out_value = LEB128_3 (ut32);
return 3;
} else if (p + 3 < max && !(p[3] & 0x80)) {
*out_value = LEB128_4 (ut32);
return 4;
} else if (p + 4 < max && !(p[4] & 0x80)) {
/* the top bits set represent values > 32 bits */
// if (p[4] & 0xf0) {}
*out_value = LEB128_5 (ut32);
return 5;
} else {
/* past the end */
*out_value = 0;
return 0;
}
}
R_API size_t read_i32_leb128 (const ut8* p, const ut8* max, st32* out_value) {
if (p < max && !(p[0] & 0x80)) {
ut32 result = LEB128_1 (ut32);
*out_value = SIGN_EXTEND (ut32, result, 6);
return 1;
} else if (p + 1 < max && !(p[1] & 0x80)) {
ut32 result = LEB128_2 (ut32);
*out_value = SIGN_EXTEND (ut32, result, 13);
return 2;
} else if (p + 2 < max && !(p[2] & 0x80)) {
ut32 result = LEB128_3 (ut32);
*out_value = SIGN_EXTEND (ut32, result, 20);
return 3;
} else if (p + 3 < max && !(p[3] & 0x80)) {
ut32 result = LEB128_4 (ut32);
*out_value = SIGN_EXTEND (ut32, result, 27);
return 4;
} else if (p+4 < max && !(p[4] & 0x80)) {
/* the top bits should be a sign-extension of the sign bit */
bool sign_bit_set = (p[4] & 0x8);
int top_bits = p[4] & 0xf0;
if ((sign_bit_set && top_bits != 0x70) || (!sign_bit_set && top_bits != 0)) {
return 0;
}
ut32 result = LEB128_5 (ut32);
*out_value = result;
return 5;
} else {
/* past the end */
return 0;
}
}
R_API size_t read_u64_leb128 (const ut8* p, const ut8* max, ut64* out_value) {
if (p < max && !(p[0] & 0x80)) {
*out_value = LEB128_1 (ut64);
return 1;
} else if (p + 1 < max && !(p[1] & 0x80)) {
*out_value = LEB128_2 (ut64);
return 2;
} else if (p + 2 < max && !(p[2] & 0x80)) {
*out_value = LEB128_3 (ut64);
return 3;
} else if (p + 3 < max && !(p[3] & 0x80)) {
*out_value = LEB128_4 (ut64);
return 4;
} else if (p + 4 < max && !(p[4] & 0x80)) {
*out_value = LEB128_5 (ut64);
return 5;
} else if (p + 5 < max && !(p[5] & 0x80)) {
*out_value = LEB128_6 (ut64);
return 6;
} else if (p + 6 < max && !(p[6] & 0x80)) {
*out_value = LEB128_7 (ut64);
return 7;
} else if (p + 7 < max && !(p[7] & 0x80)) {
*out_value = LEB128_8 (ut64);
return 8;
} else if (p + 8 < max && !(p[8] & 0x80)) {
*out_value = LEB128_9 (ut64);
return 9;
} else if (p + 9 < max && !(p[9] & 0x80)) {
*out_value = LEB128_10 (ut64);
return 10;
} else {
/* past the end */
*out_value = 0;
return 0;
}
}
R_API size_t read_i64_leb128 (const ut8* p, const ut8* max, st64* out_value) {
if (p < max && !(p[0] & 0x80)) {
ut64 result = LEB128_1 (ut64);
*out_value = SIGN_EXTEND (ut64, result, 6);
return 1;
} else if (p + 1 < max && !(p[1] & 0x80)) {
ut64 result = LEB128_2(ut64);
*out_value = SIGN_EXTEND (ut64, result, 13);
return 2;
} else if (p + 2 < max && !(p[2] & 0x80)) {
ut64 result = LEB128_3 (ut64);
*out_value = SIGN_EXTEND (ut64, result, 20);
return 3;
} else if (p + 3 < max && !(p[3] & 0x80)) {
ut64 result = LEB128_4 (ut64);
*out_value = SIGN_EXTEND (ut64, result, 27);
return 4;
} else if (p + 4 < max && !(p[4] & 0x80)) {
ut64 result = LEB128_5 (ut64);
*out_value = SIGN_EXTEND (ut64, result, 34);
return 5;
} else if (p + 5 < max && !(p[5] & 0x80)) {
ut64 result = LEB128_6 (ut64);
*out_value = SIGN_EXTEND (ut64, result, 41);
return 6;
} else if (p + 6 < max && !(p[6] & 0x80)) {
ut64 result = LEB128_7 (ut64);
*out_value = SIGN_EXTEND (ut64, result, 48);
return 7;
} else if (p + 7 < max && !(p[7] & 0x80)) {
ut64 result = LEB128_8 (ut64);
*out_value = SIGN_EXTEND (ut64, result, 55);
return 8;
} else if (p + 8 < max && !(p[8] & 0x80)) {
ut64 result = LEB128_9 (ut64);
*out_value = SIGN_EXTEND (ut64, result, 62);
return 9;
} else if (p + 9 < max && !(p[9] & 0x80)) {
/* the top bits should be a sign-extension of the sign bit */
bool sign_bit_set = (p[9] & 0x1);
int top_bits = p[9] & 0xfe;
if ((sign_bit_set && top_bits != 0x7e) || (!sign_bit_set && top_bits != 0)) {
return 0;
}
ut64 result = LEB128_10 (ut64);
*out_value = result;
return 10;
} else {
/* past the end */
return 0;
}
}
#undef BYTE_AT
#undef LEB128_1
#undef LEB128_2
#undef LEB128_3
#undef LEB128_4
#undef LEB128_5
#undef LEB128_6
#undef LEB128_7
#undef LEB128_8
#undef LEB128_9
#undef LEB128_10
#undef SHIFT_AMOUNT
#undef SIGN_EXTEND
#if 0
main() {
ut32 n;
ut8 *buf = "\x10\x02\x90\x88";
r_uleb128 (buf, &n);
printf ("n = %d\n", n);
}
#endif
| Java |
"""
Multiple dictation constructs
===============================================================================
This file is a showcase investigating the use and functionality of multiple
dictation elements within Dragonfly speech recognition grammars.
The first part of this file (i.e. the module's doc string) contains a
description of the functionality being investigated along with test code
and actual output in doctest format. This allows the reader to see what
really would happen, without needing to load the file into a speech
recognition engine and put effort into speaking all the showcased
commands.
The test code below makes use of Dragonfly's built-in element testing tool.
When run, it will connect to the speech recognition engine, load the element
being tested, mimic recognitions, and process the recognized value.
Multiple consecutive dictation elements
-------------------------------------------------------------------------------
>>> tester = ElementTester(RuleRef(ConsecutiveDictationRule()))
>>> print(tester.recognize("consecutive Alice Bob Charlie"))
Recognition: "consecutive Alice Bob Charlie"
Word and rule pairs: ("1000000" is "dgndictation")
- consecutive (1)
- Alice (1000000)
- Bob (1000000)
- Charlie (1000000)
Extras:
- dictation1: Alice
- dictation2: Bob
- dictation3: Charlie
>>> print(tester.recognize("consecutive Alice Bob"))
RecognitionFailure
Mixed literal and dictation elements
-------------------------------------------------------------------------------
Here we will investigate mixed, i.e. interspersed, fixed literal command
words and dynamic dictation elements. We will use the "MixedDictationRule"
class which has a spec of
"mixed [<dictation1>] <dictation2> command <dictation3>".
Note that "<dictation1>" was made optional instead of "<dictation2>"
because otherwise the first dictation elements would always gobble up
all dictated words. There would (by definition) be no way to distinguish
which words correspond with which dictation elements. Such consecutive
dictation elements should for that reason be avoided in real command
grammars. The way the spec is defined now, adds some interesting
dynamics, because of the order in which they dictation elements parse
the recognized words. However, do note that that order is well defined
but arbitrarily chosen.
>>> tester = ElementTester(RuleRef(MixedDictationRule()))
>>> print(tester.recognize("mixed Alice Bob command Charlie"))
Recognition: "mixed Alice Bob command Charlie"
Word and rule pairs: ("1000000" is "dgndictation")
- mixed (1)
- Alice (1000000)
- Bob (1000000)
- command (1)
- Charlie (1000000)
Extras:
- dictation1: Alice
- dictation2: Bob
- dictation3: Charlie
>>> print(tester.recognize("mixed Alice command Charlie"))
Recognition: "mixed Alice command Charlie"
Word and rule pairs: ("1000000" is "dgndictation")
- mixed (1)
- Alice (1000000)
- command (1)
- Charlie (1000000)
Extras:
- dictation2: Alice
- dictation3: Charlie
>>> print(tester.recognize("mixed Alice Bob command"))
RecognitionFailure
>>> print(tester.recognize("mixed command Charlie"))
RecognitionFailure
Repetition of dictation elements
-------------------------------------------------------------------------------
Now let's take a look at repetition of dictation elements. For this
we will use the "RepeatedDictationRule" class, which defines its spec
as a repetition of "command <dictation>". I.e. "command Alice" will
match, and "command Alice command Bob" will also match.
Note that this rule is inherently ambiguous, given the lack of a
clear definition of grouping or precedence rules for fixed literal
words in commands, and dynamic dictation elements. As an example,
"command Alice command Bob" could either match 2 repetitions with
"Alice" and "Bob" as dictation values, or a single repetition with
"Alice command Bob" as its only dictation value. The tests below
the show which of these actually occurs.
>>> tester = ElementTester(RuleRef(RepeatedDictationRule()))
>>> print(tester.recognize("command Alice"))
Recognition: "command Alice"
Word and rule pairs: ("1000000" is "dgndictation")
- command (1)
- Alice (1000000)
Extras:
- repetition: [[u'command', NatlinkDictationContainer(Alice)]]
>>> print(tester.recognize("command Alice command Bob"))
Recognition: "command Alice command Bob"
Word and rule pairs: ("1000000" is "dgndictation")
- command (1)
- Alice (1000000)
- command (1000000)
- Bob (1000000)
Extras:
- repetition: [[u'command', NatlinkDictationContainer(Alice, command, Bob)]]
"""
#---------------------------------------------------------------------------
import doctest
from dragonfly import *
from dragonfly.test.infrastructure import RecognitionFailure
from dragonfly.test.element_testcase import ElementTestCase
from dragonfly.test.element_tester import ElementTester
#---------------------------------------------------------------------------
class RecognitionAnalysisRule(CompoundRule):
"""
Base class that implements reporting in human-readable format
details about the recognized phrase. It is used by the actual
testing rules below, and allows the doctests above to be easily
readable and informative.
"""
def _process_recognition(self, node, extras):
Paste(text).execute()
def value(self, node):
return self.get_recognition_info(node)
def get_recognition_info(self, node):
output = []
output.append('Recognition: "{0}"'.format(" ".join(node.words())))
output.append('Word and rule pairs: ("1000000" is "dgndictation")')
for word, rule in node.full_results():
output.append(" - {0} ({1})".format(word, rule))
output.append("Extras:")
for key in sorted(extra.name for extra in self.extras):
extra_node = node.get_child_by_name(key)
if extra_node:
output.append(" - {0}: {1}".format(key, extra_node.value()))
return "\n".join(output)
#---------------------------------------------------------------------------
class ConsecutiveDictationRule(RecognitionAnalysisRule):
spec = "consecutive <dictation1> <dictation2> <dictation3>"
extras = [Dictation("dictation1"),
Dictation("dictation2"),
Dictation("dictation3")]
#---------------------------------------------------------------------------
class MixedDictationRule(RecognitionAnalysisRule):
spec = "mixed [<dictation1>] <dictation2> command <dictation3>"
extras = [Dictation("dictation1"),
Dictation("dictation2"),
Dictation("dictation3")]
#---------------------------------------------------------------------------
class RepeatedDictationRule(RecognitionAnalysisRule):
spec = "<repetition>"
extras = [Repetition(name="repetition",
child=Sequence([Literal("command"),
Dictation()]))]
#---------------------------------------------------------------------------
def main():
engine = get_engine()
engine.connect()
try:
doctest.testmod(verbose=True)
finally:
engine.disconnect()
if __name__ == "__main__":
main()
| Java |
import os
import unittest
from mock import patch, Mock
from tests.utils import (
FakedCache,
ObjectWithSignals,
setup_test_env,
)
setup_test_env()
from softwarecenter.db.database import StoreDatabase
from softwarecenter.ui.gtk3.views import lobbyview
from softwarecenter.ui.gtk3.widgets.exhibits import (
_HtmlRenderer,
)
class ExhibitsTestCase(unittest.TestCase):
"""The test suite for the exhibits carousel."""
def setUp(self):
self.cache = FakedCache()
self.db = StoreDatabase(cache=self.cache)
self.lobby = lobbyview.LobbyView(cache=self.cache, db=self.db,
icons=None, apps_filter=None)
self.addCleanup(self.lobby.destroy)
def _get_banner_from_lobby(self):
return self.lobby.vbox.get_children()[-1].get_child()
def test_featured_exhibit_by_default(self):
"""Show the featured exhibit before querying the remote service."""
self.lobby._append_banner_ads()
banner = self._get_banner_from_lobby()
self.assertEqual(1, len(banner.exhibits))
self.assertIsInstance(banner.exhibits[0], lobbyview.FeaturedExhibit)
def test_no_exhibit_if_not_available(self):
"""The exhibit should not be shown if the package is not available."""
exhibit = Mock()
exhibit.package_names = u'foobarbaz'
sca = ObjectWithSignals()
sca.query_exhibits = lambda: sca.emit('exhibits', sca, [exhibit])
with patch.object(lobbyview, 'SoftwareCenterAgent', lambda: sca):
self.lobby._append_banner_ads()
banner = self._get_banner_from_lobby()
self.assertEqual(1, len(banner.exhibits))
self.assertIsInstance(banner.exhibits[0], lobbyview.FeaturedExhibit)
def test_exhibit_if_available(self):
"""The exhibit should be shown if the package is available."""
exhibit = Mock()
exhibit.package_names = u'foobarbaz'
exhibit.banner_urls = ['banner']
exhibit.title_translated = ''
self.cache[u'foobarbaz'] = Mock()
sca = ObjectWithSignals()
sca.query_exhibits = lambda: sca.emit('exhibits', sca, [exhibit])
with patch.object(lobbyview, 'SoftwareCenterAgent', lambda: sca):
self.lobby._append_banner_ads()
banner = self._get_banner_from_lobby()
self.assertEqual(1, len(banner.exhibits))
self.assertIs(banner.exhibits[0], exhibit)
def test_exhibit_if_mixed_availability(self):
"""The exhibit should be shown even if some are not available."""
# available exhibit
exhibit = Mock()
exhibit.package_names = u'foobarbaz'
exhibit.banner_urls = ['banner']
exhibit.title_translated = ''
self.cache[u'foobarbaz'] = Mock()
# not available exhibit
other = Mock()
other.package_names = u'not-there'
sca = ObjectWithSignals()
sca.query_exhibits = lambda: sca.emit('exhibits', sca,
[exhibit, other])
with patch.object(lobbyview, 'SoftwareCenterAgent', lambda: sca):
self.lobby._append_banner_ads()
banner = self._get_banner_from_lobby()
self.assertEqual(1, len(banner.exhibits))
self.assertIs(banner.exhibits[0], exhibit)
def test_exhibit_with_url(self):
# available exhibit
exhibit = Mock()
exhibit.package_names = ''
exhibit.click_url = 'http://example.com'
exhibit.banner_urls = ['banner']
exhibit.title_translated = ''
sca = ObjectWithSignals()
sca.query_exhibits = lambda: sca.emit('exhibits', sca,
[exhibit])
with patch.object(lobbyview, 'SoftwareCenterAgent', lambda: sca):
# add the banners
self.lobby._append_banner_ads()
# fake click
alloc = self.lobby.exhibit_banner.get_allocation()
mock_event = Mock()
mock_event.x = alloc.x
mock_event.y = alloc.y
with patch.object(self.lobby.exhibit_banner, 'emit') as mock_emit:
self.lobby.exhibit_banner.on_button_press(None, mock_event)
self.lobby.exhibit_banner.on_button_release(None, mock_event)
mock_emit.assert_called()
signal_name = mock_emit.call_args[0][0]
call_exhibit = mock_emit.call_args[0][1]
self.assertEqual(signal_name, "show-exhibits-clicked")
self.assertEqual(call_exhibit.click_url, "http://example.com")
def test_exhibit_with_featured_exhibit(self):
""" regression test for bug #1023777 """
sca = ObjectWithSignals()
sca.query_exhibits = lambda: sca.emit('exhibits', sca,
[lobbyview.FeaturedExhibit()])
with patch.object(lobbyview, 'SoftwareCenterAgent', lambda: sca):
# add the banners
self.lobby._append_banner_ads()
# fake click
alloc = self.lobby.exhibit_banner.get_allocation()
mock_event = Mock()
mock_event.x = alloc.x
mock_event.y = alloc.y
with patch.object(self.lobby, 'emit') as mock_emit:
self.lobby.exhibit_banner.on_button_press(None, mock_event)
self.lobby.exhibit_banner.on_button_release(None, mock_event)
mock_emit.assert_called()
signal_name = mock_emit.call_args[0][0]
call_category = mock_emit.call_args[0][1]
self.assertEqual(signal_name, "category-selected")
self.assertEqual(call_category.name, "Our star apps")
class HtmlRendererTestCase(unittest.TestCase):
def test_multiple_images(self):
downloader = ObjectWithSignals()
downloader.download_file = lambda *args, **kwargs: downloader.emit(
"file-download-complete", downloader, os.path.basename(args[0]))
with patch("softwarecenter.ui.gtk3.widgets.exhibits."
"SimpleFileDownloader", lambda: downloader):
renderer = _HtmlRenderer()
mock_exhibit = Mock()
mock_exhibit.banner_urls = [
"http://example.com/path1/banner1.png",
"http://example.com/path2/banner2.png",
]
mock_exhibit.html = "url('/path1/banner1.png')#"\
"url('/path2/banner2.png')"
renderer.set_exhibit(mock_exhibit)
# assert the stuff we expected to get downloaded got downloaded
self.assertEqual(
renderer._downloaded_banner_images,
["banner1.png", "banner2.png"])
# test that the path mangling worked
self.assertEqual(
mock_exhibit.html, "url('banner1.png')#url('banner2.png')")
if __name__ == "__main__":
unittest.main()
| Java |
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/private/hiddenwin.h
// Purpose: Helper for creating a hidden window used by wxMSW internally.
// Author: Vadim Zeitlin
// Created: 2011-09-16
// Copyright: (c) 2011 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_PRIVATE_HIDDENWIN_H_
#define _WX_MSW_PRIVATE_HIDDENWIN_H_
#include "wx/msw/private.h"
/*
Creates a hidden window with supplied window proc registering the class for
it if necessary (i.e. the first time only). Caller is responsible for
destroying the window and unregistering the class (note that this must be
done because wxWidgets may be used as a DLL and so may be loaded/unloaded
multiple times into/from the same process so we can't rely on automatic
Windows class unregistration).
pclassname is a pointer to a caller stored classname, which must initially be
NULL. classname is the desired wndclass classname. If function successfully
registers the class, pclassname will be set to classname.
*/
extern "C" WXDLLIMPEXP_BASE HWND
wxCreateHiddenWindow(LPCTSTR *pclassname, LPCTSTR classname, WNDPROC wndproc);
#endif // _WX_MSW_PRIVATE_HIDDENWIN_H_
| Java |
/*
* @BEGIN LICENSE
*
* Psi4: an open-source quantum chemistry software package
*
* Copyright (c) 2007-2017 The Psi4 Developers.
*
* The copyrights for code used from other parties are included in
* the corresponding files.
*
* This file is part of Psi4.
*
* Psi4 is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* Psi4 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 Psi4; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* @END LICENSE
*/
#ifndef APPS_H
#define APPS_H
#include <set>
#include <tuple>
#include "psi4/libmints/wavefunction.h"
namespace psi {
class JK;
class VBase;
// => BASE CLASSES <= //
class RBase : public Wavefunction {
protected:
int print_;
int bench_;
SharedMatrix C_;
SharedMatrix Cocc_;
SharedMatrix Cfocc_;
SharedMatrix Cfvir_;
SharedMatrix Caocc_;
SharedMatrix Cavir_;
std::shared_ptr<Vector> eps_focc_;
std::shared_ptr<Vector> eps_fvir_;
std::shared_ptr<Vector> eps_aocc_;
std::shared_ptr<Vector> eps_avir_;
SharedMatrix AO2USO_;
/// How far to converge the two-norm of the residual
double convergence_;
/// Global JK object, built in preiterations, destroyed in postiterations
std::shared_ptr<JK> jk_;
std::shared_ptr<VBase> v_;
bool use_symmetry_;
double Eref_;
public:
RBase(SharedWavefunction ref_wfn, Options& options, bool use_symmetry=true);
// TODO: Remove AS SOON AS POSSIBLE, such a dirty hack
RBase(bool flag);
virtual ~RBase();
virtual bool same_a_b_orbs() const { return true; }
virtual bool same_a_b_dens() const { return true; }
// TODO: Remove AS SOON AS POSSIBLE, such a dirty hack
virtual double compute_energy() { return 0.0; }
void set_print(int print) { print_ = print; }
/// Gets a handle to the JK object, if built by preiterations
std::shared_ptr<JK> jk() const { return jk_;}
/// Set the JK object, say from SCF
void set_jk(std::shared_ptr<JK> jk) { jk_ = jk; }
/// Gets a handle to the VBase object, if built by preiterations
std::shared_ptr<VBase> v() const { return v_;}
/// Set the VBase object, say from SCF (except that wouldn't work, right?)
void set_jk(std::shared_ptr<VBase> v) { v_ = v; }
/// Builds JK object, if needed
virtual void preiterations();
/// Destroys JK object, if needed
virtual void postiterations();
/// => Setters <= ///
void set_use_symmetry(bool usesym) { use_symmetry_ = usesym; }
/// Set convergence behavior
void set_convergence(double convergence) { convergence_ = convergence; }
/// Set reference info
void set_C(SharedMatrix C) { C_ = C; }
void set_Cocc(SharedMatrix Cocc) { Cocc_ = Cocc; }
void set_Cfocc(SharedMatrix Cfocc) { Cfocc_ = Cfocc; }
void set_Caocc(SharedMatrix Caocc) { Caocc_ = Caocc; }
void set_Cavir(SharedMatrix Cavir) { Cavir_ = Cavir; }
void set_Cfvir(SharedMatrix Cfvir) { Cfvir_ = Cfvir; }
void set_eps_focc(SharedVector eps) { eps_focc_ = eps; }
void set_eps_aocc(SharedVector eps) { eps_aocc_ = eps; }
void set_eps_avir(SharedVector eps) { eps_avir_ = eps; }
void set_eps_fvir(SharedVector eps) { eps_fvir_ = eps; }
void set_Eref(double Eref) { Eref_ = Eref; }
/// Update reference info
void set_reference(std::shared_ptr<Wavefunction> reference);
};
// => APPLIED CLASSES <= //
class RCIS : public RBase {
protected:
std::vector<std::tuple<double, int, int, int> > states_;
std::vector<SharedMatrix > singlets_;
std::vector<SharedMatrix > triplets_;
std::vector<double> E_singlets_;
std::vector<double> E_triplets_;
void sort_states();
virtual void print_header();
virtual void print_wavefunctions();
virtual void print_amplitudes();
virtual void print_transitions();
virtual void print_densities();
virtual SharedMatrix TDmo(SharedMatrix T1, bool singlet = true);
virtual SharedMatrix TDso(SharedMatrix T1, bool singlet = true);
virtual SharedMatrix TDao(SharedMatrix T1, bool singlet = true);
virtual SharedMatrix Dmo(SharedMatrix T1, bool diff = false);
virtual SharedMatrix Dso(SharedMatrix T1, bool diff = false);
virtual SharedMatrix Dao(SharedMatrix T1, bool diff = false);
virtual std::pair<SharedMatrix, std::shared_ptr<Vector> > Nmo(SharedMatrix T1, bool diff = false);
virtual std::pair<SharedMatrix, std::shared_ptr<Vector> > Nso(SharedMatrix T1, bool diff = false);
virtual std::pair<SharedMatrix, std::shared_ptr<Vector> > Nao(SharedMatrix T1, bool diff = false);
virtual std::pair<SharedMatrix, SharedMatrix > ADmo(SharedMatrix T1);
virtual std::pair<SharedMatrix, SharedMatrix > ADso(SharedMatrix T1);
virtual std::pair<SharedMatrix, SharedMatrix > ADao(SharedMatrix T1);
public:
RCIS(SharedWavefunction ref_wfn, Options& options);
virtual ~RCIS();
virtual double compute_energy();
};
class RTDHF : public RBase {
protected:
std::vector<SharedMatrix > singlets_X_;
std::vector<SharedMatrix > triplets_X_;
std::vector<SharedMatrix > singlets_Y_;
std::vector<SharedMatrix > triplets_Y_;
std::vector<double> E_singlets_;
std::vector<double> E_triplets_;
virtual void print_header();
public:
RTDHF(SharedWavefunction ref_wfn, Options& options);
virtual ~RTDHF();
virtual double compute_energy();
};
class RCPHF : public RBase {
protected:
// OV-Rotations
std::map<std::string, SharedMatrix> x_;
// OV-Perturbations
std::map<std::string, SharedMatrix> b_;
virtual void print_header();
void add_named_tasks();
void analyze_named_tasks();
void add_polarizability();
void analyze_polarizability();
std::set<std::string> tasks_;
public:
RCPHF(SharedWavefunction ref_wfn, Options& options, bool use_symmetry=true);
virtual ~RCPHF();
/// Solve for all perturbations currently in b
virtual double compute_energy();
/// Perturbation vector queue, shove tasks onto this guy before compute_energy
std::map<std::string, SharedMatrix>& b() { return b_; }
/// Resultant solution vectors, available after compute_energy is called
std::map<std::string, SharedMatrix>& x() { return x_; }
/// Add a named task
void add_task(const std::string& task);
};
class RCPKS : public RCPHF {
protected:
virtual void print_header();
public:
RCPKS(SharedWavefunction ref_wfn, Options& options);
virtual ~RCPKS();
virtual double compute_energy();
};
class RTDA : public RCIS {
protected:
virtual void print_header();
public:
RTDA(SharedWavefunction ref_wfn, Options& options);
virtual ~RTDA();
virtual double compute_energy();
};
class RTDDFT : public RTDHF {
protected:
virtual void print_header();
public:
RTDDFT(SharedWavefunction ref_wfn, Options& options);
virtual ~RTDDFT();
virtual double compute_energy();
};
}
#endif
| Java |
<?php
/**
* @group regression
* @covers ApiKeys_ApiKeyStruct::validSecret
* User: dinies
* Date: 21/06/16
* Time: 15.50
*/
class GetUserApiKeyTest extends AbstractTest {
protected $uid;
private $test_data;
function setup() {
/**
* environment initialization
*/
$this->test_data = new StdClass();
$this->test_data->user = Factory_User::create();
$this->test_data->api_key = Factory_ApiKey::create( [
'uid' => $this->test_data->user->uid,
] );
}
public function test_getUser_success() {
$user = $this->test_data->api_key->getUser();
$this->assertTrue( $user instanceof Users_UserStruct );
$this->assertEquals( "{$this->test_data->user->uid}", $user->uid );
$this->assertEquals( "{$this->test_data->user->email}", $user->email );
$this->assertEquals( "{$this->test_data->user->salt}", $user->salt );
$this->assertEquals( "{$this->test_data->user->pass}", $user->pass );
$this->assertRegExp( '/^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-2]?[0-9]:[0-5][0-9]:[0-5][0-9]$/', $user->create_date );
$this->assertEquals( "{$this->test_data->user->create_date}", $user->create_date );
$this->assertEquals( "{$this->test_data->user->first_name}", $user->first_name );
$this->assertEquals( "{$this->test_data->user->last_name}", $user->last_name );
}
public function test_getUser_failure() {
$this->test_data->api_key->uid += 1000;
$this->assertNull( $this->test_data->api_key->getUser() );
}
} | Java |
//
// System.Web.UI.HtmlControls.HtmlSelect.cs
//
// Author:
// Dick Porter <[email protected]>
//
// Copyright (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Web.UI.WebControls;
using System.Web.Util;
using System.ComponentModel;
using System.Collections;
using System.Collections.Specialized;
using System.Globalization;
using System.Security.Permissions;
namespace System.Web.UI.HtmlControls
{
// CAS
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
// attributes
[DefaultEvent ("ServerChange")]
[ValidationProperty ("Value")]
[ControlBuilder (typeof (HtmlSelectBuilder))]
[SupportsEventValidation]
public class HtmlSelect : HtmlContainerControl, IPostBackDataHandler, IParserAccessor
{
static readonly object EventServerChange = new object ();
DataSourceView _boundDataSourceView;
bool requiresDataBinding;
bool _initialized;
object datasource;
ListItemCollection items;
public HtmlSelect () : base ("select")
{
}
[DefaultValue ("")]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[WebSysDescription("")]
[WebCategory("Data")]
public virtual string DataMember {
get {
string member = Attributes["datamember"];
if (member == null) {
return (String.Empty);
}
return (member);
}
set {
if (value == null) {
Attributes.Remove ("datamember");
} else {
Attributes["datamember"] = value;
}
}
}
[DefaultValue (null)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[WebSysDescription("")]
[WebCategory("Data")]
public virtual object DataSource {
get {
return (datasource);
}
set {
if ((value != null) &&
!(value is IEnumerable) &&
!(value is IListSource)) {
throw new ArgumentException ();
}
datasource = value;
}
}
[DefaultValue ("")]
public virtual string DataSourceID {
get {
return ViewState.GetString ("DataSourceID", "");
}
set {
if (DataSourceID == value)
return;
ViewState ["DataSourceID"] = value;
if (_boundDataSourceView != null)
_boundDataSourceView.DataSourceViewChanged -= OnDataSourceViewChanged;
_boundDataSourceView = null;
OnDataPropertyChanged ();
}
}
[DefaultValue ("")]
[WebSysDescription("")]
[WebCategory("Data")]
public virtual string DataTextField {
get {
string text = Attributes["datatextfield"];
if (text == null) {
return (String.Empty);
}
return (text);
}
set {
if (value == null) {
Attributes.Remove ("datatextfield");
} else {
Attributes["datatextfield"] = value;
}
}
}
[DefaultValue ("")]
[WebSysDescription("")]
[WebCategory("Data")]
public virtual string DataValueField {
get {
string value = Attributes["datavaluefield"];
if (value == null) {
return (String.Empty);
}
return (value);
}
set {
if (value == null) {
Attributes.Remove ("datavaluefield");
} else {
Attributes["datavaluefield"] = value;
}
}
}
public override string InnerHtml {
get {
throw new NotSupportedException ();
}
set {
throw new NotSupportedException ();
}
}
public override string InnerText {
get {
throw new NotSupportedException ();
}
set {
throw new NotSupportedException ();
}
}
protected bool IsBoundUsingDataSourceID {
get {
return (DataSourceID.Length != 0);
}
}
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[Browsable (false)]
public ListItemCollection Items {
get {
if (items == null) {
items = new ListItemCollection ();
if (IsTrackingViewState)
((IStateManager) items).TrackViewState ();
}
return (items);
}
}
[DefaultValue ("")]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[WebSysDescription("")]
[WebCategory("Behavior")]
public bool Multiple {
get {
string multi = Attributes["multiple"];
if (multi == null) {
return (false);
}
return (true);
}
set {
if (value == false) {
Attributes.Remove ("multiple");
} else {
Attributes["multiple"] = "multiple";
}
}
}
[DefaultValue ("")]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[WebSysDescription("")]
[WebCategory("Behavior")]
public string Name {
get {
return (UniqueID);
}
set {
/* Do nothing */
}
}
protected bool RequiresDataBinding {
get { return requiresDataBinding; }
set { requiresDataBinding = value; }
}
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[Browsable (false)]
public virtual int SelectedIndex {
get {
/* Make sure Items has been initialised */
ListItemCollection listitems = Items;
for (int i = 0; i < listitems.Count; i++) {
if (listitems[i].Selected) {
return (i);
}
}
/* There is always a selected item in
* non-multiple mode, if the size is
* <= 1
*/
if (!Multiple && Size <= 1) {
/* Select the first item */
if (listitems.Count > 0) {
/* And make it stick
* if there is
* anything in the
* list
*/
listitems[0].Selected = true;
}
return (0);
}
return (-1);
}
set {
ClearSelection ();
if (value == -1 || items == null) {
return;
}
if (value < 0 || value >= items.Count) {
throw new ArgumentOutOfRangeException ("value");
}
items[value].Selected = true;
}
}
/* "internal infrastructure" according to the docs,
* but has some documentation in 2.0
*/
protected virtual int[] SelectedIndices {
get {
ArrayList selected = new ArrayList ();
int count = Items.Count;
for (int i = 0; i < count; i++) {
if (Items [i].Selected) {
selected.Add (i);
}
}
return ((int[])selected.ToArray (typeof (int)));
}
}
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
public int Size {
get {
string size = Attributes["size"];
if (size == null) {
return (-1);
}
return (Int32.Parse (size, Helpers.InvariantCulture));
}
set {
if (value == -1) {
Attributes.Remove ("size");
} else {
Attributes["size"] = value.ToString ();
}
}
}
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
public string Value {
get {
int sel = SelectedIndex;
if (sel >= 0 && sel < Items.Count) {
return (Items[sel].Value);
}
return (String.Empty);
}
set {
int sel = Items.IndexOf (value);
if (sel >= 0) {
SelectedIndex = sel;
}
}
}
[WebSysDescription("")]
[WebCategory("Action")]
public event EventHandler ServerChange {
add {
Events.AddHandler (EventServerChange, value);
}
remove {
Events.RemoveHandler (EventServerChange, value);
}
}
protected override void AddParsedSubObject (object obj)
{
if (!(obj is ListItem)) {
throw new HttpException ("HtmlSelect can only contain ListItem");
}
Items.Add ((ListItem)obj);
base.AddParsedSubObject (obj);
}
/* "internal infrastructure" according to the docs,
* but has some documentation in 2.0
*/
protected virtual void ClearSelection ()
{
if (items == null) {
return;
}
int count = items.Count;
for (int i = 0; i < count; i++) {
items[i].Selected = false;
}
}
protected override ControlCollection CreateControlCollection ()
{
return (base.CreateControlCollection ());
}
protected void EnsureDataBound ()
{
if (IsBoundUsingDataSourceID && RequiresDataBinding)
DataBind ();
}
protected virtual IEnumerable GetData ()
{
if (DataSource != null && IsBoundUsingDataSourceID)
throw new HttpException ("Control bound using both DataSourceID and DataSource properties.");
if (DataSource != null)
return DataSourceResolver.ResolveDataSource (DataSource, DataMember);
if (!IsBoundUsingDataSourceID)
return null;
IEnumerable result = null;
DataSourceView boundDataSourceView = ConnectToDataSource ();
boundDataSourceView.Select (DataSourceSelectArguments.Empty, delegate (IEnumerable data) { result = data; });
return result;
}
protected override void LoadViewState (object savedState)
{
object first = null;
object second = null;
Pair pair = savedState as Pair;
if (pair != null) {
first = pair.First;
second = pair.Second;
}
base.LoadViewState (first);
if (second != null) {
IStateManager manager = Items as IStateManager;
manager.LoadViewState (second);
}
}
protected override void OnDataBinding (EventArgs e)
{
base.OnDataBinding (e);
/* Make sure Items has been initialised */
ListItemCollection listitems = Items;
listitems.Clear ();
IEnumerable list = GetData ();
if (list == null)
return;
foreach (object container in list) {
string text = null;
string value = null;
if (DataTextField == String.Empty &&
DataValueField == String.Empty) {
text = container.ToString ();
value = text;
} else {
if (DataTextField != String.Empty) {
text = DataBinder.Eval (container, DataTextField).ToString ();
}
if (DataValueField != String.Empty) {
value = DataBinder.Eval (container, DataValueField).ToString ();
} else {
value = text;
}
if (text == null &&
value != null) {
text = value;
}
}
if (text == null) {
text = String.Empty;
}
if (value == null) {
value = String.Empty;
}
ListItem item = new ListItem (text, value);
listitems.Add (item);
}
RequiresDataBinding = false;
IsDataBound = true;
}
protected virtual void OnDataPropertyChanged ()
{
if (_initialized)
RequiresDataBinding = true;
}
protected virtual void OnDataSourceViewChanged (object sender,
EventArgs e)
{
RequiresDataBinding = true;
}
protected internal override void OnInit (EventArgs e)
{
base.OnInit (e);
Page.PreLoad += new EventHandler (OnPagePreLoad);
}
protected virtual void OnPagePreLoad (object sender, EventArgs e)
{
Initialize ();
}
protected internal override void OnLoad (EventArgs e)
{
if (!_initialized)
Initialize ();
base.OnLoad (e);
}
void Initialize ()
{
_initialized = true;
if (!IsDataBound)
RequiresDataBinding = true;
if (IsBoundUsingDataSourceID)
ConnectToDataSource ();
}
bool IsDataBound{
get {
return ViewState.GetBool ("_DataBound", false);
}
set {
ViewState ["_DataBound"] = value;
}
}
DataSourceView ConnectToDataSource ()
{
if (_boundDataSourceView != null)
return _boundDataSourceView;
/* verify that the data source exists and is an IDataSource */
object ctrl = null;
Page page = Page;
if (page != null)
ctrl = page.FindControl (DataSourceID);
if (ctrl == null || !(ctrl is IDataSource)) {
string format;
if (ctrl == null)
format = "DataSourceID of '{0}' must be the ID of a control of type IDataSource. A control with ID '{1}' could not be found.";
else
format = "DataSourceID of '{0}' must be the ID of a control of type IDataSource. '{1}' is not an IDataSource.";
throw new HttpException (String.Format (format, ID, DataSourceID));
}
_boundDataSourceView = ((IDataSource)ctrl).GetView (String.Empty);
_boundDataSourceView.DataSourceViewChanged += OnDataSourceViewChanged;
return _boundDataSourceView;
}
protected internal override void OnPreRender (EventArgs e)
{
EnsureDataBound ();
base.OnPreRender (e);
Page page = Page;
if (page != null && !Disabled) {
page.RegisterRequiresPostBack (this);
page.RegisterEnabledControl (this);
}
}
protected virtual void OnServerChange (EventArgs e)
{
EventHandler handler = (EventHandler)Events[EventServerChange];
if (handler != null) {
handler (this, e);
}
}
protected override void RenderAttributes (HtmlTextWriter w)
{
Page page = Page;
if (page != null)
page.ClientScript.RegisterForEventValidation (UniqueID);
/* If there is no "name" attribute,
* LoadPostData doesn't work...
*/
w.WriteAttribute ("name", Name);
Attributes.Remove ("name");
/* Don't render the databinding attributes */
Attributes.Remove ("datamember");
Attributes.Remove ("datatextfield");
Attributes.Remove ("datavaluefield");
base.RenderAttributes (w);
}
protected internal override void RenderChildren (HtmlTextWriter w)
{
base.RenderChildren (w);
if (items == null)
return;
w.WriteLine ();
bool done_sel = false;
int count = items.Count;
for (int i = 0; i < count; i++) {
ListItem item = items[i];
w.Indent++;
/* Write the <option> elements this
* way so that the output HTML matches
* the ms version (can't make
* HtmlTextWriterTag.Option an inline
* element, cos that breaks other
* stuff.)
*/
w.WriteBeginTag ("option");
if (item.Selected && !done_sel) {
w.WriteAttribute ("selected", "selected");
if (!Multiple) {
done_sel = true;
}
}
w.WriteAttribute ("value", item.Value, true);
if (item.HasAttributes) {
AttributeCollection attrs = item.Attributes;
foreach (string key in attrs.Keys)
w.WriteAttribute (key, HttpUtility.HtmlAttributeEncode (attrs [key]));
}
w.Write (HtmlTextWriter.TagRightChar);
w.Write (HttpUtility.HtmlEncode(item.Text));
w.WriteEndTag ("option");
w.WriteLine ();
w.Indent--;
}
}
protected override object SaveViewState ()
{
object first = null;
object second = null;
first = base.SaveViewState ();
IStateManager manager = items as IStateManager;
if (manager != null) {
second = manager.SaveViewState ();
}
if (first == null && second == null)
return (null);
return new Pair (first, second);
}
/* "internal infrastructure" according to the docs,
* but has some documentation in 2.0
*/
protected virtual void Select (int[] selectedIndices)
{
if (items == null) {
return;
}
ClearSelection ();
int count = items.Count;
foreach (int i in selectedIndices) {
if (i >= 0 && i < count) {
items[i].Selected = true;
}
}
}
protected override void TrackViewState ()
{
base.TrackViewState ();
IStateManager manager = items as IStateManager;
if (manager != null) {
manager.TrackViewState ();
}
}
protected virtual void RaisePostDataChangedEvent ()
{
OnServerChange (EventArgs.Empty);
}
protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
{
/* postCollection contains the values that are
* selected
*/
string[] values = postCollection.GetValues (postDataKey);
bool changed = false;
if (values != null) {
if (Multiple) {
/* We have a set of
* selections. We can't just
* set the new list, because
* we need to know if the set
* has changed from last time
*/
int value_len = values.Length;
int[] old_sel = SelectedIndices;
int[] new_sel = new int[value_len];
int old_sel_len = old_sel.Length;
for (int i = 0; i < value_len; i++) {
new_sel[i] = Items.IndexOf (values[i]);
if (old_sel_len != value_len ||
old_sel[i] != new_sel[i]) {
changed = true;
}
}
if (changed) {
Select (new_sel);
}
} else {
/* Just take the first one */
int sel = Items.IndexOf (values[0]);
if (sel != SelectedIndex) {
SelectedIndex = sel;
changed = true;
}
}
}
if (changed)
ValidateEvent (postDataKey, String.Empty);
return (changed);
}
bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
{
return LoadPostData (postDataKey, postCollection);
}
void IPostBackDataHandler.RaisePostDataChangedEvent ()
{
RaisePostDataChangedEvent ();
}
}
}
| Java |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Code Coverage for D:\work\log4php-tag\src\main\php/appenders</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/bootstrap-responsive.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<header>
<div class="container">
<div class="row">
<div class="span12">
<ul class="breadcrumb">
<li><a href="index.html">D:\work\log4php-tag\src\main\php</a> <span class="divider">/</span></li>
<li class="active">appenders</li>
<li>(<a href="appenders.dashboard.html">Dashboard</a>)</li>
</ul>
</div>
</div>
</div>
</header>
<div class="container">
<table class="table table-bordered">
<thead>
<tr>
<td> </td>
<td colspan="9"><div align="center"><strong>Code Coverage</strong></div></td>
</tr>
<tr>
<td> </td>
<td colspan="3"><div align="center"><strong>Lines</strong></div></td>
<td colspan="3"><div align="center"><strong>Functions and Methods</strong></div></td>
<td colspan="3"><div align="center"><strong>Classes and Traits</strong></div></td>
</tr>
</thead>
<tbody>
<tr>
<td class="success">Total</td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 76.66%;"></div>
</div>
</td>
<td class="success small"><div align="right">76.66%</div></td>
<td class="success small"><div align="right">463 / 604</div></td>
<td class="warning big"> <div class="progress progress-warning" style="width: 100px;">
<div class="bar" style="width: 60.14%;"></div>
</div>
</td>
<td class="warning small"><div align="right">60.14%</div></td>
<td class="warning small"><div align="right">83 / 138</div></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 28.57%;"></div>
</div>
</td>
<td class="danger small"><div align="right">28.57%</div></td>
<td class="danger small"><div align="right">4 / 14</div></td>
</tr>
<tr>
<td class="success"><i class="icon-file"></i> <a href="appenders_LoggerAppenderConsole.php.html">LoggerAppenderConsole.php</a></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 92.86%;"></div>
</div>
</td>
<td class="success small"><div align="right">92.86%</div></td>
<td class="success small"><div align="right">26 / 28</div></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 80.00%;"></div>
</div>
</td>
<td class="success small"><div align="right">80.00%</div></td>
<td class="success small"><div align="right">4 / 5</div></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
</tr>
<tr>
<td class="success"><i class="icon-file"></i> <a href="appenders_LoggerAppenderDailyFile.php.html">LoggerAppenderDailyFile.php</a></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 100.00%;"></div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">25 / 25</div></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 100.00%;"></div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">6 / 6</div></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 100.00%;"></div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1 / 1</div></td>
</tr>
<tr>
<td class="success"><i class="icon-file"></i> <a href="appenders_LoggerAppenderEcho.php.html">LoggerAppenderEcho.php</a></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 100.00%;"></div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">22 / 22</div></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 100.00%;"></div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">4 / 4</div></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 100.00%;"></div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1 / 1</div></td>
</tr>
<tr>
<td class="warning"><i class="icon-file"></i> <a href="appenders_LoggerAppenderFile.php.html">LoggerAppenderFile.php</a></td>
<td class="warning big"> <div class="progress progress-warning" style="width: 100px;">
<div class="bar" style="width: 60.56%;"></div>
</div>
</td>
<td class="warning small"><div align="right">60.56%</div></td>
<td class="warning small"><div align="right">43 / 71</div></td>
<td class="warning big"> <div class="progress progress-warning" style="width: 100px;">
<div class="bar" style="width: 42.86%;"></div>
</div>
</td>
<td class="warning small"><div align="right">42.86%</div></td>
<td class="warning small"><div align="right">6 / 14</div></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
</tr>
<tr>
<td class="success"><i class="icon-file"></i> <a href="appenders_LoggerAppenderFirePHP.php.html">LoggerAppenderFirePHP.php</a></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 80.00%;"></div>
</div>
</td>
<td class="success small"><div align="right">80.00%</div></td>
<td class="success small"><div align="right">24 / 30</div></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 75.00%;"></div>
</div>
</td>
<td class="success small"><div align="right">75.00%</div></td>
<td class="success small"><div align="right">3 / 4</div></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
</tr>
<tr>
<td class="warning"><i class="icon-file"></i> <a href="appenders_LoggerAppenderMail.php.html">LoggerAppenderMail.php</a></td>
<td class="warning big"> <div class="progress progress-warning" style="width: 100px;">
<div class="bar" style="width: 67.74%;"></div>
</div>
</td>
<td class="warning small"><div align="right">67.74%</div></td>
<td class="warning small"><div align="right">21 / 31</div></td>
<td class="warning big"> <div class="progress progress-warning" style="width: 100px;">
<div class="bar" style="width: 44.44%;"></div>
</div>
</td>
<td class="warning small"><div align="right">44.44%</div></td>
<td class="warning small"><div align="right">4 / 9</div></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
</tr>
<tr>
<td class="warning"><i class="icon-file"></i> <a href="appenders_LoggerAppenderMailEvent.php.html">LoggerAppenderMailEvent.php</a></td>
<td class="warning big"> <div class="progress progress-warning" style="width: 100px;">
<div class="bar" style="width: 58.70%;"></div>
</div>
</td>
<td class="warning small"><div align="right">58.70%</div></td>
<td class="warning small"><div align="right">27 / 46</div></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 23.08%;"></div>
</div>
</td>
<td class="danger small"><div align="right">23.08%</div></td>
<td class="danger small"><div align="right">3 / 13</div></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
</tr>
<tr>
<td class="success"><i class="icon-file"></i> <a href="appenders_LoggerAppenderMongoDB.php.html">LoggerAppenderMongoDB.php</a></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 84.21%;"></div>
</div>
</td>
<td class="success small"><div align="right">84.21%</div></td>
<td class="success small"><div align="right">80 / 95</div></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 86.36%;"></div>
</div>
</td>
<td class="success small"><div align="right">86.36%</div></td>
<td class="success small"><div align="right">19 / 22</div></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
</tr>
<tr>
<td class="success"><i class="icon-file"></i> <a href="appenders_LoggerAppenderNull.php.html">LoggerAppenderNull.php</a></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 100.00%;"></div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1 / 1</div></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 100.00%;"></div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1 / 1</div></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 100.00%;"></div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1 / 1</div></td>
</tr>
<tr>
<td class="warning"><i class="icon-file"></i> <a href="appenders_LoggerAppenderPDO.php.html">LoggerAppenderPDO.php</a></td>
<td class="warning big"> <div class="progress progress-warning" style="width: 100px;">
<div class="bar" style="width: 64.06%;"></div>
</div>
</td>
<td class="warning small"><div align="right">64.06%</div></td>
<td class="warning small"><div align="right">41 / 64</div></td>
<td class="warning big"> <div class="progress progress-warning" style="width: 100px;">
<div class="bar" style="width: 38.89%;"></div>
</div>
</td>
<td class="warning small"><div align="right">38.89%</div></td>
<td class="warning small"><div align="right">7 / 18</div></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
</tr>
<tr>
<td class="success"><i class="icon-file"></i> <a href="appenders_LoggerAppenderPhp.php.html">LoggerAppenderPhp.php</a></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 100.00%;"></div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">8 / 8</div></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 100.00%;"></div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1 / 1</div></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 100.00%;"></div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1 / 1</div></td>
</tr>
<tr>
<td class="success"><i class="icon-file"></i> <a href="appenders_LoggerAppenderRollingFile.php.html">LoggerAppenderRollingFile.php</a></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 77.42%;"></div>
</div>
</td>
<td class="success small"><div align="right">77.42%</div></td>
<td class="success small"><div align="right">72 / 93</div></td>
<td class="warning big"> <div class="progress progress-warning" style="width: 100px;">
<div class="bar" style="width: 46.67%;"></div>
</div>
</td>
<td class="warning small"><div align="right">46.67%</div></td>
<td class="warning small"><div align="right">7 / 15</div></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
</tr>
<tr>
<td class="warning"><i class="icon-file"></i> <a href="appenders_LoggerAppenderSocket.php.html">LoggerAppenderSocket.php</a></td>
<td class="warning big"> <div class="progress progress-warning" style="width: 100px;">
<div class="bar" style="width: 53.33%;"></div>
</div>
</td>
<td class="warning small"><div align="right">53.33%</div></td>
<td class="warning small"><div align="right">16 / 30</div></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 33.33%;"></div>
</div>
</td>
<td class="danger small"><div align="right">33.33%</div></td>
<td class="danger small"><div align="right">3 / 9</div></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
</tr>
<tr>
<td class="success"><i class="icon-file"></i> <a href="appenders_LoggerAppenderSyslog.php.html">LoggerAppenderSyslog.php</a></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 95.00%;"></div>
</div>
</td>
<td class="success small"><div align="right">95.00%</div></td>
<td class="success small"><div align="right">57 / 60</div></td>
<td class="success big"> <div class="progress progress-success" style="width: 100px;">
<div class="bar" style="width: 88.24%;"></div>
</div>
</td>
<td class="success small"><div align="right">88.24%</div></td>
<td class="success small"><div align="right">15 / 17</div></td>
<td class="danger big"> <div class="progress progress-danger" style="width: 100px;">
<div class="bar" style="width: 0.00%;"></div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0 / 1</div></td>
</tr>
</tbody>
</table>
<footer>
<h4>Legend</h4>
<p>
<span class="danger"><strong>Low</strong>: 0% to 35%</span>
<span class="warning"><strong>Medium</strong>: 35% to 70%</span>
<span class="success"><strong>High</strong>: 70% to 100%</span>
</p>
<p>
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 1.2.3</a> using <a href="http://www.php.net/" target="_top">PHP 5.3.13</a> and <a href="http://phpunit.de/">PHPUnit 3.7.6</a> at Mon Oct 8 16:41:13 BST 2012.</small>
</p>
</footer>
</div>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
</body>
</html>
| Java |
//
// ServiceCredentials.cs
//
// Author:
// Atsushi Enomoto <[email protected]>
//
// Copyright (C) 2005 Novell, Inc. http://www.novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.ObjectModel;
using System.IdentityModel.Selectors;
using System.ServiceModel.Channels;
using System.ServiceModel.Security;
using System.ServiceModel.Security.Tokens;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
namespace System.ServiceModel.Description
{
public class ServiceCredentials
: SecurityCredentialsManager, IServiceBehavior
{
public ServiceCredentials ()
{
}
protected ServiceCredentials (ServiceCredentials other)
{
initiator = other.initiator.Clone ();
peer = other.peer.Clone ();
recipient = other.recipient.Clone ();
userpass = other.userpass.Clone ();
windows = other.windows.Clone ();
issued_token = other.issued_token.Clone ();
secure_conversation = other.secure_conversation.Clone ();
}
X509CertificateInitiatorServiceCredential initiator
= new X509CertificateInitiatorServiceCredential ();
PeerCredential peer = new PeerCredential ();
X509CertificateRecipientServiceCredential recipient
= new X509CertificateRecipientServiceCredential ();
UserNamePasswordServiceCredential userpass
= new UserNamePasswordServiceCredential ();
WindowsServiceCredential windows
= new WindowsServiceCredential ();
IssuedTokenServiceCredential issued_token =
new IssuedTokenServiceCredential ();
SecureConversationServiceCredential secure_conversation =
new SecureConversationServiceCredential ();
public X509CertificateInitiatorServiceCredential ClientCertificate {
get { return initiator; }
}
public IssuedTokenServiceCredential IssuedTokenAuthentication {
get { return issued_token; }
}
public PeerCredential Peer {
get { return peer; }
}
public SecureConversationServiceCredential SecureConversationAuthentication {
get { return secure_conversation; }
}
public X509CertificateRecipientServiceCredential ServiceCertificate {
get { return recipient; }
}
public UserNamePasswordServiceCredential UserNameAuthentication {
get { return userpass; }
}
public WindowsServiceCredential WindowsAuthentication {
get { return windows; }
}
public ServiceCredentials Clone ()
{
ServiceCredentials ret = CloneCore ();
if (ret.GetType () != GetType ())
throw new NotImplementedException ("CloneCore() must be implemented to return an instance of the same type in this custom ServiceCredentials type.");
return ret;
}
protected virtual ServiceCredentials CloneCore ()
{
return new ServiceCredentials (this);
}
public override SecurityTokenManager CreateSecurityTokenManager ()
{
return new ServiceCredentialsSecurityTokenManager (this);
}
void IServiceBehavior.AddBindingParameters (
ServiceDescription description,
ServiceHostBase serviceHostBase,
Collection<ServiceEndpoint> endpoints,
BindingParameterCollection parameters)
{
parameters.Add (this);
}
void IServiceBehavior.ApplyDispatchBehavior (
ServiceDescription description,
ServiceHostBase serviceHostBase)
{
// do nothing
}
[MonoTODO]
void IServiceBehavior.Validate (
ServiceDescription description,
ServiceHostBase serviceHostBase)
{
// unlike MSDN description, it does not throw NIE.
}
}
}
| Java |
"use strict";
var express = require('express');
var less = require('less-middleware');
function HttpServer(port, staticServedPath, logRequest) {
this.port = port;
this.staticServedPath = staticServedPath;
this.logRequest = (typeof logRequest === "undefined") ? true : logRequest;
}
HttpServer.prototype.start = function(fn) {
console.log("Starting server");
var self = this;
var app = express();
self.app = app;
if(self.logRequest) {
app.use(function (req, res, next) {
console.log(req.method, req.url);
next();
});
}
app.use('/', express.static(self.staticServedPath));
self.server = app.listen(self.port, function () {
console.log("Server started on port", self.port);
if (fn !== undefined) fn();
});
};
HttpServer.prototype.stop = function() {
console.log("Stopping server");
var self = this;
self.server.close();
};
module.exports = HttpServer; | Java |
import java.util.*;
public class LineNumbersTest extends LinkedList<Object>{
public LineNumbersTest(int x) {
super((x & 0) == 1 ?
new LinkedList<Object>((x & 1) == x++ ? new ArrayList<Object>() : new HashSet<Object>())
:new HashSet<Object>());
super.add(x = getLineNo());
this.add(x = getLineNo());
}
static int getLineNo() {
return new Throwable().fillInStackTrace().getStackTrace()[1].getLineNumber();
}
public static void main(String[] args) {
System.out.println(getLineNo());
System.out.println(new Throwable().fillInStackTrace().getStackTrace()[0].getFileName());
System.out.println(getLineNo());
System.out.println(new LineNumbersTest(2));
List<Object> foo = new ArrayList<>();
System.out.println(foo.addAll(foo));
}
}
| Java |
#!/bin/bash
#python pyinstaller-pyinstaller-67b940c/pyinstaller.py ../pyNastran/pyNastran/gui/gui.py
rm -rf build dist
python pyinstaller-pyinstaller-67b940c/pyinstaller.py pyNastranGUI.spec
#dist/pywin27/gui.exe
#dist/gui/gui.exe
| Java |
--Copyright (C) 2010 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 2 of the License,
--or (at your option) any later version.
--This program 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 program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
object_mobile_dressed_tatooine_om_aynat = object_mobile_shared_dressed_tatooine_om_aynat:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_tatooine_om_aynat, "object/mobile/dressed_tatooine_om_aynat.iff")
| Java |
using System;
using System.Collections.Generic;
using DoxygenWrapper.Wrappers.Compounds.Types;
using System.Xml;
namespace DoxygenWrapper.Wrappers.Compounds
{
public class CompoundMember:
Compound
{
protected override void OnParse(XmlNode _node)
{
base.OnParse(_node);
mCompoundType = new CompoundType(_node["type"], _node["name"].Value);
}
public CompoundType CompoundType
{
get { return mCompoundType; }
}
private CompoundType mCompoundType;
}
}
| Java |
package org.opennaas.client.rest;
import java.io.FileNotFoundException;
import java.util.List;
import javax.ws.rs.core.MediaType;
import javax.xml.bind.JAXBException;
import org.apache.log4j.Logger;
import org.opennaas.extensions.router.model.EnabledLogicalElement.EnabledState;
import org.opennaas.extensions.router.model.GRETunnelConfiguration;
import org.opennaas.extensions.router.model.GRETunnelService;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.GenericType;
import com.sun.jersey.api.client.WebResource;
public class GRETunnelTest {
private static final Logger LOGGER = Logger.getLogger(GRETunnelTest.class);
public static void main(String[] args) throws FileNotFoundException, JAXBException {
createGRETunnel();
deleteGRETunnel();
showGRETunnelConfiguration();
}
/**
*
*/
private static void createGRETunnel() {
ClientResponse response = null;
String url = "http://localhost:8888/opennaas/router/lolaM20/gretunnel/createGRETunnel";
try {
Client client = Client.create();
WebResource webResource = client.resource(url);
response = webResource.type(MediaType.APPLICATION_XML).post(ClientResponse.class, getGRETunnelService());
LOGGER.info("Response code: " + response.getStatus());
} catch (Exception e) {
LOGGER.error(e.getMessage());
}
}
/**
*
*/
private static void deleteGRETunnel() {
ClientResponse response = null;
String url = "http://localhost:8888/opennaas/router/lolaM20/gretunnel/deleteGRETunnel";
try {
Client client = Client.create();
WebResource webResource = client.resource(url);
response = webResource.type(MediaType.APPLICATION_XML).post(ClientResponse.class, getGRETunnelService());
LOGGER.info("Response code: " + response.getStatus());
} catch (Exception e) {
LOGGER.error(e.getMessage());
}
}
/**
*
*/
private static void showGRETunnelConfiguration() {
List<GRETunnelService> response = null;
String url = "http://localhost:8888/opennaas/router/lolaM20/gretunnel/showGRETunnelConfiguration";
GenericType<List<GRETunnelService>> genericType =
new GenericType<List<GRETunnelService>>() {
};
try {
Client client = Client.create();
WebResource webResource = client.resource(url);
response = webResource.accept(MediaType.APPLICATION_XML).post(genericType);
LOGGER.info("Number of GRETunnels: " + response.size());
} catch (Exception e) {
LOGGER.error(e.getMessage());
}
}
/**
* @return
*/
private static GRETunnelService getGRETunnelService() {
GRETunnelService greTunnelService = new GRETunnelService();
greTunnelService.setName("MyTunnelService");
greTunnelService.setEnabledState(EnabledState.OTHER);
GRETunnelConfiguration greTunnelConfiguration = new GRETunnelConfiguration();
greTunnelConfiguration.setCaption("MyCaption");
greTunnelConfiguration.setInstanceID("MyInstanceId");
greTunnelService.setGRETunnelConfiguration(greTunnelConfiguration);
return greTunnelService;
}
} | Java |
/////////////////////////////////////////////////////////////////////////////
// Name: wx/spinbutt.h
// Purpose: wxSpinButtonBase class
// Author: Julian Smart, Vadim Zeitlin
// Modified by:
// Created: 23.07.99
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SPINBUTT_H_BASE_
#define _WX_SPINBUTT_H_BASE_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_SPINBTN
#include "wx/control.h"
#include "wx/event.h"
#include "wx/range.h"
#define wxSPIN_BUTTON_NAME wxT("wxSpinButton")
// ----------------------------------------------------------------------------
// The wxSpinButton is like a small scrollbar than is often placed next
// to a text control.
//
// Styles:
// wxSP_HORIZONTAL: horizontal spin button
// wxSP_VERTICAL: vertical spin button (the default)
// wxSP_ARROW_KEYS: arrow keys increment/decrement value
// wxSP_WRAP: value wraps at either end
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxSpinButtonBase : public wxControl
{
public:
// ctor initializes the range with the default (0..100) values
wxSpinButtonBase() { m_min = 0; m_max = 100; }
// accessors
virtual int GetValue() const = 0;
virtual int GetMin() const { return m_min; }
virtual int GetMax() const { return m_max; }
wxRange GetRange() const { return wxRange( GetMin(), GetMax() );}
// operations
virtual void SetValue(int val) = 0;
virtual void SetMin(int minVal) { SetRange ( minVal , m_max ) ; }
virtual void SetMax(int maxVal) { SetRange ( m_min , maxVal ) ; }
virtual void SetRange(int minVal, int maxVal)
{
m_min = minVal;
m_max = maxVal;
}
void SetRange( const wxRange& range) { SetRange( range.GetMin(), range.GetMax()); }
// is this spin button vertically oriented?
bool IsVertical() const { return (m_windowStyle & wxSP_VERTICAL) != 0; }
protected:
// the range value
int m_min;
int m_max;
wxDECLARE_NO_COPY_CLASS(wxSpinButtonBase);
};
// ----------------------------------------------------------------------------
// include the declaration of the real class
// ----------------------------------------------------------------------------
#if defined(__WXUNIVERSAL__)
#include "wx/univ/spinbutt.h"
#elif defined(__WXMSW__)
#include "wx/msw/spinbutt.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/spinbutt.h"
#elif defined(__WXGTK20__)
#include "wx/gtk/spinbutt.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/spinbutt.h"
#elif defined(__WXMAC__)
#include "wx/osx/spinbutt.h"
#elif defined(__WXCOCOA__)
#include "wx/cocoa/spinbutt.h"
#elif defined(__WXPM__)
#include "wx/os2/spinbutt.h"
#endif
// ----------------------------------------------------------------------------
// the wxSpinButton event
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxSpinEvent : public wxNotifyEvent
{
public:
wxSpinEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
: wxNotifyEvent(commandType, winid)
{
}
wxSpinEvent(const wxSpinEvent& event) : wxNotifyEvent(event) {}
// get the current value of the control
int GetValue() const { return m_commandInt; }
void SetValue(int value) { m_commandInt = value; }
int GetPosition() const { return m_commandInt; }
void SetPosition(int pos) { m_commandInt = pos; }
virtual wxEvent *Clone() const { return new wxSpinEvent(*this); }
private:
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSpinEvent)
};
typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&);
#define wxSpinEventHandler(func) \
wxEVENT_HANDLER_CAST(wxSpinEventFunction, func)
// macros for handling spin events: notice that we must use the real values of
// the event type constants and not their references (wxEVT_SPIN[_UP/DOWN])
// here as otherwise the event tables could end up with non-initialized
// (because of undefined initialization order of the globals defined in
// different translation units) references in them
#define EVT_SPIN_UP(winid, func) \
wx__DECLARE_EVT1(wxEVT_SPIN_UP, winid, wxSpinEventHandler(func))
#define EVT_SPIN_DOWN(winid, func) \
wx__DECLARE_EVT1(wxEVT_SPIN_DOWN, winid, wxSpinEventHandler(func))
#define EVT_SPIN(winid, func) \
wx__DECLARE_EVT1(wxEVT_SPIN, winid, wxSpinEventHandler(func))
#endif // wxUSE_SPINBTN
#endif
// _WX_SPINBUTT_H_BASE_
| Java |
{extends file="layout.tpl"}
{block name="init"}
{$product_id={product attr="id"}}
{$pse_count=1}
{$product_virtual={product attr="virtual"}}
{$check_availability={config key="check-available-stock" default="1"}}
{/block}
{* Body Class *}
{block name="body-class"}page-product{/block}
{* Page Title *}
{block name='no-return-functions' append}
{loop name="product.seo.title" type="product" id=$product_id limit="1" with_prev_next_info="1"}
{$page_title = {$META_TITLE}}
{/loop}
{/block}
{* Meta *}
{block name="meta"}
{loop name="product.seo.meta" type="product" id=$product_id limit="1" with_prev_next_info="1"}
{include file="includes/meta-seo.html"}
{/loop}
{/block}
{* Breadcrumb *}
{block name='no-return-functions' append}
{$breadcrumbs = []}
{loop type="product" name="product_breadcrumb" id=$product_id limit="1" with_prev_next_info="1"}
{loop name="category_path" type="category-path" category="{$DEFAULT_CATEGORY}"}
{$breadcrumbs[] = ['title' => {$TITLE}, 'url'=> {$URL nofilter}]}
{/loop}
{$breadcrumbs[] = ['title' => {$TITLE}, 'url'=> {$URL nofilter}]}
{/loop}
{/block}
{* Content *}
{block name="main-content"}
{if $product_id}
<div class="main">
{loop name="product.details" type="product" id=$product_id limit="1" with_prev_next_info="1" with_prev_next_visible="1"}
<article id="product" class="col-main row" role="main" itemscope itemtype="http://schema.org/Product">
{$pse_count=$PSE_COUNT}
{* Use the meta tag to specify content that is not visible on the page in any way *}
{loop name="brand.feature" type="brand" product="{$ID}"}
<meta itemprop="brand" content="{$TITLE}">
{/loop}
{* Add custom feature if needed
{loop name="isbn.feature" type="feature" product="{$ID}" title="isbn"}
{loop name="isbn.value" type="feature_value" feature="{$ID}" product="{product attr="id"}"}
<meta itemprop="productID" content="isbn:{$TITLE}">
{/loop}
{/loop}
*}
{hook name="product.top" product="{$ID}"}
{ifhook rel="product.gallery"}
{hook name="product.gallery" product="{$ID}"}
{/ifhook}
{elsehook rel="product.gallery"}
<section id="product-gallery" class="col-sm-6">
{ifloop rel="image.main"}
<figure class="product-image">
{loop type="image" name="image.main" product="{$ID}" width="560" height="445" resize_mode="borders" limit="1"}
<img src="{$IMAGE_URL nofilter}" alt="{$TITLE}" class="img-responsive" itemprop="image" data-toggle="magnify">
{/loop}
</figure>
{/ifloop}
{ifloop rel="image.carousel"}
<div id="product-thumbnails" class="carousel slide" style="position:relative;">
<div class="carousel-inner">
<div class="item active">
<ul class="list-inline">
{loop name="image.carousel" type="image" product="{$ID}" width="560" height="445" resize_mode="borders" limit="5"}
<li>
<a href="{$IMAGE_URL nofilter}" class="thumbnail {if $LOOP_COUNT == 1}active{/if}">
{loop type="image" name="image.thumbs" id="{$ID}" product="$OBJECT_ID" width="118" height="85" resize_mode="borders"}
<img src="{$IMAGE_URL nofilter}" alt="{$TITLE}">
{/loop}
</a>
</li>
{/loop}
</ul>
</div>
{ifloop rel="image.carouselsup"}
<div class="item">
<ul class="list-inline">
{loop name="image.carouselsup" type="image" product="{$ID}" width="560" height="445" resize_mode="borders" offset="5"}
<li>
<a href="{$IMAGE_URL nofilter}" class="thumbnail">
{loop type="image" name="image.thumbssup" id="{$ID}" product="$OBJECT_ID" width="118" height="85" resize_mode="borders"}
<img src="{$IMAGE_URL nofilter}" alt="{$TITLE}">
{/loop}
</a>
</li>
{/loop}
</ul>
</div>
{/ifloop}
</div>
{ifloop rel="image.carouselsup"}
<a class="left carousel-control" href="#product-thumbnails" data-slide="prev"><i class="fa fa-caret-left"></i></a>
<a class="right carousel-control" href="#product-thumbnails" data-slide="next"><i class="fa fa-caret-right"></i></a>
{/ifloop}
</div>
{/ifloop}
</section>
{/elsehook}
<section id="product-details" class="col-sm-6">
{hook name="product.details-top" product="{$ID}"}
<div class="product-info">
<h1 class="name"><span itemprop="name">{$TITLE}</span><span id="pse-name" class="pse-name"></span></h1>
{if $REF}<span itemprop="sku" class="sku">{intl l='Ref.'}: <span id="pse-ref">{$REF}</span></span>{/if}
{loop name="brand_info" type="brand" product="{$ID}" limit="1"}
<p><a href="{$URL nofilter}" title="{intl l="More information about this brand"}"><span itemprop="brand">{$TITLE}</span></a></p>
{/loop}
{if $POSTSCRIPTUM}<div class="short-description">
<p>{$POSTSCRIPTUM}</p>
</div>{/if}
</div>
{loop type="sale" name="product-sale-info" product="{$ID}" active="1"}
<div class="product-promo">
<p class="sale-label">{$SALE_LABEL}</p>
<p class="sale-saving"> {intl l="Save %amount%sign on this product" amount={$PRICE_OFFSET_VALUE} sign={$PRICE_OFFSET_SYMBOL}}</p>
{if $HAS_END_DATE}
<p class="sale-period">{intl l="This offer is valid until %date" date={format_date date=$END_DATE output="date"}}</p>
{/if}
</div>
{/loop}
<div class="product-price" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<div class="availability">
<span class="availibity-label sr-only">{intl l="Availability"}: </span>
<span itemprop="availability" href="{$current_stock_href}" class="" id="pse-availability">
<span class="in">{intl l='In Stock'}</span>
<span class="out">{intl l='Out of Stock'}</span>
</span>
</div>
<div class="price-container">
{loop type="category" name="category_tag" id=$DEFAULT_CATEGORY}
<meta itemprop="category" content="{$TITLE}">
{/loop}
{* List of condition : NewCondition, DamagedCondition, UsedCondition, RefurbishedCondition *}
<meta itemprop="itemCondition" itemscope itemtype="http://schema.org/NewCondition">
{* List of currency : The currency used to describe the product price, in three-letter ISO format. *}
<meta itemprop="priceCurrency" content="{currency attr="symbol"}">
<span id="pse-promo">
<span class="special-price"><span itemprop="price" class="price-label">{intl l="Special Price:"} </span><span id="pse-price" class="price">{format_money number=$TAXED_PROMO_PRICE}</span></span>
{if $SHOW_ORIGINAL_PRICE}
<span class="old-price"><span class="price-label">{intl l="Regular Price:"} </span><span id="pse-price-old" class="price">{format_money number=$TAXED_PRICE}</span></span>
{/if}
</span>
</div>
<div id="pse-validity" class="validity alert alert-warning" style="display: none;" >
{intl l="Sorry but this combination does not exist."}
</div>
</div>
{form name="thelia.cart.add" }
<form id="form-product-details" action="{url path="/cart/add" }" method="post" class="form-product">
{form_hidden_fields}
<input type="hidden" name="view" value="product">
<input type="hidden" name="product_id" value="{$ID}">
{form_field field="append"}
<input type="hidden" name="{$name}" value="1">
{/form_field}
{if $form_error}<div class="alert alert-error">{$form_error_message}</div>{/if}
{form_field field="product"}
<input id="{$label_attr.for}" type="hidden" name="{$name}" value="{$ID}" {$attr} >
{/form_field}
{* pse *}
{form_field field='product_sale_elements_id'}
<input id="pse-id" class="pse-id" type="hidden" name="{$name}" value="{$PRODUCT_SALE_ELEMENT}" {$attr} >
{/form_field}
{if $pse_count > 1}
{* We have more than 1 combination: custom form *}
<fieldset id="pse-options" class="product-options">
{loop name="attributes" type="attribute" product="$product_id" order="manual"}
<div class="option option-option">
<label for="option-{$ID}" class="option-heading">{$TITLE}</label>
<div class="option-content clearfix">
<select id="option-{$ID}" name="option-{$ID}" class="form-control input-sm pse-option" data-attribute="{$ID}"></select>
</div>
</div>
{/loop}
<div class="option option-fallback">
<label for="option-fallback" class="option-heading">{intl l="Options"}</label>
<div class="option-content clearfix">
<select id="option-fallback" name="option-fallback" class="form-control input-sm pse-option pse-fallback" data-attribute="0"></select>
</div>
</div>
</fieldset>
{/if}
<fieldset class="product-cart form-inline">
{form_field field='quantity'}
<div class="form-group group-qty {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label for="{$label_attr.for}">{$label}</label>
<input type="number" name="{$name}" id="{$label_attr.for}" class="form-control" value="{$value|default:1}" min="1" required>
{if $error }
<span class="help-block">{$message}</span>
{elseif $value != "" && !$error}
<span class="help-block"><i class="fa fa-check"></i></span>
{/if}
</div>
{/form_field}
<div class="form-group group-btn">
<button id="pse-submit" type="submit" class="btn btn_add_to_cart btn-primary"><i class="fa fa-chevron-right"></i> {intl l="Add to cart"}</button>
</div>
</fieldset>
</form>
{/form}
{hook name="product.details-bottom" product="{$ID}"}
</section>
{strip}
{capture "additional"}
{ifloop rel="feature_info"}
<ul>
{loop name="feature_info" type="feature" product="{$ID}"}
{ifloop rel="feature_value_info"}
<li>
<strong>{$TITLE}</strong> :
{loop name="feature_value_info" type="feature_value" feature="{$ID}" product="{product attr="id"}"}
{if $LOOP_COUNT > 1}, {else} {/if}
<span>{if $IS_FREE_TEXT == 1}{$FREE_TEXT_VALUE}{else}{$TITLE}{/if}</span>
{/loop}
</li>
{/ifloop}
{/loop}
</ul>
{/ifloop}
{/capture}
{/strip}
{strip}
{capture "brand_info"}
{loop name="brand_info" type="brand" product="{$ID}" limit="1"}
<p><strong><a href="{$URL nofilter}">{$TITLE}</a></strong></p>
{loop name="brand.image" type="image" source="brand" id={$LOGO_IMAGE_ID} width=218 height=146 resize_mode="borders"}
<p><a href="{$URL nofilter}"><img itemprop="image" src="{$IMAGE_URL nofilter}" alt="{$TITLE}"></a></p>
{/loop}
{if $CHAPO}
<div class="chapo">
{$CHAPO}
</div>
{/if}
{if $DESCRIPTION}
<div class="description">
{$DESCRIPTION nofilter}
</div>
{/if}
{if $POSTSCRIPTUM}
<small class="postscriptum">
{$POSTSCRIPTUM}
</small>
{/if}
{/loop}
{/capture}
{/strip}
{strip}
{capture "document"}
{ifloop rel="document"}
<ul>
{loop name="document" type="document" product=$ID visible="yes"}
<li>
<a href="{$DOCUMENT_URL}" title="{$TITLE}" target="_blank">{$TITLE}</a>
</li>
{/loop}
</ul>
{/ifloop}
{/capture}
{/strip}
<section id="product-tabs" class="col-sm-12">
{hookblock name="product.additional" product="{product attr="id"}" fields="id,class,title,content"}
<ul class="nav nav-tabs" role="tablist">
<li class="active" role="presentation"><a id="tab1" href="#description" data-toggle="tab" role="tab">{intl l="Description"}</a></li>
{if $smarty.capture.additional ne ""}<li role="presentation"><a id="tab2" href="#additional" data-toggle="tab" role="tab">{intl l="Additional Info"}</a></li>{/if}
{if $smarty.capture.brand_info ne ""}<li role="presentation"><a id="tab3" href="#brand_info" data-toggle="tab" role="tab">{intl l="Brand information"}</a></li>{/if}
{if $smarty.capture.document ne ""}<li role="presentation"><a id="tab4" href="#document" data-toggle="tab" role="tab">{intl l="Documents"}</a></li>{/if}
{forhook rel="product.additional"}
<li role="presentation"><a id="tab{$id}" href="#{$id}" data-toggle="tab" role="tab">{$title}</a></li>
{/forhook}
</ul>
<div class="tab-content">
<div class="tab-pane active in" id="description" itemprop="description" role="tabpanel" aria-labelledby="tab1">
<p>{$DESCRIPTION|default:'N/A' nofilter}</p>
</div>
{if $smarty.capture.additional ne ""}
<div class="tab-pane" id="additional" role="tabpanel" aria-labelledby="tab2">
{$smarty.capture.additional nofilter}
</div>
{/if}
{if $smarty.capture.brand_info ne ""}
<div class="tab-pane" id="brand_info" role="tabpanel" aria-labelledby="tab3">
{$smarty.capture.brand_info nofilter}
</div>
{/if}
{if $smarty.capture.document ne ""}
<div class="tab-pane" id="document" role="tabpanel" aria-labelledby="tab4">
{$smarty.capture.document nofilter}
</div>
{/if}
{forhook rel="product.additional"}
<div class="tab-pane" id="{$id}" role="tabpanel" aria-labelledby="tab{$id}">
{$content nofilter}
</div>
{/forhook}
</div>
{/hookblock}
</section>
{hook name="product.bottom" product="{$ID}"}
{* javascript confiuguration to display pse *}
{$pse=[]}
{$combination_label=[]}
{$combination_values=[]}
{loop name="pse" type="product_sale_elements" product="{product attr="id"}"}
{$pse[$ID]=["id" => $ID, "isDefault" => $IS_DEFAULT, "isPromo" => $IS_PROMO, "isNew" => $IS_NEW, "ref" => "{$REF}", "ean" => "{$EAN}", "quantity" => {$QUANTITY}, "price" => "{format_money number=$TAXED_PRICE}", "promo" => "{format_money number=$TAXED_PROMO_PRICE}" ]}
{$pse_combination=[]}
{loop name="combi" type="attribute_combination" product_sale_elements="$ID" order="manual"}
{if ! $combination_label[$ATTRIBUTE_ID]}
{$combination_label[$ATTRIBUTE_ID]=["name" => "{$ATTRIBUTE_TITLE}", "values" => []]}
{/if}
{if ! $combination_values[$ATTRIBUTE_AVAILABILITY_ID]}
{$combination_label[$ATTRIBUTE_ID]["values"][]=$ATTRIBUTE_AVAILABILITY_ID}
{$combination_values[$ATTRIBUTE_AVAILABILITY_ID]=["{$ATTRIBUTE_AVAILABILITY_TITLE}", $ATTRIBUTE_ID]}
{/if}
{$pse_combination[]=$ATTRIBUTE_AVAILABILITY_ID}
{/loop}
{$pse[$ID]["combinations"]=$pse_combination}
{/loop}
<script type="text/javascript">
// Product sale elements
var PSE_FORM = true;
var PSE_COUNT = {$pse_count};
{if $check_availability == 0 || $product_virtual == 1 }
var PSE_CHECK_AVAILABILITY = false;
{else}
var PSE_CHECK_AVAILABILITY = true;
{/if}
var PSE_DEFAULT_AVAILABLE_STOCK = {config key="default_available_stock" default="100"};
var PSE = {$pse|json_encode nofilter};
var PSE_COMBINATIONS = {$combination_label|json_encode nofilter};
var PSE_COMBINATIONS_VALUE = {$combination_values|json_encode nofilter};
</script>
</article><!-- /#product -->
<ul class="pager">
{if $HAS_PREVIOUS == 1}
{loop type="product" name="prev_product" id="{$PREVIOUS}"}
<li class="previous"><a href="{$URL nofilter}"><i class="fa fa-chevron-left"></i> {intl l="Previous product"}</a></li>
{/loop}
{/if}
{if $HAS_NEXT == 1}
{loop type="product" name="next_product" id="{$NEXT}"}
<li class="next"><a href="{$URL nofilter}"><i class="fa fa-chevron-right"></i> {intl l="Next product"}</a></li>
{/loop}
{/if}
</ul>
{/loop}
</div><!-- /.main -->
{else}
<div class="main">
<article id="content-main" class="col-main" role="main" aria-labelledby="main-label">
{include file="includes/empty.html"}
</article>
</div><!-- /.layout -->
{/if}
{/block}
{block name="stylesheet"}
{hook name="product.stylesheet"}
{/block}
{block name="after-javascript-include"}
{hook name="product.after-javascript-include"}
{/block}
{block name="javascript-initialization"}
{hook name="product.javascript-initialization"}
{/block}
| Java |
/* =========================================================================
* This file is part of six.sicd-c++
* =========================================================================
*
* (C) Copyright 2004 - 2014, MDA Information Systems LLC
*
* six.sicd-c++ is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 program; If not,
* see <http://www.gnu.org/licenses/>.
*
*/
#ifndef __SIX_GRID_H__
#define __SIX_GRID_H__
#include <mem/ScopedCopyablePtr.h>
#include <mem/ScopedCloneablePtr.h>
#include "six/Types.h"
#include "six/Init.h"
#include "six/Parameter.h"
#include "six/ParameterCollection.h"
namespace six
{
namespace sicd
{
struct WeightType
{
WeightType();
/*!
* Type of aperture weighting applied in the spatial
* frequency domain to yield the impulse response in the r/c
* direction. Examples include UNIFORM, TAYLOR, HAMMING, UNKNOWN
*/
std::string windowName;
/*!
* Optional free format field that can be used to pass forward the
* weighting parameter information.
* This is present in 1.0 (but not 0.4.1) and can be 0 to unbounded
*/
ParameterCollection parameters;
};
/*!
* \struct DirectionParameters
* \brief Struct for SICD Row/Col Parameters
*
* Parameters describing increasing row or column
* direction image coords
*/
struct DirectionParameters
{
DirectionParameters();
DirectionParameters* clone() const;
//! Unit vector in increasing row or col direction
Vector3 unitVector;
//! Sample spacing in row or col direction
double sampleSpacing;
//! Half-power impulse response width in increasing row/col dir
//! Measured at scene center point
double impulseResponseWidth;
//! FFT sign
FFTSign sign;
//! Spatial bandwidth in Krow/Kcol used to form the impulse response
//! in row/col direction, measured at scene center
double impulseResponseBandwidth;
//! Center spatial frequency in the Krow/Kcol
double kCenter;
//! Minimum r/c offset from kCenter of spatial freq support for image
double deltaK1;
//! Maximum r/c offset from kCenter of spatial freq support for image
double deltaK2;
/*!
* Offset from kCenter of the center of support in the r/c
* spatial frequency. The polynomial is a function of the image
* r/c
*/
Poly2D deltaKCOAPoly;
//! Optional parameters describing the aperture weighting
mem::ScopedCopyablePtr<WeightType> weightType;
/*!
* Sampled aperture amplitude weighting function applied
* in Krow/col to form the SCP impulse response in the row
* direction
* \note You cannot have less than two weights if you have any
* 2 <= NW <= 512 according to spec
*
* \todo could make this an object (WeightFunction)
*
*/
std::vector<double> weights;
};
/*!
* \struct Grid
* \brief SICD Grid parameters
*
* The block of parameters that describes the image sample grid
*
*/
struct Grid
{
//! TODO what to do with plane
Grid();
Grid* clone() const;
ComplexImagePlaneType imagePlane;
ComplexImageGridType type;
Poly2D timeCOAPoly;
mem::ScopedCloneablePtr<DirectionParameters> row;
mem::ScopedCloneablePtr<DirectionParameters> col;
};
}
}
#endif
| Java |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Result'
db.create_table('taxonomy_result', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('title', self.gf('django.db.models.fields.CharField')(max_length=100)),
('content_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'])),
('object_id', self.gf('django.db.models.fields.PositiveIntegerField')()),
))
db.send_create_signal('taxonomy', ['Result'])
# Adding model 'Tag'
db.create_table('taxonomy_tag', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('title', self.gf('django.db.models.fields.CharField')(unique=True, max_length=100)),
('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=50, db_index=True)),
))
db.send_create_signal('taxonomy', ['Tag'])
# Adding model 'Category'
db.create_table('taxonomy_category', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('parent', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='children', null=True, to=orm['taxonomy.Category'])),
('title', self.gf('django.db.models.fields.CharField')(unique=True, max_length=100)),
('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=50, db_index=True)),
))
db.send_create_signal('taxonomy', ['Category'])
# Adding model 'Vote'
db.create_table('taxonomy_vote', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('content_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'])),
('object_id', self.gf('django.db.models.fields.PositiveIntegerField')()),
('owner', self.gf('django.db.models.fields.related.ForeignKey')(related_name='poll_votes', to=orm['auth.User'])),
('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
))
db.send_create_signal('taxonomy', ['Vote'])
# Adding unique constraint on 'Vote', fields ['owner', 'content_type', 'object_id']
db.create_unique('taxonomy_vote', ['owner_id', 'content_type_id', 'object_id'])
def backwards(self, orm):
# Removing unique constraint on 'Vote', fields ['owner', 'content_type', 'object_id']
db.delete_unique('taxonomy_vote', ['owner_id', 'content_type_id', 'object_id'])
# Deleting model 'Result'
db.delete_table('taxonomy_result')
# Deleting model 'Tag'
db.delete_table('taxonomy_tag')
# Deleting model 'Category'
db.delete_table('taxonomy_category')
# Deleting model 'Vote'
db.delete_table('taxonomy_vote')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'taxonomy.category': {
'Meta': {'ordering': "('title',)", 'object_name': 'Category'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['taxonomy.Category']"}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'})
},
'taxonomy.result': {
'Meta': {'object_name': 'Result'},
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'taxonomy.tag': {
'Meta': {'ordering': "('title',)", 'object_name': 'Tag'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'})
},
'taxonomy.vote': {
'Meta': {'unique_together': "(('owner', 'content_type', 'object_id'),)", 'object_name': 'Vote'},
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
'owner': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'poll_votes'", 'to': "orm['auth.User']"})
}
}
complete_apps = ['taxonomy']
| Java |
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Copyright (c) 2013-2020 The plumed team
(see the PEOPLE file at the root of the distribution for a list of names)
See http://www.plumed.org for more information.
This file is part of plumed, version 2.
plumed is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
plumed 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 plumed. If not, see <http://www.gnu.org/licenses/>.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
#ifndef __PLUMED_reference_SingleDomainRMSD_h
#define __PLUMED_reference_SingleDomainRMSD_h
#include "ReferenceAtoms.h"
namespace PLMD {
class Pbc;
class SingleDomainRMSD : public ReferenceAtoms {
protected:
void readReference( const PDB& pdb );
public:
explicit SingleDomainRMSD( const ReferenceConfigurationOptions& ro );
/// Set the reference structure
void setReferenceAtoms( const std::vector<Vector>& conf, const std::vector<double>& align_in, const std::vector<double>& displace_in ) override;
/// Calculate
double calc( const std::vector<Vector>& pos, const Pbc& pbc, const std::vector<Value*>& vals, const std::vector<double>& arg, ReferenceValuePack& myder, const bool& squared ) const override;
double calculate( const std::vector<Vector>& pos, const Pbc& pbc, ReferenceValuePack& myder, const bool& squared ) const;
/// Calculate the distance using the input position
virtual double calc( const std::vector<Vector>& pos, const Pbc& pbc, ReferenceValuePack& myder, const bool& squared ) const=0;
/// This sets upper and lower bounds on distances to be used in DRMSD (here it does nothing)
virtual void setBoundsOnDistances( bool dopbc, double lbound=0.0, double ubound=std::numeric_limits<double>::max( ) ) {};
/// This is used by MultiDomainRMSD to setup the RMSD object in Optimal RMSD type
virtual void setupRMSDObject() {};
};
}
#endif
| Java |
/*
* World Calendars
* https://github.com/alexcjohnson/world-calendars
*
* Batch-converted from kbwood/calendars
* Many thanks to Keith Wood and all of the contributors to the original project!
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* http://keith-wood.name/calendars.html
Traditional Chinese localisation for Taiwanese calendars for jQuery v2.0.2.
Written by Ressol ([email protected]). */
var main = require('../main');
main.calendars.taiwan.prototype.regionalOptions['zh-TW'] = {
name: 'Taiwan',
epochs: ['BROC', 'ROC'],
monthNames: ['一月','二月','三月','四月','五月','六月',
'七月','八月','九月','十月','十一月','十二月'],
monthNamesShort: ['一','二','三','四','五','六',
'七','八','九','十','十一','十二'],
dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
dayNamesMin: ['日','一','二','三','四','五','六'],
digits: null,
dateFormat: 'yyyy/mm/dd',
firstDay: 1,
isRTL: false
};
| Java |
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at GamerMan7799. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
| Java |
/***
*mbsupr.c - Convert string upper case (MBCS)
*
* Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Convert string upper case (MBCS)
*
*******************************************************************************/
#ifdef _MBCS
#if defined (_WIN32)
#include <awint.h>
#endif /* defined (_WIN32) */
#include <mtdll.h>
#include <cruntime.h>
#include <ctype.h>
#include <mbdata.h>
#include <mbstring.h>
#include <mbctype.h>
/***
* _mbsupr - Convert string upper case (MBCS)
*
*Purpose:
* Converts all the lower case characters in a string
* to upper case in place. Handles MBCS chars correctly.
*
*Entry:
* unsigned char *string = pointer to string
*
*Exit:
* Returns a pointer to the input string; no error return.
*
*Exceptions:
*
*******************************************************************************/
unsigned char * __cdecl _mbsupr(
unsigned char *string
)
{
unsigned char *cp;
_mlock(_MB_CP_LOCK);
for (cp=string; *cp; cp++)
{
if (_ISLEADBYTE(*cp))
{
#if defined (_WIN32)
int retval;
unsigned char ret[4];
if ((retval = __crtLCMapStringA(__mblcid,
LCMAP_UPPERCASE,
cp,
2,
ret,
2,
__mbcodepage,
TRUE)) == 0)
{
_munlock(_MB_CP_LOCK);
return NULL;
}
*cp = ret[0];
if (retval > 1)
*(++cp) = ret[1];
#else /* defined (_WIN32) */
int mbval = ((*cp) << 8) + *(cp+1);
cp++;
if ( mbval >= _MBLOWERLOW1
&& mbval <= _MBLOWERHIGH1 )
*cp -= _MBCASEDIFF1;
else if (mbval >= _MBLOWERLOW2
&& mbval <= _MBLOWERHIGH2 )
*cp -= _MBCASEDIFF2;
#endif /* defined (_WIN32) */
}
else
/* single byte, macro version */
*cp = (unsigned char) _mbbtoupper(*cp);
}
_munlock(_MB_CP_LOCK);
return string ;
}
#endif /* _MBCS */
| Java |
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<body>
<legend><a href="<?php echo base_url(); ?>" >Home</a> | <a href="<?php echo base_url(); ?>reviewer" >Refresh</a> | <?php echo anchor('reviewer/samples_for_review/'.$reviewer_id,'Worksheets Uploaded For Review'); ?> </legend>
<hr />
<!-- Menu Start -->
</div>
<!-- End Menu -->
<div>
<table id = "refsubs">
<thead>
<tr>
<th>File Name</th>
<th>Lab Reference No</th>
<th>Download </th>
<th>Status</th>
<th>Upload</th>
</tr>
</thead>
<tbody>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tbody>
</table>
<script type="text/javascript">
$('#refsubs').dataTable({
"bJQueryUI": true
}).rowGrouping({
iGroupingColumnIndex: 1,
sGroupingColumnSortDirection: "asc",
iGroupingOrderByColumnIndex: 1,
//bExpandableGrouping:true,
//bExpandSingleGroup: true,
iExpandGroupOffset: -1
});
</script>
</div>
</body>
</html>
| Java |
## Tutorials
Practical Android Exploitation: http://theroot.ninja/PAE.pdf
Android Application Security Tutorial Series: http://manifestsecurity.com/android-application-security/
Smartphone OS Security: http://www.csc.ncsu.edu/faculty/enck/csc591-s12/index.html
ExploitMe Mobile Android Labs: http://securitycompass.github.com/AndroidLabs/
ExploitMe Mobile iPhone Labs: http://securitycompass.github.com/iPhoneLabs/
Server for the two labs above: https://github.com/securitycompass/LabServer
DFRWS 2011 Forensics Challenge: http://dfrws.org/2011/challenge/index.shtml
Android Forensics & Security Testing: http://opensecuritytraining.info/AndroidForensics.html
Introduction to ARM: http://opensecuritytraining.info/IntroARM.html
Mobile App Security Certification: https://viaforensics.com/services/training/mobile-app-security-certification/
| Java |
'use strict';
import EventMap from 'eventmap';
import Log from './log';
var audioTypes = {
'mp3': 'audio/mpeg',
'wav': 'audio/wav',
'ogg': 'audio/ogg'
};
var imageTypes = {
'png': 'image/png',
'jpg': 'image/jpg',
'gif': 'image/gif'
};
class AssetLoader extends EventMap {
constructor(assets) {
super();
this.assets = assets || {};
this.files = {};
this.maxAssets = 0;
this.assetsLoaded = 0;
this.percentLoaded = 0;
this.cache = {};
}
start() {
// TODO: Something was wrong here. So it's deleted right now
}
}
export default AssetLoader;
| Java |
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/docdb/model/DescribePendingMaintenanceActionsResult.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/logging/LogMacros.h>
#include <utility>
using namespace Aws::DocDB::Model;
using namespace Aws::Utils::Xml;
using namespace Aws::Utils::Logging;
using namespace Aws::Utils;
using namespace Aws;
DescribePendingMaintenanceActionsResult::DescribePendingMaintenanceActionsResult()
{
}
DescribePendingMaintenanceActionsResult::DescribePendingMaintenanceActionsResult(const Aws::AmazonWebServiceResult<XmlDocument>& result)
{
*this = result;
}
DescribePendingMaintenanceActionsResult& DescribePendingMaintenanceActionsResult::operator =(const Aws::AmazonWebServiceResult<XmlDocument>& result)
{
const XmlDocument& xmlDocument = result.GetPayload();
XmlNode rootNode = xmlDocument.GetRootElement();
XmlNode resultNode = rootNode;
if (!rootNode.IsNull() && (rootNode.GetName() != "DescribePendingMaintenanceActionsResult"))
{
resultNode = rootNode.FirstChild("DescribePendingMaintenanceActionsResult");
}
if(!resultNode.IsNull())
{
XmlNode pendingMaintenanceActionsNode = resultNode.FirstChild("PendingMaintenanceActions");
if(!pendingMaintenanceActionsNode.IsNull())
{
XmlNode pendingMaintenanceActionsMember = pendingMaintenanceActionsNode.FirstChild("ResourcePendingMaintenanceActions");
while(!pendingMaintenanceActionsMember.IsNull())
{
m_pendingMaintenanceActions.push_back(pendingMaintenanceActionsMember);
pendingMaintenanceActionsMember = pendingMaintenanceActionsMember.NextNode("ResourcePendingMaintenanceActions");
}
}
XmlNode markerNode = resultNode.FirstChild("Marker");
if(!markerNode.IsNull())
{
m_marker = Aws::Utils::Xml::DecodeEscapedXmlText(markerNode.GetText());
}
}
if (!rootNode.IsNull()) {
XmlNode responseMetadataNode = rootNode.FirstChild("ResponseMetadata");
m_responseMetadata = responseMetadataNode;
AWS_LOGSTREAM_DEBUG("Aws::DocDB::Model::DescribePendingMaintenanceActionsResult", "x-amzn-request-id: " << m_responseMetadata.GetRequestId() );
}
return *this;
}
| Java |
<!--
Copyright 2019 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- [START picker_hello_world] -->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Google Picker Example</title>
<script type="text/javascript">
// The Browser API key obtained from the Google API Console.
// Replace with your own Browser API key, or your own key.
var developerKey = 'xxxxxxxYYYYYYYY-12345678';
// The Client ID obtained from the Google API Console. Replace with your own Client ID.
var clientId = "1234567890-abcdefghijklmnopqrstuvwxyz.apps.googleusercontent.com"
// Replace with your own project number from console.developers.google.com.
// See "Project number" under "IAM & Admin" > "Settings"
var appId = "1234567890";
// Scope to use to access user's Drive items.
var scope = ['https://www.googleapis.com/auth/drive.file'];
var pickerApiLoaded = false;
var oauthToken;
// Use the Google API Loader script to load the google.picker script.
function loadPicker() {
gapi.load('auth', {'callback': onAuthApiLoad});
gapi.load('picker', {'callback': onPickerApiLoad});
}
function onAuthApiLoad() {
window.gapi.auth.authorize(
{
'client_id': clientId,
'scope': scope,
'immediate': false
},
handleAuthResult);
}
function onPickerApiLoad() {
pickerApiLoaded = true;
createPicker();
}
function handleAuthResult(authResult) {
if (authResult && !authResult.error) {
oauthToken = authResult.access_token;
createPicker();
}
}
// Create and render a Picker object for searching images.
function createPicker() {
if (pickerApiLoaded && oauthToken) {
var view = new google.picker.View(google.picker.ViewId.DOCS);
view.setMimeTypes("image/png,image/jpeg,image/jpg");
var picker = new google.picker.PickerBuilder()
.enableFeature(google.picker.Feature.NAV_HIDDEN)
.enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
.setAppId(appId)
.setOAuthToken(oauthToken)
.addView(view)
.addView(new google.picker.DocsUploadView())
.setDeveloperKey(developerKey)
.setCallback(pickerCallback)
.build();
picker.setVisible(true);
}
}
// A simple callback implementation.
function pickerCallback(data) {
if (data.action == google.picker.Action.PICKED) {
var fileId = data.docs[0].id;
alert('The user selected: ' + fileId);
}
}
</script>
</head>
<body>
<div id="result"></div>
<!-- The Google API Loader script. -->
<script type="text/javascript" src="https://apis.google.com/js/api.js?onload=loadPicker"></script>
</body>
</html>
<!-- [END picker_hello_world] -->
| Java |
package examples.Bricklet.Moisture;
import com.tinkerforge.BrickletMoisture;
import com.tinkerforge.IPConnection;
public class ExampleSimple {
private static final String host = "localhost";
private static final int port = 4223;
private static final String UID = "XYZ"; // Change to your UID
// Note: To make the examples code cleaner we do not handle exceptions. Exceptions you
// might normally want to catch are described in the documentation
public static void main(String args[]) throws Exception {
IPConnection ipcon = new IPConnection(); // Create IP connection
BrickletMoisture al = new BrickletMoisture(UID, ipcon); // Create device object
ipcon.connect(host, port); // Connect to brickd
// Don't use device before ipcon is connected
// Get current moisture value
int moisture = al.getMoistureValue(); // Can throw com.tinkerforge.TimeoutException
System.out.println("Moisture Value: " + moisture);
System.console().readLine("Press key to exit\n");
ipcon.disconnect();
}
}
| Java |
/**
* Copyright 2015 LinkedIn Corp. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
package wherehows.ingestion.converters;
import com.linkedin.events.metadata.DatasetIdentifier;
import com.linkedin.events.metadata.DeploymentDetail;
import com.linkedin.events.metadata.MetadataChangeEvent;
import java.util.Collections;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
public class KafkaLogCompactionConverterTest {
@Test
public void testConvert() {
MetadataChangeEvent event = new MetadataChangeEvent();
event.datasetIdentifier = new DatasetIdentifier();
event.datasetIdentifier.dataPlatformUrn = "urn:li:dataPlatform:kafka";
DeploymentDetail deployment = new DeploymentDetail();
deployment.additionalDeploymentInfo = Collections.singletonMap("EI", "compact");
event.deploymentInfo = Collections.singletonList(deployment);
MetadataChangeEvent newEvent = new KafkaLogCompactionConverter().convert(event);
assertEquals(newEvent.datasetIdentifier.dataPlatformUrn, "urn:li:dataPlatform:kafka-lc");
}
@Test
public void testNotConvert() {
KafkaLogCompactionConverter converter = new KafkaLogCompactionConverter();
MetadataChangeEvent event = new MetadataChangeEvent();
event.datasetIdentifier = new DatasetIdentifier();
event.datasetIdentifier.dataPlatformUrn = "foo";
DeploymentDetail deployment = new DeploymentDetail();
deployment.additionalDeploymentInfo = Collections.singletonMap("EI", "compact");
event.deploymentInfo = Collections.singletonList(deployment);
MetadataChangeEvent newEvent = converter.convert(event);
assertEquals(newEvent.datasetIdentifier.dataPlatformUrn, "foo");
event.datasetIdentifier.dataPlatformUrn = "urn:li:dataPlatform:kafka";
event.deploymentInfo = null;
newEvent = converter.convert(event);
assertEquals(newEvent.datasetIdentifier.dataPlatformUrn, "urn:li:dataPlatform:kafka");
event.datasetIdentifier.dataPlatformUrn = "urn:li:dataPlatform:kafka";
deployment.additionalDeploymentInfo = Collections.singletonMap("EI", "delete");
event.deploymentInfo = Collections.singletonList(deployment);
newEvent = converter.convert(event);
assertEquals(newEvent.datasetIdentifier.dataPlatformUrn, "urn:li:dataPlatform:kafka");
}
}
| Java |
/* Copyright (C) 2013 Interactive Brokers LLC. All rights reserved. This code is subject to the terms
* and conditions of the IB API Non-Commercial License or the IB API Commercial License, as applicable. */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace IBApi
{
public class EClientErrors
{
public static readonly CodeMsgPair AlreadyConnected = new CodeMsgPair(501, "Already Connected.");
public static readonly CodeMsgPair CONNECT_FAIL = new CodeMsgPair(502, "Couldn't connect to TWS. Confirm that \"Enable ActiveX and Socket Clients\" is enabled on the TWS \"Configure->API\" menu.");
public static readonly CodeMsgPair UPDATE_TWS = new CodeMsgPair(503, "The TWS is out of date and must be upgraded.");
public static readonly CodeMsgPair NOT_CONNECTED = new CodeMsgPair(504, "Not connected");
public static readonly CodeMsgPair UNKNOWN_ID = new CodeMsgPair(505, "Fatal Error: Unknown message id.");
public static readonly CodeMsgPair FAIL_SEND_REQMKT = new CodeMsgPair(510, "Request Market Data Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_CANMKT = new CodeMsgPair(511, "Cancel Market Data Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_ORDER = new CodeMsgPair(512, "Order Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_ACCT = new CodeMsgPair(513, "Account Update Request Sending Error -");
public static readonly CodeMsgPair FAIL_SEND_EXEC = new CodeMsgPair(514, "Request For Executions Sending Error -");
public static readonly CodeMsgPair FAIL_SEND_CORDER = new CodeMsgPair(515, "Cancel Order Sending Error -");
public static readonly CodeMsgPair FAIL_SEND_OORDER = new CodeMsgPair(516, "Request Open Order Sending Error -");
public static readonly CodeMsgPair UNKNOWN_CONTRACT = new CodeMsgPair(517, "Unknown contract. Verify the contract details supplied.");
public static readonly CodeMsgPair FAIL_SEND_REQCONTRACT = new CodeMsgPair(518, "Request Contract Data Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_REQMKTDEPTH = new CodeMsgPair(519, "Request Market Depth Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_CANMKTDEPTH = new CodeMsgPair(520, "Cancel Market Depth Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_SERVER_LOG_LEVEL = new CodeMsgPair(521, "Set Server Log Level Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_FA_REQUEST = new CodeMsgPair(522, "FA Information Request Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_FA_REPLACE = new CodeMsgPair(523, "FA Information Replace Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_REQSCANNER = new CodeMsgPair(524, "Request Scanner Subscription Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_CANSCANNER = new CodeMsgPair(525, "Cancel Scanner Subscription Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_REQSCANNERPARAMETERS = new CodeMsgPair(526, "Request Scanner Parameter Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_REQHISTDATA = new CodeMsgPair(527, "Request Historical Data Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_CANHISTDATA = new CodeMsgPair(528, "Request Historical Data Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_REQRTBARS = new CodeMsgPair(529, "Request Real-time Bar Data Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_CANRTBARS = new CodeMsgPair(530, "Cancel Real-time Bar Data Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_REQCURRTIME = new CodeMsgPair(531, "Request Current Time Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_REQFUNDDATA = new CodeMsgPair(532, "Request Fundamental Data Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_CANFUNDDATA = new CodeMsgPair(533, "Cancel Fundamental Data Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_REQCALCIMPLIEDVOLAT = new CodeMsgPair(534, "Request Calculate Implied Volatility Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_REQCALCOPTIONPRICE = new CodeMsgPair(535, "Request Calculate Option Price Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_CANCALCIMPLIEDVOLAT = new CodeMsgPair(536, "Cancel Calculate Implied Volatility Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_CANCALCOPTIONPRICE = new CodeMsgPair(537, "Cancel Calculate Option Price Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_REQGLOBALCANCEL = new CodeMsgPair(538, "Request Global Cancel Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_REQMARKETDATATYPE = new CodeMsgPair(539, "Request Market Data Type Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_REQPOSITIONS = new CodeMsgPair(540, "Request Positions Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_CANPOSITIONS = new CodeMsgPair(541, "Cancel Positions Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_REQACCOUNTDATA = new CodeMsgPair(542, "Request Account Data Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_CANACCOUNTDATA = new CodeMsgPair(543, "Cancel Account Data Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_VERIFYREQUEST = new CodeMsgPair(544, "Verify Request Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_VERIFYMESSAGE = new CodeMsgPair(545, "Verify Message Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_QUERYDISPLAYGROUPS = new CodeMsgPair(546, "Query Display Groups Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_SUBSCRIBETOGROUPEVENTS = new CodeMsgPair(547, "Subscribe To Group Events Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_UPDATEDISPLAYGROUP = new CodeMsgPair(548, "Update Display Group Sending Error - ");
public static readonly CodeMsgPair FAIL_SEND_UNSUBSCRIBEFROMGROUPEVENTS = new CodeMsgPair(549, "Unsubscribe From Group Events Sending Error - ");
public static readonly CodeMsgPair FAIL_GENERIC = new CodeMsgPair(-1, "Specific error message needs to be given for these requests! ");
}
public class CodeMsgPair
{
private int code;
private string message;
public CodeMsgPair(int code, string message)
{
this.code = code;
this.message = message;
}
public int Code
{
get { return code; }
}
public string Message
{
get { return message; }
}
}
}
| Java |
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.util;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.model.ModelHelper;
/**
*
*/
public class DumpModelAsXmlChoiceFilterRouteTest extends ContextTestSupport {
public void testDumpModelAsXml() throws Exception {
String xml = ModelHelper.dumpModelAsXml(context.getRouteDefinition("myRoute"));
assertNotNull(xml);
log.info(xml);
assertTrue(xml.contains("<header>gold</header>"));
assertTrue(xml.contains("<header>extra-gold</header>"));
assertTrue(xml.contains("<simple>${body} contains Camel</simple>"));
}
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").routeId("myRoute")
.to("log:input")
.choice()
.when().header("gold")
.to("mock:gold")
.filter().header("extra-gold")
.to("mock:extra-gold")
.endChoice()
.when().simple("${body} contains Camel")
.to("mock:camel")
.otherwise()
.to("mock:other")
.end()
.to("mock:result");
}
};
}
}
| Java |
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.template.api;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.UriInfo;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.template.data.TemplateData;
import org.apache.fineract.template.domain.Template;
import org.apache.fineract.template.domain.TemplateEntity;
import org.apache.fineract.template.domain.TemplateType;
import org.apache.fineract.template.service.TemplateDomainService;
import org.apache.fineract.template.service.TemplateMergeService;
import org.codehaus.jackson.map.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path("/templates")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Component
@Scope("singleton")
public class TemplatesApiResource {
private final Set<String> RESPONSE_TEMPLATES_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id"));
private final Set<String> RESPONSE_TEMPLATE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "entities", "types", "template"));
private final String RESOURCE_NAME_FOR_PERMISSION = "template";
private final PlatformSecurityContext context;
private final DefaultToApiJsonSerializer<Template> toApiJsonSerializer;
private final DefaultToApiJsonSerializer<TemplateData> templateDataApiJsonSerializer;
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final TemplateDomainService templateService;
private final TemplateMergeService templateMergeService;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
@Autowired
public TemplatesApiResource(final PlatformSecurityContext context, final DefaultToApiJsonSerializer<Template> toApiJsonSerializer,
final DefaultToApiJsonSerializer<TemplateData> templateDataApiJsonSerializer,
final ApiRequestParameterHelper apiRequestParameterHelper, final TemplateDomainService templateService,
final TemplateMergeService templateMergeService,
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
this.context = context;
this.toApiJsonSerializer = toApiJsonSerializer;
this.templateDataApiJsonSerializer = templateDataApiJsonSerializer;
this.apiRequestParameterHelper = apiRequestParameterHelper;
this.templateService = templateService;
this.templateMergeService = templateMergeService;
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
}
@GET
public String retrieveAll(@DefaultValue("-1") @QueryParam("typeId") final int typeId,
@DefaultValue("-1") @QueryParam("entityId") final int entityId, @Context final UriInfo uriInfo) {
this.context.authenticatedUser().validateHasReadPermission(this.RESOURCE_NAME_FOR_PERMISSION);
// FIXME - we dont use the ORM when doing fetches - we write SQL and
// fetch through JDBC returning data to be serialized to JSON
List<Template> templates = new ArrayList<>();
if (typeId != -1 && entityId != -1) {
templates = this.templateService.getAllByEntityAndType(TemplateEntity.values()[entityId], TemplateType.values()[typeId]);
} else {
templates = this.templateService.getAll();
}
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, templates, this.RESPONSE_TEMPLATES_DATA_PARAMETERS);
}
@GET
@Path("template")
public String template(@Context final UriInfo uriInfo) {
this.context.authenticatedUser().validateHasReadPermission(this.RESOURCE_NAME_FOR_PERMISSION);
final TemplateData templateData = TemplateData.template();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.templateDataApiJsonSerializer.serialize(settings, templateData, this.RESPONSE_TEMPLATES_DATA_PARAMETERS);
}
@POST
public String createTemplate(final String apiRequestBodyAsJson) {
final CommandWrapper commandRequest = new CommandWrapperBuilder().createTemplate().withJson(apiRequestBodyAsJson).build();
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
return this.toApiJsonSerializer.serialize(result);
}
@GET
@Path("{templateId}")
public String retrieveOne(@PathParam("templateId") final Long templateId, @Context final UriInfo uriInfo) {
this.context.authenticatedUser().validateHasReadPermission(this.RESOURCE_NAME_FOR_PERMISSION);
final Template template = this.templateService.findOneById(templateId);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, template, this.RESPONSE_TEMPLATES_DATA_PARAMETERS);
}
@GET
@Path("{templateId}/template")
public String getTemplateByTemplate(@PathParam("templateId") final Long templateId, @Context final UriInfo uriInfo) {
this.context.authenticatedUser().validateHasReadPermission(this.RESOURCE_NAME_FOR_PERMISSION);
final TemplateData template = TemplateData.template(this.templateService.findOneById(templateId));
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.templateDataApiJsonSerializer.serialize(settings, template, this.RESPONSE_TEMPLATE_DATA_PARAMETERS);
}
@PUT
@Path("{templateId}")
public String saveTemplate(@PathParam("templateId") final Long templateId, final String apiRequestBodyAsJson) {
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateTemplate(templateId).withJson(apiRequestBodyAsJson).build();
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
return this.toApiJsonSerializer.serialize(result);
}
@DELETE
@Path("{templateId}")
public String deleteTemplate(@PathParam("templateId") final Long templateId) {
final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteTemplate(templateId).build();
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
return this.toApiJsonSerializer.serialize(result);
}
@POST
@Path("{templateId}")
@Produces({ MediaType.TEXT_HTML })
public String mergeTemplate(@PathParam("templateId") final Long templateId, @Context final UriInfo uriInfo,
final String apiRequestBodyAsJson) throws MalformedURLException, IOException {
final Template template = this.templateService.findOneById(templateId);
@SuppressWarnings("unchecked")
final HashMap<String, Object> result = new ObjectMapper().readValue(apiRequestBodyAsJson, HashMap.class);
final MultivaluedMap<String, String> parameters = uriInfo.getQueryParameters();
final Map<String, Object> parametersMap = new HashMap<>();
for (final Map.Entry<String, List<String>> entry : parameters.entrySet()) {
if (entry.getValue().size() == 1) {
parametersMap.put(entry.getKey(), entry.getValue().get(0));
} else {
parametersMap.put(entry.getKey(), entry.getValue());
}
}
parametersMap.put("BASE_URI", uriInfo.getBaseUri());
parametersMap.putAll(result);
return this.templateMergeService.compile(template, parametersMap);
}
} | Java |
#import <Foundation/Foundation.h>
#import "WXApmProtocol.h"
@interface WXApmImpl : NSObject <WXApmProtocol>
@end
| Java |
/*
* Copyright (C) 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#if ENABLE(DFG_JIT)
#include "ObjectPropertyCondition.h"
#include "Watchpoint.h"
namespace JSC { namespace DFG {
class AdaptiveStructureWatchpoint : public Watchpoint {
public:
AdaptiveStructureWatchpoint(const ObjectPropertyCondition&, CodeBlock*);
const ObjectPropertyCondition& key() const { return m_key; }
void install();
protected:
void fireInternal(const FireDetail&) override;
private:
ObjectPropertyCondition m_key;
CodeBlock* m_codeBlock;
};
} } // namespace JSC::DFG
#endif // ENABLE(DFG_JIT)
| Java |
/*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.jsmpp.bean;
/**
* This is simple DataCoding. Only contains Alphabet (DEFAULT and 8-bit) and
* Message Class.
*
* @author uudashr
*
*/
public class SimpleDataCoding implements DataCoding {
private final Alphabet alphabet;
private final MessageClass messageClass;
/**
* Construct Data Coding using default Alphabet and
* {@link MessageClass#CLASS1} Message Class.
*/
public SimpleDataCoding() {
this(Alphabet.ALPHA_DEFAULT, MessageClass.CLASS1);
}
/**
* Construct Data Coding using specified Alphabet and Message Class.
*
* @param alphabet is the alphabet. Only support
* {@link Alphabet#ALPHA_DEFAULT} and {@link Alphabet#ALPHA_8_BIT}.
* @param messageClass
* @throws IllegalArgumentException if alphabet is <tt>null</tt> or using
* non {@link Alphabet#ALPHA_DEFAULT} and
* {@link Alphabet#ALPHA_8_BIT} alphabet or
* <code>messageClass</code> is null.
*/
public SimpleDataCoding(Alphabet alphabet, MessageClass messageClass) throws IllegalArgumentException {
if (alphabet == null) {
throw new IllegalArgumentException(
"Alphabet is mandatory, can't be null");
}
if (alphabet.equals(Alphabet.ALPHA_UCS2)
|| alphabet.isReserved()) {
throw new IllegalArgumentException(
"Supported alphabet for SimpleDataCoding does not include "
+ Alphabet.ALPHA_UCS2 + " or "
+ "reserved alphabet codes. Current alphabet is " + alphabet);
}
if (messageClass == null) {
throw new IllegalArgumentException(
"MessageClass is mandatory, can't be null");
}
this.alphabet = alphabet;
this.messageClass = messageClass;
}
public Alphabet getAlphabet() {
return alphabet;
}
public MessageClass getMessageClass() {
return messageClass;
}
public byte toByte() {
// base byte is 11110xxx or 0xf0, others injected
byte value = (byte)0xf0;
value |= alphabet.value();
value |= messageClass.value();
return value;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((alphabet == null) ? 0 : alphabet.hashCode());
result = prime * result
+ ((messageClass == null) ? 0 : messageClass.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SimpleDataCoding other = (SimpleDataCoding)obj;
if (alphabet == null) {
if (other.alphabet != null)
return false;
} else if (!alphabet.equals(other.alphabet))
return false;
if (messageClass == null) {
if (other.messageClass != null)
return false;
} else if (!messageClass.equals(other.messageClass))
return false;
return true;
}
@Override
public String toString() {
return "DataCoding:" + (0xff & toByte());
}
}
| Java |
/*
File: CASharedLibrary.h
Abstract: Part of CoreAudio Utility Classes
Version: 1.0.3
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
"Apple Software"), to use, reproduce, modify and redistribute the Apple
Software, with or without modifications, in source and/or binary forms;
provided that if you redistribute the Apple Software in its entirety and
without modifications, you must retain this notice and the following
text and disclaimers in all such redistributions of the Apple Software.
Neither the name, trademarks, service marks or logos of Apple Inc. may
be used to endorse or promote products derived from the Apple Software
without specific prior written permission from Apple. Except as
expressly stated in this notice, no other rights or licenses, express or
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Copyright (C) 2013 Apple Inc. All Rights Reserved.
*/
#if !defined(__CASharedLibrary_h__)
#define __CASharedLibrary_h__
//=============================================================================
// CASharedLibrary
//=============================================================================
class CASharedLibrary
{
// Symbol Operations
public:
static void* LoadLibraryAndGetRoutineAddress(const char* inRoutineName, const char* inLibraryName, const char* inLibraryPath);
static void* GetRoutineAddressIfLibraryLoaded(const char* inRoutineName, const char* inLibraryName, const char* inLibraryPath);
};
#endif
| Java |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""System tests for Google Cloud Memorystore operators"""
import os
from urllib.parse import urlparse
import pytest
from tests.providers.google.cloud.utils.gcp_authenticator import GCP_MEMORYSTORE
from tests.test_utils.gcp_system_helpers import CLOUD_DAG_FOLDER, GoogleSystemTest, provide_gcp_context
GCP_PROJECT_ID = os.environ.get("GCP_PROJECT_ID", "example-project")
GCP_ARCHIVE_URL = os.environ.get("GCP_MEMORYSTORE_EXPORT_GCS_URL", "gs://test-memorystore/my-export.rdb")
GCP_ARCHIVE_URL_PARTS = urlparse(GCP_ARCHIVE_URL)
GCP_BUCKET_NAME = GCP_ARCHIVE_URL_PARTS.netloc
@pytest.mark.backend("mysql", "postgres")
@pytest.mark.credential_file(GCP_MEMORYSTORE)
class CloudMemorystoreSystemTest(GoogleSystemTest):
"""
System tests for Google Cloud Memorystore operators
It use a real service.
"""
@provide_gcp_context(GCP_MEMORYSTORE)
def setUp(self):
super().setUp()
self.create_gcs_bucket(GCP_BUCKET_NAME, location="europe-north1")
@provide_gcp_context(GCP_MEMORYSTORE)
def test_run_example_dag_memorystore_redis(self):
self.run_dag('gcp_cloud_memorystore_redis', CLOUD_DAG_FOLDER)
@provide_gcp_context(GCP_MEMORYSTORE)
def test_run_example_dag_memorystore_memcached(self):
self.run_dag('gcp_cloud_memorystore_memcached', CLOUD_DAG_FOLDER)
@provide_gcp_context(GCP_MEMORYSTORE)
def tearDown(self):
self.delete_gcs_bucket(GCP_BUCKET_NAME)
super().tearDown()
| Java |
/*
* Copyright 2013-2014 Richard M. Hightower
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* __________ _____ __ .__
* \______ \ ____ ____ ____ /\ / \ _____ | | _|__| ____ ____
* | | _// _ \ / _ \ / \ \/ / \ / \\__ \ | |/ / |/ \ / ___\
* | | ( <_> | <_> ) | \ /\ / Y \/ __ \| <| | | \/ /_/ >
* |______ /\____/ \____/|___| / \/ \____|__ (____ /__|_ \__|___| /\___ /
* \/ \/ \/ \/ \/ \//_____/
* ____. ___________ _____ ______________.___.
* | |____ ___ _______ \_ _____/ / _ \ / _____/\__ | |
* | \__ \\ \/ /\__ \ | __)_ / /_\ \ \_____ \ / | |
* /\__| |/ __ \\ / / __ \_ | \/ | \/ \ \____ |
* \________(____ /\_/ (____ / /_______ /\____|__ /_______ / / ______|
* \/ \/ \/ \/ \/ \/
*/
package org.boon.validation.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention ( RetentionPolicy.RUNTIME )
@Target ( { ElementType.METHOD, ElementType.TYPE, ElementType.FIELD } )
public @interface Email {
String detailMessage() default "";
String summaryMessage() default "";
}
| Java |
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.usages.impl.rules;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.GeneratedSourcesFilter;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.usageView.UsageInfo;
import com.intellij.usageView.UsageViewBundle;
import com.intellij.usages.*;
import com.intellij.usages.rules.PsiElementUsage;
import com.intellij.usages.rules.SingleParentUsageGroupingRule;
import com.intellij.usages.rules.UsageInFile;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* @author max
*/
public class NonCodeUsageGroupingRule extends SingleParentUsageGroupingRule {
private final Project myProject;
public NonCodeUsageGroupingRule(Project project) {
myProject = project;
}
private static class CodeUsageGroup extends UsageGroupBase {
private static final UsageGroup INSTANCE = new CodeUsageGroup();
private CodeUsageGroup() {
super(0);
}
@Override
@NotNull
public String getText(UsageView view) {
return view == null ? UsageViewBundle.message("node.group.code.usages") : view.getPresentation().getCodeUsagesString();
}
public String toString() {
//noinspection HardCodedStringLiteral
return "CodeUsages";
}
}
private static class UsageInGeneratedCodeGroup extends UsageGroupBase {
public static final UsageGroup INSTANCE = new UsageInGeneratedCodeGroup();
private UsageInGeneratedCodeGroup() {
super(3);
}
@Override
@NotNull
public String getText(UsageView view) {
return view == null ? UsageViewBundle.message("node.usages.in.generated.code") : view.getPresentation().getUsagesInGeneratedCodeString();
}
public String toString() {
return "UsagesInGeneratedCode";
}
}
private static class NonCodeUsageGroup extends UsageGroupBase {
public static final UsageGroup INSTANCE = new NonCodeUsageGroup();
private NonCodeUsageGroup() {
super(2);
}
@Override
@NotNull
public String getText(UsageView view) {
return view == null ? UsageViewBundle.message("node.non.code.usages") : view.getPresentation().getNonCodeUsagesString();
}
@Override
public void update() {
}
public String toString() {
//noinspection HardCodedStringLiteral
return "NonCodeUsages";
}
}
private static class DynamicUsageGroup extends UsageGroupBase {
public static final UsageGroup INSTANCE = new DynamicUsageGroup();
@NonNls private static final String DYNAMIC_CAPTION = "Dynamic usages";
public DynamicUsageGroup() {
super(1);
}
@Override
@NotNull
public String getText(UsageView view) {
if (view == null) {
return DYNAMIC_CAPTION;
}
else {
final String dynamicCodeUsagesString = view.getPresentation().getDynamicCodeUsagesString();
return dynamicCodeUsagesString == null ? DYNAMIC_CAPTION : dynamicCodeUsagesString;
}
}
public String toString() {
//noinspection HardCodedStringLiteral
return "DynamicUsages";
}
}
@Nullable
@Override
protected UsageGroup getParentGroupFor(@NotNull Usage usage, @NotNull UsageTarget[] targets) {
if (usage instanceof UsageInFile) {
VirtualFile file = ((UsageInFile)usage).getFile();
if (file != null && GeneratedSourcesFilter.isGeneratedSourceByAnyFilter(file, myProject)) {
return UsageInGeneratedCodeGroup.INSTANCE;
}
}
if (usage instanceof PsiElementUsage) {
if (usage instanceof UsageInfo2UsageAdapter) {
final UsageInfo usageInfo = ((UsageInfo2UsageAdapter)usage).getUsageInfo();
if (usageInfo.isDynamicUsage()) {
return DynamicUsageGroup.INSTANCE;
}
}
if (((PsiElementUsage)usage).isNonCodeUsage()) {
return NonCodeUsageGroup.INSTANCE;
}
else {
return CodeUsageGroup.INSTANCE;
}
}
return null;
}
}
| Java |
(function () {
function remap(fromValue, fromMin, fromMax, toMin, toMax) {
// Compute the range of the data
var fromRange = fromMax - fromMin,
toRange = toMax - toMin,
toValue;
// If either range is 0, then the value can only be mapped to 1 value
if (fromRange === 0) {
return toMin + toRange / 2;
}
if (toRange === 0) {
return toMin;
}
// (1) untranslate, (2) unscale, (3) rescale, (4) retranslate
toValue = (fromValue - fromMin) / fromRange;
toValue = (toRange * toValue) + toMin;
return toValue;
}
/**
* Enhance Filter. Adjusts the colors so that they span the widest
* possible range (ie 0-255). Performs w*h pixel reads and w*h pixel
* writes.
* @function
* @name Enhance
* @memberof Kinetic.Filters
* @param {Object} imageData
* @author ippo615
* @example
* node.cache();
* node.filters([Kinetic.Filters.Enhance]);
* node.enhance(0.4);
*/
Kinetic.Filters.Enhance = function (imageData) {
var data = imageData.data,
nSubPixels = data.length,
rMin = data[0], rMax = rMin, r,
gMin = data[1], gMax = gMin, g,
bMin = data[2], bMax = bMin, b,
i;
// If we are not enhancing anything - don't do any computation
var enhanceAmount = this.enhance();
if( enhanceAmount === 0 ){ return; }
// 1st Pass - find the min and max for each channel:
for (i = 0; i < nSubPixels; i += 4) {
r = data[i + 0];
if (r < rMin) { rMin = r; }
else if (r > rMax) { rMax = r; }
g = data[i + 1];
if (g < gMin) { gMin = g; } else
if (g > gMax) { gMax = g; }
b = data[i + 2];
if (b < bMin) { bMin = b; } else
if (b > bMax) { bMax = b; }
//a = data[i + 3];
//if (a < aMin) { aMin = a; } else
//if (a > aMax) { aMax = a; }
}
// If there is only 1 level - don't remap
if( rMax === rMin ){ rMax = 255; rMin = 0; }
if( gMax === gMin ){ gMax = 255; gMin = 0; }
if( bMax === bMin ){ bMax = 255; bMin = 0; }
var rMid, rGoalMax,rGoalMin,
gMid, gGoalMax,gGoalMin,
bMid, bGoalMax,bGoalMin;
// If the enhancement is positive - stretch the histogram
if ( enhanceAmount > 0 ){
rGoalMax = rMax + enhanceAmount*(255-rMax);
rGoalMin = rMin - enhanceAmount*(rMin-0);
gGoalMax = gMax + enhanceAmount*(255-gMax);
gGoalMin = gMin - enhanceAmount*(gMin-0);
bGoalMax = bMax + enhanceAmount*(255-bMax);
bGoalMin = bMin - enhanceAmount*(bMin-0);
// If the enhancement is negative - compress the histogram
} else {
rMid = (rMax + rMin)*0.5;
rGoalMax = rMax + enhanceAmount*(rMax-rMid);
rGoalMin = rMin + enhanceAmount*(rMin-rMid);
gMid = (gMax + gMin)*0.5;
gGoalMax = gMax + enhanceAmount*(gMax-gMid);
gGoalMin = gMin + enhanceAmount*(gMin-gMid);
bMid = (bMax + bMin)*0.5;
bGoalMax = bMax + enhanceAmount*(bMax-bMid);
bGoalMin = bMin + enhanceAmount*(bMin-bMid);
}
// Pass 2 - remap everything, except the alpha
for (i = 0; i < nSubPixels; i += 4) {
data[i + 0] = remap(data[i + 0], rMin, rMax, rGoalMin, rGoalMax);
data[i + 1] = remap(data[i + 1], gMin, gMax, gGoalMin, gGoalMax);
data[i + 2] = remap(data[i + 2], bMin, bMax, bGoalMin, bGoalMax);
//data[i + 3] = remap(data[i + 3], aMin, aMax, aGoalMin, aGoalMax);
}
};
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'enhance', 0, null, Kinetic.Factory.afterSetFilter);
/**
* get/set enhance. Use with {@link Kinetic.Filters.Enhance} filter.
* @name enhance
* @method
* @memberof Kinetic.Node.prototype
* @param {Float} amount
* @returns {Float}
*/
})();
| Java |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CloudWatch Reference — boto v2.33.0</title>
<link rel="stylesheet" href="../_static/boto.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: 'HEAD',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="boto v2.33.0" href="../index.html" />
<link rel="next" title="Cognito Identity" href="cognito-identity.html" />
<link rel="prev" title="CloudTrail" href="cloudtrail.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="cognito-identity.html" title="Cognito Identity"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="cloudtrail.html" title="CloudTrail"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">boto v2.33.0</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="cloudwatch-reference">
<h1>CloudWatch Reference<a class="headerlink" href="#cloudwatch-reference" title="Permalink to this headline">¶</a></h1>
<div class="section" id="module-boto.ec2.cloudwatch">
<span id="boto-ec2-cloudwatch"></span><h2>boto.ec2.cloudwatch<a class="headerlink" href="#module-boto.ec2.cloudwatch" title="Permalink to this headline">¶</a></h2>
<p>This module provides an interface to the Elastic Compute Cloud (EC2)
CloudWatch service from AWS.</p>
<dl class="class">
<dt id="boto.ec2.cloudwatch.CloudWatchConnection">
<em class="property">class </em><tt class="descclassname">boto.ec2.cloudwatch.</tt><tt class="descname">CloudWatchConnection</tt><big>(</big><em>aws_access_key_id=None</em>, <em>aws_secret_access_key=None</em>, <em>is_secure=True</em>, <em>port=None</em>, <em>proxy=None</em>, <em>proxy_port=None</em>, <em>proxy_user=None</em>, <em>proxy_pass=None</em>, <em>debug=0</em>, <em>https_connection_factory=None</em>, <em>region=None</em>, <em>path='/'</em>, <em>security_token=None</em>, <em>validate_certs=True</em>, <em>profile_name=None</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.CloudWatchConnection" title="Permalink to this definition">¶</a></dt>
<dd><p>Init method to create a new connection to EC2 Monitoring Service.</p>
<p>B{Note:} The host argument is overridden by the host specified in the
boto configuration file.</p>
<dl class="attribute">
<dt id="boto.ec2.cloudwatch.CloudWatchConnection.APIVersion">
<tt class="descname">APIVersion</tt><em class="property"> = '2010-08-01'</em><a class="headerlink" href="#boto.ec2.cloudwatch.CloudWatchConnection.APIVersion" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="boto.ec2.cloudwatch.CloudWatchConnection.DefaultRegionEndpoint">
<tt class="descname">DefaultRegionEndpoint</tt><em class="property"> = 'monitoring.us-east-1.amazonaws.com'</em><a class="headerlink" href="#boto.ec2.cloudwatch.CloudWatchConnection.DefaultRegionEndpoint" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="boto.ec2.cloudwatch.CloudWatchConnection.DefaultRegionName">
<tt class="descname">DefaultRegionName</tt><em class="property"> = 'us-east-1'</em><a class="headerlink" href="#boto.ec2.cloudwatch.CloudWatchConnection.DefaultRegionName" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.CloudWatchConnection.build_dimension_param">
<tt class="descname">build_dimension_param</tt><big>(</big><em>dimension</em>, <em>params</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.CloudWatchConnection.build_dimension_param" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.CloudWatchConnection.build_list_params">
<tt class="descname">build_list_params</tt><big>(</big><em>params</em>, <em>items</em>, <em>label</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.CloudWatchConnection.build_list_params" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.CloudWatchConnection.build_put_params">
<tt class="descname">build_put_params</tt><big>(</big><em>params</em>, <em>name</em>, <em>value=None</em>, <em>timestamp=None</em>, <em>unit=None</em>, <em>dimensions=None</em>, <em>statistics=None</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.CloudWatchConnection.build_put_params" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.CloudWatchConnection.create_alarm">
<tt class="descname">create_alarm</tt><big>(</big><em>alarm</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.CloudWatchConnection.create_alarm" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates or updates an alarm and associates it with the specified Amazon
CloudWatch metric. Optionally, this operation can associate one or more
Amazon Simple Notification Service resources with the alarm.</p>
<p>When this operation creates an alarm, the alarm state is immediately
set to INSUFFICIENT_DATA. The alarm is evaluated and its StateValue is
set appropriately. Any actions associated with the StateValue is then
executed.</p>
<p>When updating an existing alarm, its StateValue is left unchanged.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>alarm</strong> (<a class="reference internal" href="#boto.ec2.cloudwatch.alarm.MetricAlarm" title="boto.ec2.cloudwatch.alarm.MetricAlarm"><em>boto.ec2.cloudwatch.alarm.MetricAlarm</em></a>) – MetricAlarm object.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.CloudWatchConnection.delete_alarms">
<tt class="descname">delete_alarms</tt><big>(</big><em>alarms</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.CloudWatchConnection.delete_alarms" title="Permalink to this definition">¶</a></dt>
<dd><p>Deletes all specified alarms. In the event of an error, no
alarms are deleted.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>alarms</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#list" title="(in Python v2.7)"><em>list</em></a>) – List of alarm names.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.CloudWatchConnection.describe_alarm_history">
<tt class="descname">describe_alarm_history</tt><big>(</big><em>alarm_name=None</em>, <em>start_date=None</em>, <em>end_date=None</em>, <em>max_records=None</em>, <em>history_item_type=None</em>, <em>next_token=None</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.CloudWatchConnection.describe_alarm_history" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieves history for the specified alarm. Filter alarms by date range
or item type. If an alarm name is not specified, Amazon CloudWatch
returns histories for all of the owner’s alarms.</p>
<p>Amazon CloudWatch retains the history of deleted alarms for a period of
six weeks. If an alarm has been deleted, its history can still be
queried.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>alarm_name</strong> (<a class="reference external" href="http://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The name of the alarm.</li>
<li><strong>start_date</strong> (<a class="reference external" href="http://docs.python.org/library/datetime.html#module-datetime" title="(in Python v2.7)"><em>datetime</em></a>) – The starting date to retrieve alarm history.</li>
<li><strong>end_date</strong> (<a class="reference external" href="http://docs.python.org/library/datetime.html#module-datetime" title="(in Python v2.7)"><em>datetime</em></a>) – The starting date to retrieve alarm history.</li>
<li><strong>history_item_type</strong> (<a class="reference external" href="http://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The type of alarm histories to retreive
(ConfigurationUpdate | StateUpdate | Action)</li>
<li><strong>max_records</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#int" title="(in Python v2.7)"><em>int</em></a>) – The maximum number of alarm descriptions
to retrieve.</li>
<li><strong>next_token</strong> (<a class="reference external" href="http://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The token returned by a previous call to indicate
that there is more data.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>:rtype list</p>
</dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.CloudWatchConnection.describe_alarms">
<tt class="descname">describe_alarms</tt><big>(</big><em>action_prefix=None</em>, <em>alarm_name_prefix=None</em>, <em>alarm_names=None</em>, <em>max_records=None</em>, <em>state_value=None</em>, <em>next_token=None</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.CloudWatchConnection.describe_alarms" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieves alarms with the specified names. If no name is specified, all
alarms for the user are returned. Alarms can be retrieved by using only
a prefix for the alarm name, the alarm state, or a prefix for any
action.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>action_name</strong> – The action name prefix.</li>
<li><strong>alarm_name_prefix</strong> (<a class="reference external" href="http://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The alarm name prefix. AlarmNames cannot
be specified if this parameter is specified.</li>
<li><strong>alarm_names</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#list" title="(in Python v2.7)"><em>list</em></a>) – A list of alarm names to retrieve information for.</li>
<li><strong>max_records</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#int" title="(in Python v2.7)"><em>int</em></a>) – The maximum number of alarm descriptions
to retrieve.</li>
<li><strong>state_value</strong> (<a class="reference external" href="http://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The state value to be used in matching alarms.</li>
<li><strong>next_token</strong> (<a class="reference external" href="http://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The token returned by a previous call to
indicate that there is more data.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>:rtype list</p>
</dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.CloudWatchConnection.describe_alarms_for_metric">
<tt class="descname">describe_alarms_for_metric</tt><big>(</big><em>metric_name</em>, <em>namespace</em>, <em>period=None</em>, <em>statistic=None</em>, <em>dimensions=None</em>, <em>unit=None</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.CloudWatchConnection.describe_alarms_for_metric" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieves all alarms for a single metric. Specify a statistic, period,
or unit to filter the set of alarms further.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>metric_name</strong> (<a class="reference external" href="http://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The name of the metric</li>
<li><strong>namespace</strong> (<a class="reference external" href="http://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The namespace of the metric.</li>
<li><strong>period</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#int" title="(in Python v2.7)"><em>int</em></a>) – The period in seconds over which the statistic
is applied.</li>
<li><strong>statistic</strong> (<a class="reference external" href="http://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The statistic for the metric.</li>
<li><strong>dimension_filters</strong> – A dictionary containing name/value
pairs that will be used to filter the results. The key in
the dictionary is the name of a Dimension. The value in
the dictionary is either a scalar value of that Dimension
name that you want to filter on, a list of values to
filter on or None if you want all metrics with that
Dimension name.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>:rtype list</p>
</dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.CloudWatchConnection.disable_alarm_actions">
<tt class="descname">disable_alarm_actions</tt><big>(</big><em>alarm_names</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.CloudWatchConnection.disable_alarm_actions" title="Permalink to this definition">¶</a></dt>
<dd><p>Disables actions for the specified alarms.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>alarms</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#list" title="(in Python v2.7)"><em>list</em></a>) – List of alarm names.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.CloudWatchConnection.enable_alarm_actions">
<tt class="descname">enable_alarm_actions</tt><big>(</big><em>alarm_names</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.CloudWatchConnection.enable_alarm_actions" title="Permalink to this definition">¶</a></dt>
<dd><p>Enables actions for the specified alarms.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>alarms</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#list" title="(in Python v2.7)"><em>list</em></a>) – List of alarm names.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.CloudWatchConnection.get_metric_statistics">
<tt class="descname">get_metric_statistics</tt><big>(</big><em>period</em>, <em>start_time</em>, <em>end_time</em>, <em>metric_name</em>, <em>namespace</em>, <em>statistics</em>, <em>dimensions=None</em>, <em>unit=None</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.CloudWatchConnection.get_metric_statistics" title="Permalink to this definition">¶</a></dt>
<dd><p>Get time-series data for one or more statistics of a given metric.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>period</strong> (<em>integer</em>) – The granularity, in seconds, of the returned datapoints.
Period must be at least 60 seconds and must be a multiple
of 60. The default value is 60.</li>
<li><strong>start_time</strong> (<a class="reference external" href="http://docs.python.org/library/datetime.html#module-datetime" title="(in Python v2.7)"><em>datetime</em></a>) – The time stamp to use for determining the
first datapoint to return. The value specified is
inclusive; results include datapoints with the time stamp
specified.</li>
<li><strong>end_time</strong> (<a class="reference external" href="http://docs.python.org/library/datetime.html#module-datetime" title="(in Python v2.7)"><em>datetime</em></a>) – The time stamp to use for determining the
last datapoint to return. The value specified is
exclusive; results will include datapoints up to the time
stamp specified.</li>
<li><strong>metric_name</strong> (<a class="reference external" href="http://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The metric name.</li>
<li><strong>namespace</strong> (<a class="reference external" href="http://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The metric’s namespace.</li>
<li><strong>statistics</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#list" title="(in Python v2.7)"><em>list</em></a>) – A list of statistics names Valid values:
Average | Sum | SampleCount | Maximum | Minimum</li>
<li><strong>dimensions</strong> (<a class="reference external" href="http://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) – A dictionary of dimension key/values where
the key is the dimension name and the value
is either a scalar value or an iterator
of values to be associated with that
dimension.</li>
<li><strong>unit</strong> (<a class="reference external" href="http://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The unit for the metric. Value values are:
Seconds | Microseconds | Milliseconds | Bytes | Kilobytes |
Megabytes | Gigabytes | Terabytes | Bits | Kilobits |
Megabits | Gigabits | Terabits | Percent | Count |
Bytes/Second | Kilobytes/Second | Megabytes/Second |
Gigabytes/Second | Terabytes/Second | Bits/Second |
Kilobits/Second | Megabits/Second | Gigabits/Second |
Terabits/Second | Count/Second | None</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">list</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.CloudWatchConnection.list_metrics">
<tt class="descname">list_metrics</tt><big>(</big><em>next_token=None</em>, <em>dimensions=None</em>, <em>metric_name=None</em>, <em>namespace=None</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.CloudWatchConnection.list_metrics" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a list of the valid metrics for which there is recorded
data available.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>next_token</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – A maximum of 500 metrics will be returned
at one time. If more results are available, the ResultSet
returned will contain a non-Null next_token attribute.
Passing that token as a parameter to list_metrics will
retrieve the next page of metrics.</li>
<li><strong>dimensions</strong> (<a class="reference external" href="http://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) – A dictionary containing name/value
pairs that will be used to filter the results. The key in
the dictionary is the name of a Dimension. The value in
the dictionary is either a scalar value of that Dimension
name that you want to filter on or None if you want all
metrics with that Dimension name. To be included in the
result a metric must contain all specified dimensions,
although the metric may contain additional dimensions beyond
the requested metrics. The Dimension names, and values must
be strings between 1 and 250 characters long. A maximum of
10 dimensions are allowed.</li>
<li><strong>metric_name</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – The name of the Metric to filter against. If None,
all Metric names will be returned.</li>
<li><strong>namespace</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – A Metric namespace to filter against (e.g. AWS/EC2).
If None, Metrics from all namespaces will be returned.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.CloudWatchConnection.put_metric_alarm">
<tt class="descname">put_metric_alarm</tt><big>(</big><em>alarm</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.CloudWatchConnection.put_metric_alarm" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates or updates an alarm and associates it with the specified Amazon
CloudWatch metric. Optionally, this operation can associate one or more
Amazon Simple Notification Service resources with the alarm.</p>
<p>When this operation creates an alarm, the alarm state is immediately
set to INSUFFICIENT_DATA. The alarm is evaluated and its StateValue is
set appropriately. Any actions associated with the StateValue is then
executed.</p>
<p>When updating an existing alarm, its StateValue is left unchanged.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>alarm</strong> (<a class="reference internal" href="#boto.ec2.cloudwatch.alarm.MetricAlarm" title="boto.ec2.cloudwatch.alarm.MetricAlarm"><em>boto.ec2.cloudwatch.alarm.MetricAlarm</em></a>) – MetricAlarm object.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.CloudWatchConnection.put_metric_data">
<tt class="descname">put_metric_data</tt><big>(</big><em>namespace</em>, <em>name</em>, <em>value=None</em>, <em>timestamp=None</em>, <em>unit=None</em>, <em>dimensions=None</em>, <em>statistics=None</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.CloudWatchConnection.put_metric_data" title="Permalink to this definition">¶</a></dt>
<dd><p>Publishes metric data points to Amazon CloudWatch. Amazon Cloudwatch
associates the data points with the specified metric. If the specified
metric does not exist, Amazon CloudWatch creates the metric. If a list
is specified for some, but not all, of the arguments, the remaining
arguments are repeated a corresponding number of times.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>namespace</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – The namespace of the metric.</li>
<li><strong>name</strong> (<em>str or list</em>) – The name of the metric.</li>
<li><strong>value</strong> (<em>float or list</em>) – The value for the metric.</li>
<li><strong>timestamp</strong> (<em>datetime or list</em>) – The time stamp used for the metric. If not specified,
the default value is set to the time the metric data was received.</li>
<li><strong>unit</strong> (<em>string or list</em>) – The unit of the metric. Valid Values: Seconds |
Microseconds | Milliseconds | Bytes | Kilobytes |
Megabytes | Gigabytes | Terabytes | Bits | Kilobits |
Megabits | Gigabits | Terabits | Percent | Count |
Bytes/Second | Kilobytes/Second | Megabytes/Second |
Gigabytes/Second | Terabytes/Second | Bits/Second |
Kilobits/Second | Megabits/Second | Gigabits/Second |
Terabits/Second | Count/Second | None</li>
<li><strong>dimensions</strong> (<a class="reference external" href="http://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) – Add extra name value pairs to associate
with the metric, i.e.:
{‘name1’: value1, ‘name2’: (value2, value3)}</li>
<li><strong>statistics</strong> (<em>dict or list</em>) – <p>Use a statistic set instead of a value, for example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span><span class="s">'maximum'</span><span class="p">:</span> <span class="mi">30</span><span class="p">,</span> <span class="s">'minimum'</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s">'samplecount'</span><span class="p">:</span> <span class="mi">100</span><span class="p">,</span> <span class="s">'sum'</span><span class="p">:</span> <span class="mi">10000</span><span class="p">}</span>
</pre></div>
</div>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.CloudWatchConnection.set_alarm_state">
<tt class="descname">set_alarm_state</tt><big>(</big><em>alarm_name</em>, <em>state_reason</em>, <em>state_value</em>, <em>state_reason_data=None</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.CloudWatchConnection.set_alarm_state" title="Permalink to this definition">¶</a></dt>
<dd><p>Temporarily sets the state of an alarm. When the updated StateValue
differs from the previous value, the action configured for the
appropriate state is invoked. This is not a permanent change. The next
periodic alarm check (in about a minute) will set the alarm to its
actual state.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>alarm_name</strong> (<a class="reference external" href="http://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – Descriptive name for alarm.</li>
<li><strong>state_reason</strong> (<a class="reference external" href="http://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – Human readable reason.</li>
<li><strong>state_value</strong> (<a class="reference external" href="http://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – OK | ALARM | INSUFFICIENT_DATA</li>
<li><strong>state_reason_data</strong> (<a class="reference external" href="http://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – Reason string (will be jsonified).</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.CloudWatchConnection.update_alarm">
<tt class="descname">update_alarm</tt><big>(</big><em>alarm</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.CloudWatchConnection.update_alarm" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates or updates an alarm and associates it with the specified Amazon
CloudWatch metric. Optionally, this operation can associate one or more
Amazon Simple Notification Service resources with the alarm.</p>
<p>When this operation creates an alarm, the alarm state is immediately
set to INSUFFICIENT_DATA. The alarm is evaluated and its StateValue is
set appropriately. Any actions associated with the StateValue is then
executed.</p>
<p>When updating an existing alarm, its StateValue is left unchanged.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>alarm</strong> (<a class="reference internal" href="#boto.ec2.cloudwatch.alarm.MetricAlarm" title="boto.ec2.cloudwatch.alarm.MetricAlarm"><em>boto.ec2.cloudwatch.alarm.MetricAlarm</em></a>) – MetricAlarm object.</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="boto.ec2.cloudwatch.connect_to_region">
<tt class="descclassname">boto.ec2.cloudwatch.</tt><tt class="descname">connect_to_region</tt><big>(</big><em>region_name</em>, <em>**kw_params</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.connect_to_region" title="Permalink to this definition">¶</a></dt>
<dd><p>Given a valid region name, return a
<a class="reference internal" href="#boto.ec2.cloudwatch.CloudWatchConnection" title="boto.ec2.cloudwatch.CloudWatchConnection"><tt class="xref py py-class docutils literal"><span class="pre">boto.ec2.cloudwatch.CloudWatchConnection</span></tt></a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>region_name</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – The name of the region to connect to.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><tt class="xref py py-class docutils literal"><span class="pre">boto.ec2.CloudWatchConnection</span></tt> or <tt class="docutils literal"><span class="pre">None</span></tt></td>
</tr>
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">A connection to the given region, or None if an invalid region
name is given</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="boto.ec2.cloudwatch.regions">
<tt class="descclassname">boto.ec2.cloudwatch.</tt><tt class="descname">regions</tt><big>(</big><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.regions" title="Permalink to this definition">¶</a></dt>
<dd><p>Get all available regions for the CloudWatch service.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">list</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A list of <tt class="xref py py-class docutils literal"><span class="pre">boto.RegionInfo</span></tt> instances</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="module-boto.ec2.cloudwatch.datapoint">
<span id="boto-ec2-cloudwatch-datapoint"></span><h2>boto.ec2.cloudwatch.datapoint<a class="headerlink" href="#module-boto.ec2.cloudwatch.datapoint" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="boto.ec2.cloudwatch.datapoint.Datapoint">
<em class="property">class </em><tt class="descclassname">boto.ec2.cloudwatch.datapoint.</tt><tt class="descname">Datapoint</tt><big>(</big><em>connection=None</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.datapoint.Datapoint" title="Permalink to this definition">¶</a></dt>
<dd><dl class="method">
<dt id="boto.ec2.cloudwatch.datapoint.Datapoint.endElement">
<tt class="descname">endElement</tt><big>(</big><em>name</em>, <em>value</em>, <em>connection</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.datapoint.Datapoint.endElement" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.datapoint.Datapoint.startElement">
<tt class="descname">startElement</tt><big>(</big><em>name</em>, <em>attrs</em>, <em>connection</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.datapoint.Datapoint.startElement" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
</div>
<div class="section" id="module-boto.ec2.cloudwatch.metric">
<span id="boto-ec2-cloudwatch-metric"></span><h2>boto.ec2.cloudwatch.metric<a class="headerlink" href="#module-boto.ec2.cloudwatch.metric" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="boto.ec2.cloudwatch.metric.Metric">
<em class="property">class </em><tt class="descclassname">boto.ec2.cloudwatch.metric.</tt><tt class="descname">Metric</tt><big>(</big><em>connection=None</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.metric.Metric" title="Permalink to this definition">¶</a></dt>
<dd><dl class="attribute">
<dt id="boto.ec2.cloudwatch.metric.Metric.Statistics">
<tt class="descname">Statistics</tt><em class="property"> = ['Minimum', 'Maximum', 'Sum', 'Average', 'SampleCount']</em><a class="headerlink" href="#boto.ec2.cloudwatch.metric.Metric.Statistics" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="boto.ec2.cloudwatch.metric.Metric.Units">
<tt class="descname">Units</tt><em class="property"> = ['Seconds', 'Microseconds', 'Milliseconds', 'Bytes', 'Kilobytes', 'Megabytes', 'Gigabytes', 'Terabytes', 'Bits', 'Kilobits', 'Megabits', 'Gigabits', 'Terabits', 'Percent', 'Count', 'Bytes/Second', 'Kilobytes/Second', 'Megabytes/Second', 'Gigabytes/Second', 'Terabytes/Second', 'Bits/Second', 'Kilobits/Second', 'Megabits/Second', 'Gigabits/Second', 'Terabits/Second', 'Count/Second', None]</em><a class="headerlink" href="#boto.ec2.cloudwatch.metric.Metric.Units" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.metric.Metric.create_alarm">
<tt class="descname">create_alarm</tt><big>(</big><em>name</em>, <em>comparison</em>, <em>threshold</em>, <em>period</em>, <em>evaluation_periods</em>, <em>statistic</em>, <em>enabled=True</em>, <em>description=None</em>, <em>dimensions=None</em>, <em>alarm_actions=None</em>, <em>ok_actions=None</em>, <em>insufficient_data_actions=None</em>, <em>unit=None</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.metric.Metric.create_alarm" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates or updates an alarm and associates it with this metric.
Optionally, this operation can associate one or more
Amazon Simple Notification Service resources with the alarm.</p>
<p>When this operation creates an alarm, the alarm state is immediately
set to INSUFFICIENT_DATA. The alarm is evaluated and its StateValue is
set appropriately. Any actions associated with the StateValue is then
executed.</p>
<p>When updating an existing alarm, its StateValue is left unchanged.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>alarm</strong> (<a class="reference internal" href="#boto.ec2.cloudwatch.alarm.MetricAlarm" title="boto.ec2.cloudwatch.alarm.MetricAlarm"><em>boto.ec2.cloudwatch.alarm.MetricAlarm</em></a>) – MetricAlarm object.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.metric.Metric.describe_alarms">
<tt class="descname">describe_alarms</tt><big>(</big><em>period=None</em>, <em>statistic=None</em>, <em>dimensions=None</em>, <em>unit=None</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.metric.Metric.describe_alarms" title="Permalink to this definition">¶</a></dt>
<dd><p>Retrieves all alarms for this metric. Specify a statistic, period,
or unit to filter the set of alarms further.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>period</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#int" title="(in Python v2.7)"><em>int</em></a>) – The period in seconds over which the statistic
is applied.</li>
<li><strong>statistic</strong> (<a class="reference external" href="http://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The statistic for the metric.</li>
<li><strong>dimension_filters</strong> – A dictionary containing name/value
pairs that will be used to filter the results. The key in
the dictionary is the name of a Dimension. The value in
the dictionary is either a scalar value of that Dimension
name that you want to filter on, a list of values to
filter on or None if you want all metrics with that
Dimension name.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>:rtype list</p>
</dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.metric.Metric.endElement">
<tt class="descname">endElement</tt><big>(</big><em>name</em>, <em>value</em>, <em>connection</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.metric.Metric.endElement" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.metric.Metric.query">
<tt class="descname">query</tt><big>(</big><em>start_time</em>, <em>end_time</em>, <em>statistics</em>, <em>unit=None</em>, <em>period=60</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.metric.Metric.query" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>start_time</strong> (<a class="reference external" href="http://docs.python.org/library/datetime.html#module-datetime" title="(in Python v2.7)"><em>datetime</em></a>) – The time stamp to use for determining the
first datapoint to return. The value specified is
inclusive; results include datapoints with the time stamp
specified.</li>
<li><strong>end_time</strong> (<a class="reference external" href="http://docs.python.org/library/datetime.html#module-datetime" title="(in Python v2.7)"><em>datetime</em></a>) – The time stamp to use for determining the
last datapoint to return. The value specified is
exclusive; results will include datapoints up to the time
stamp specified.</li>
<li><strong>statistics</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#list" title="(in Python v2.7)"><em>list</em></a>) – A list of statistics names Valid values:
Average | Sum | SampleCount | Maximum | Minimum</li>
<li><strong>unit</strong> (<a class="reference external" href="http://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The unit for the metric. Value values are:
Seconds | Microseconds | Milliseconds | Bytes | Kilobytes |
Megabytes | Gigabytes | Terabytes | Bits | Kilobits |
Megabits | Gigabits | Terabits | Percent | Count |
Bytes/Second | Kilobytes/Second | Megabytes/Second |
Gigabytes/Second | Terabytes/Second | Bits/Second |
Kilobits/Second | Megabits/Second | Gigabits/Second |
Terabits/Second | Count/Second | None</li>
<li><strong>period</strong> (<em>integer</em>) – The granularity, in seconds, of the returned datapoints.
Period must be at least 60 seconds and must be a multiple
of 60. The default value is 60.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.metric.Metric.startElement">
<tt class="descname">startElement</tt><big>(</big><em>name</em>, <em>attrs</em>, <em>connection</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.metric.Metric.startElement" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
</div>
<div class="section" id="module-boto.ec2.cloudwatch.alarm">
<span id="boto-ec2-cloudwatch-alarm"></span><h2>boto.ec2.cloudwatch.alarm<a class="headerlink" href="#module-boto.ec2.cloudwatch.alarm" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="boto.ec2.cloudwatch.alarm.AlarmHistoryItem">
<em class="property">class </em><tt class="descclassname">boto.ec2.cloudwatch.alarm.</tt><tt class="descname">AlarmHistoryItem</tt><big>(</big><em>connection=None</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.alarm.AlarmHistoryItem" title="Permalink to this definition">¶</a></dt>
<dd><dl class="method">
<dt id="boto.ec2.cloudwatch.alarm.AlarmHistoryItem.endElement">
<tt class="descname">endElement</tt><big>(</big><em>name</em>, <em>value</em>, <em>connection</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.alarm.AlarmHistoryItem.endElement" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.alarm.AlarmHistoryItem.startElement">
<tt class="descname">startElement</tt><big>(</big><em>name</em>, <em>attrs</em>, <em>connection</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.alarm.AlarmHistoryItem.startElement" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="boto.ec2.cloudwatch.alarm.MetricAlarm">
<em class="property">class </em><tt class="descclassname">boto.ec2.cloudwatch.alarm.</tt><tt class="descname">MetricAlarm</tt><big>(</big><em>connection=None</em>, <em>name=None</em>, <em>metric=None</em>, <em>namespace=None</em>, <em>statistic=None</em>, <em>comparison=None</em>, <em>threshold=None</em>, <em>period=None</em>, <em>evaluation_periods=None</em>, <em>unit=None</em>, <em>description=''</em>, <em>dimensions=None</em>, <em>alarm_actions=None</em>, <em>insufficient_data_actions=None</em>, <em>ok_actions=None</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.alarm.MetricAlarm" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates a new Alarm.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>name</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – Name of alarm.</li>
<li><strong>metric</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – Name of alarm’s associated metric.</li>
<li><strong>namespace</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – The namespace for the alarm’s metric.</li>
<li><strong>statistic</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – The statistic to apply to the alarm’s associated
metric.
Valid values: SampleCount|Average|Sum|Minimum|Maximum</li>
<li><strong>comparison</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – Comparison used to compare statistic with threshold.
Valid values: >= | > | < | <=</li>
<li><strong>threshold</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#float" title="(in Python v2.7)"><em>float</em></a>) – The value against which the specified statistic
is compared.</li>
<li><strong>period</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#int" title="(in Python v2.7)"><em>int</em></a>) – The period in seconds over which teh specified
statistic is applied.</li>
<li><strong>evaluation_periods</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#int" title="(in Python v2.7)"><em>int</em></a>) – The number of periods over which data is
compared to the specified threshold.</li>
<li><strong>unit</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – Allowed Values are:
Seconds|Microseconds|Milliseconds,
Bytes|Kilobytes|Megabytes|Gigabytes|Terabytes,
Bits|Kilobits|Megabits|Gigabits|Terabits,
Percent|Count|
Bytes/Second|Kilobytes/Second|Megabytes/Second|
Gigabytes/Second|Terabytes/Second,
Bits/Second|Kilobits/Second|Megabits/Second,
Gigabits/Second|Terabits/Second|Count/Second|None</li>
<li><strong>description</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – Description of MetricAlarm</li>
<li><strong>dimensions</strong> (<a class="reference external" href="http://docs.python.org/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) – <p>A dictionary of dimension key/values where
the key is the dimension name and the value
is either a scalar value or an iterator
of values to be associated with that
dimension.
Example: {</p>
<blockquote>
<div>‘InstanceId’: [‘i-0123456’, ‘i-0123457’],
‘LoadBalancerName’: ‘test-lb’</div></blockquote>
<p>}</p>
</li>
<li><strong>alarm_actions</strong> (<em>list of strs</em>) – A list of the ARNs of the actions to take in
ALARM state</li>
<li><strong>insufficient_data_actions</strong> (<em>list of strs</em>) – A list of the ARNs of the actions to
take in INSUFFICIENT_DATA state</li>
<li><strong>ok_actions</strong> (<em>list of strs</em>) – A list of the ARNs of the actions to take in OK state</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="attribute">
<dt id="boto.ec2.cloudwatch.alarm.MetricAlarm.ALARM">
<tt class="descname">ALARM</tt><em class="property"> = 'ALARM'</em><a class="headerlink" href="#boto.ec2.cloudwatch.alarm.MetricAlarm.ALARM" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="boto.ec2.cloudwatch.alarm.MetricAlarm.INSUFFICIENT_DATA">
<tt class="descname">INSUFFICIENT_DATA</tt><em class="property"> = 'INSUFFICIENT_DATA'</em><a class="headerlink" href="#boto.ec2.cloudwatch.alarm.MetricAlarm.INSUFFICIENT_DATA" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="boto.ec2.cloudwatch.alarm.MetricAlarm.OK">
<tt class="descname">OK</tt><em class="property"> = 'OK'</em><a class="headerlink" href="#boto.ec2.cloudwatch.alarm.MetricAlarm.OK" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.alarm.MetricAlarm.add_alarm_action">
<tt class="descname">add_alarm_action</tt><big>(</big><em>action_arn=None</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.alarm.MetricAlarm.add_alarm_action" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds an alarm action, represented as an SNS topic, to this alarm.
What do do when alarm is triggered.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>action_arn</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – SNS topics to which notification should be
sent if the alarm goes to state ALARM.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.alarm.MetricAlarm.add_insufficient_data_action">
<tt class="descname">add_insufficient_data_action</tt><big>(</big><em>action_arn=None</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.alarm.MetricAlarm.add_insufficient_data_action" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds an insufficient_data action, represented as an SNS topic, to
this alarm. What to do when the insufficient_data state is reached.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>action_arn</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – SNS topics to which notification should be
sent if the alarm goes to state INSUFFICIENT_DATA.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.alarm.MetricAlarm.add_ok_action">
<tt class="descname">add_ok_action</tt><big>(</big><em>action_arn=None</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.alarm.MetricAlarm.add_ok_action" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds an ok action, represented as an SNS topic, to this alarm. What
to do when the ok state is reached.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>action_arn</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – SNS topics to which notification should be
sent if the alarm goes to state INSUFFICIENT_DATA.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.alarm.MetricAlarm.delete">
<tt class="descname">delete</tt><big>(</big><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.alarm.MetricAlarm.delete" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.alarm.MetricAlarm.describe_history">
<tt class="descname">describe_history</tt><big>(</big><em>start_date=None</em>, <em>end_date=None</em>, <em>max_records=None</em>, <em>history_item_type=None</em>, <em>next_token=None</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.alarm.MetricAlarm.describe_history" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.alarm.MetricAlarm.disable_actions">
<tt class="descname">disable_actions</tt><big>(</big><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.alarm.MetricAlarm.disable_actions" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.alarm.MetricAlarm.enable_actions">
<tt class="descname">enable_actions</tt><big>(</big><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.alarm.MetricAlarm.enable_actions" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.alarm.MetricAlarm.endElement">
<tt class="descname">endElement</tt><big>(</big><em>name</em>, <em>value</em>, <em>connection</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.alarm.MetricAlarm.endElement" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.alarm.MetricAlarm.set_state">
<tt class="descname">set_state</tt><big>(</big><em>value</em>, <em>reason</em>, <em>data=None</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.alarm.MetricAlarm.set_state" title="Permalink to this definition">¶</a></dt>
<dd><p>Temporarily sets the state of an alarm.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>value</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – OK | ALARM | INSUFFICIENT_DATA</li>
<li><strong>reason</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – Reason alarm set (human readable).</li>
<li><strong>data</strong> (<a class="reference external" href="http://docs.python.org/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) – Reason data (will be jsonified).</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.alarm.MetricAlarm.startElement">
<tt class="descname">startElement</tt><big>(</big><em>name</em>, <em>attrs</em>, <em>connection</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.alarm.MetricAlarm.startElement" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.alarm.MetricAlarm.update">
<tt class="descname">update</tt><big>(</big><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.alarm.MetricAlarm.update" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="boto.ec2.cloudwatch.alarm.MetricAlarms">
<em class="property">class </em><tt class="descclassname">boto.ec2.cloudwatch.alarm.</tt><tt class="descname">MetricAlarms</tt><big>(</big><em>connection=None</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.alarm.MetricAlarms" title="Permalink to this definition">¶</a></dt>
<dd><p>Parses a list of MetricAlarms.</p>
<dl class="method">
<dt id="boto.ec2.cloudwatch.alarm.MetricAlarms.endElement">
<tt class="descname">endElement</tt><big>(</big><em>name</em>, <em>value</em>, <em>connection</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.alarm.MetricAlarms.endElement" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="boto.ec2.cloudwatch.alarm.MetricAlarms.startElement">
<tt class="descname">startElement</tt><big>(</big><em>name</em>, <em>attrs</em>, <em>connection</em><big>)</big><a class="headerlink" href="#boto.ec2.cloudwatch.alarm.MetricAlarms.startElement" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">CloudWatch Reference</a><ul>
<li><a class="reference internal" href="#module-boto.ec2.cloudwatch">boto.ec2.cloudwatch</a></li>
<li><a class="reference internal" href="#module-boto.ec2.cloudwatch.datapoint">boto.ec2.cloudwatch.datapoint</a></li>
<li><a class="reference internal" href="#module-boto.ec2.cloudwatch.metric">boto.ec2.cloudwatch.metric</a></li>
<li><a class="reference internal" href="#module-boto.ec2.cloudwatch.alarm">boto.ec2.cloudwatch.alarm</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="cloudtrail.html"
title="previous chapter">CloudTrail</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="cognito-identity.html"
title="next chapter">Cognito Identity</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/ref/cloudwatch.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script><div><a href="boto.pdf">PDF Version</a></div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="cognito-identity.html" title="Cognito Identity"
>next</a> |</li>
<li class="right" >
<a href="cloudtrail.html" title="CloudTrail"
>previous</a> |</li>
<li><a href="../index.html">boto v2.33.0</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2009,2010, Mitch Garnaat.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
</div>
</body>
</html> | Java |
import pytest
from api.base.settings.defaults import API_BASE
from framework.auth.core import Auth
from osf.models import AbstractNode, NodeLog
from osf.utils import permissions
from osf.utils.sanitize import strip_html
from osf_tests.factories import (
NodeFactory,
ProjectFactory,
OSFGroupFactory,
RegistrationFactory,
AuthUserFactory,
PrivateLinkFactory,
)
from tests.base import fake
@pytest.fixture()
def user():
return AuthUserFactory()
@pytest.mark.django_db
class TestNodeChildrenList:
@pytest.fixture()
def private_project(self, user):
private_project = ProjectFactory()
private_project.add_contributor(
user,
permissions=permissions.WRITE
)
private_project.save()
return private_project
@pytest.fixture()
def component(self, user, private_project):
return NodeFactory(parent=private_project, creator=user)
@pytest.fixture()
def pointer(self):
return ProjectFactory()
@pytest.fixture()
def private_project_url(self, private_project):
return '/{}nodes/{}/children/'.format(API_BASE, private_project._id)
@pytest.fixture()
def public_project(self, user):
return ProjectFactory(is_public=True, creator=user)
@pytest.fixture()
def public_component(self, user, public_project):
return NodeFactory(parent=public_project, creator=user, is_public=True)
@pytest.fixture()
def public_project_url(self, user, public_project):
return '/{}nodes/{}/children/'.format(API_BASE, public_project._id)
@pytest.fixture()
def view_only_link(self, private_project):
view_only_link = PrivateLinkFactory(name='node_view_only_link')
view_only_link.nodes.add(private_project)
view_only_link.save()
return view_only_link
def test_return_public_node_children_list(
self, app, public_component,
public_project_url):
# test_return_public_node_children_list_logged_out
res = app.get(public_project_url)
assert res.status_code == 200
assert res.content_type == 'application/vnd.api+json'
assert len(res.json['data']) == 1
assert res.json['data'][0]['id'] == public_component._id
# test_return_public_node_children_list_logged_in
non_contrib = AuthUserFactory()
res = app.get(public_project_url, auth=non_contrib.auth)
assert res.status_code == 200
assert res.content_type == 'application/vnd.api+json'
assert len(res.json['data']) == 1
assert res.json['data'][0]['id'] == public_component._id
def test_return_private_node_children_list(
self, app, user, component, private_project, private_project_url):
# test_return_private_node_children_list_logged_out
res = app.get(private_project_url, expect_errors=True)
assert res.status_code == 401
assert 'detail' in res.json['errors'][0]
# test_return_private_node_children_list_logged_in_non_contributor
non_contrib = AuthUserFactory()
res = app.get(
private_project_url,
auth=non_contrib.auth,
expect_errors=True)
assert res.status_code == 403
assert 'detail' in res.json['errors'][0]
# test_return_private_node_children_list_logged_in_contributor
res = app.get(private_project_url, auth=user.auth)
assert res.status_code == 200
assert res.content_type == 'application/vnd.api+json'
assert len(res.json['data']) == 1
assert res.json['data'][0]['id'] == component._id
# test_return_private_node_children_osf_group_member_admin
group_mem = AuthUserFactory()
group = OSFGroupFactory(creator=group_mem)
private_project.add_osf_group(group, permissions.ADMIN)
res = app.get(private_project_url, auth=group_mem.auth)
assert res.status_code == 200
# Can view node children that you have implict admin permissions
assert len(res.json['data']) == 1
assert res.json['data'][0]['id'] == component._id
def test_node_children_list_does_not_include_pointers(
self, app, user, component, private_project_url):
res = app.get(private_project_url, auth=user.auth)
assert len(res.json['data']) == 1
def test_node_children_list_does_not_include_unauthorized_projects(
self, app, user, component, private_project, private_project_url):
NodeFactory(parent=private_project)
res = app.get(private_project_url, auth=user.auth)
assert len(res.json['data']) == 1
def test_node_children_list_does_not_include_deleted(
self, app, user, public_project, public_component,
component, public_project_url):
child_project = NodeFactory(parent=public_project, creator=user)
child_project.save()
res = app.get(public_project_url, auth=user.auth)
assert res.status_code == 200
ids = [node['id'] for node in res.json['data']]
assert child_project._id in ids
assert 2 == len(ids)
child_project.is_deleted = True
child_project.save()
res = app.get(public_project_url, auth=user.auth)
assert res.status_code == 200
ids = [node['id'] for node in res.json['data']]
assert child_project._id not in ids
assert 1 == len(ids)
def test_node_children_list_does_not_include_node_links(
self, app, user, public_project, public_component,
public_project_url):
pointed_to = ProjectFactory(is_public=True)
public_project.add_pointer(
pointed_to,
auth=Auth(public_project.creator)
)
res = app.get(public_project_url, auth=user.auth)
ids = [node['id'] for node in res.json['data']]
assert public_component._id in ids # sanity check
assert pointed_to._id not in ids
# Regression test for https://openscience.atlassian.net/browse/EMB-593
# Duplicates returned in child count
def test_node_children_related_counts_duplicate_query_results(self, app, user, public_project,
private_project, public_project_url):
user_2 = AuthUserFactory()
# Adding a child component
child = NodeFactory(parent=public_project, creator=user, is_public=True, category='software')
child.add_contributor(user_2, permissions.WRITE, save=True)
# Adding a grandchild
NodeFactory(parent=child, creator=user, is_public=True)
# Adding a node link
public_project.add_pointer(
private_project,
auth=Auth(public_project.creator)
)
# Assert NodeChildrenList returns one result
res = app.get(public_project_url, auth=user.auth)
assert len(res.json['data']) == 1
assert res.json['data'][0]['id'] == child._id
project_url = '/{}nodes/{}/?related_counts=children'.format(API_BASE, public_project._id)
res = app.get(project_url, auth=user.auth)
assert res.status_code == 200
# Verifying related_counts match direct children count (grandchildren not included, pointers not included)
assert res.json['data']['relationships']['children']['links']['related']['meta']['count'] == 1
def test_node_children_related_counts(self, app, user, public_project):
parent = ProjectFactory(creator=user, is_public=False)
user_2 = AuthUserFactory()
parent.add_contributor(user_2, permissions.ADMIN)
child = NodeFactory(parent=parent, creator=user_2, is_public=False, category='software')
NodeFactory(parent=child, creator=user_2, is_public=False)
# child has one component. `user` can view due to implict admin perms
component_url = '/{}nodes/{}/children/'.format(API_BASE, child._id, auth=user.auth)
res = app.get(component_url, auth=user.auth)
assert len(res.json['data']) == 1
project_url = '/{}nodes/{}/?related_counts=children'.format(API_BASE, child._id)
res = app.get(project_url, auth=user.auth)
assert res.status_code == 200
# Nodes with implicit admin perms are also included in the count
assert res.json['data']['relationships']['children']['links']['related']['meta']['count'] == 1
def test_child_counts_permissions(self, app, user, public_project):
NodeFactory(parent=public_project, creator=user)
url = '/{}nodes/{}/?related_counts=children'.format(API_BASE, public_project._id)
user_two = AuthUserFactory()
# Unauthorized
res = app.get(url)
assert res.json['data']['relationships']['children']['links']['related']['meta']['count'] == 0
# Logged in noncontrib
res = app.get(url, auth=user_two.auth)
assert res.json['data']['relationships']['children']['links']['related']['meta']['count'] == 0
# Logged in contrib
res = app.get(url, auth=user.auth)
assert res.json['data']['relationships']['children']['links']['related']['meta']['count'] == 1
def test_private_node_children_with_view_only_link(self, user, app, private_project,
component, view_only_link, private_project_url):
# get node related_counts with vol before vol is attached to components
node_url = '/{}nodes/{}/?related_counts=children&view_only={}'.format(API_BASE,
private_project._id, view_only_link.key)
res = app.get(node_url)
assert res.json['data']['relationships']['children']['links']['related']['meta']['count'] == 0
# view only link is not attached to components
view_only_link_url = '{}?view_only={}'.format(private_project_url, view_only_link.key)
res = app.get(view_only_link_url)
ids = [node['id'] for node in res.json['data']]
assert res.status_code == 200
assert len(ids) == 0
assert component._id not in ids
# view only link is attached to components
view_only_link.nodes.add(component)
res = app.get(view_only_link_url)
ids = [node['id'] for node in res.json['data']]
assert res.status_code == 200
assert component._id in ids
assert 'contributors' in res.json['data'][0]['relationships']
assert 'implicit_contributors' in res.json['data'][0]['relationships']
assert 'bibliographic_contributors' in res.json['data'][0]['relationships']
# get node related_counts with vol once vol is attached to components
res = app.get(node_url)
assert res.json['data']['relationships']['children']['links']['related']['meta']['count'] == 1
# make private vol anonymous
view_only_link.anonymous = True
view_only_link.save()
res = app.get(view_only_link_url)
assert 'contributors' not in res.json['data'][0]['relationships']
assert 'implicit_contributors' not in res.json['data'][0]['relationships']
assert 'bibliographic_contributors' not in res.json['data'][0]['relationships']
# delete vol
view_only_link.is_deleted = True
view_only_link.save()
res = app.get(view_only_link_url, expect_errors=True)
assert res.status_code == 401
@pytest.mark.django_db
class TestNodeChildrenListFiltering:
def test_node_child_filtering(self, app, user):
project = ProjectFactory(creator=user)
title_one, title_two = fake.bs(), fake.bs()
component = NodeFactory(title=title_one, parent=project)
component_two = NodeFactory(title=title_two, parent=project)
url = '/{}nodes/{}/children/?filter[title]={}'.format(
API_BASE,
project._id,
title_one
)
res = app.get(url, auth=user.auth)
ids = [node['id'] for node in res.json['data']]
assert component._id in ids
assert component_two._id not in ids
@pytest.mark.django_db
class TestNodeChildCreate:
@pytest.fixture()
def project(self, user):
return ProjectFactory(creator=user, is_public=True)
@pytest.fixture()
def url(self, project):
return '/{}nodes/{}/children/'.format(API_BASE, project._id)
@pytest.fixture()
def child(self):
return {
'data': {
'type': 'nodes',
'attributes': {
'title': 'child',
'description': 'this is a child project',
'category': 'project'
}
}
}
def test_creates_child(self, app, user, project, child, url):
# test_creates_child_logged_out_user
res = app.post_json_api(url, child, expect_errors=True)
assert res.status_code == 401
project.reload()
assert len(project.nodes) == 0
# test_creates_child_logged_in_read_contributor
read_contrib = AuthUserFactory()
project.add_contributor(
read_contrib,
permissions=permissions.READ,
auth=Auth(user), save=True
)
res = app.post_json_api(
url, child, auth=read_contrib.auth,
expect_errors=True
)
assert res.status_code == 403
project.reload()
assert len(project.nodes) == 0
# test_creates_child_logged_in_non_contributor
non_contrib = AuthUserFactory()
res = app.post_json_api(
url, child, auth=non_contrib.auth,
expect_errors=True
)
assert res.status_code == 403
project.reload()
assert len(project.nodes) == 0
# test_creates_child_group_member_read
group_mem = AuthUserFactory()
group = OSFGroupFactory(creator=group_mem)
project.add_osf_group(group, permissions.READ)
res = app.post_json_api(
url, child, auth=group_mem.auth,
expect_errors=True
)
assert res.status_code == 403
project.update_osf_group(group, permissions.WRITE)
res = app.post_json_api(
url, child, auth=group_mem.auth,
expect_errors=True
)
assert res.status_code == 201
# test_creates_child_no_type
child = {
'data': {
'attributes': {
'title': 'child',
'description': 'this is a child project',
'category': 'project',
}
}
}
res = app.post_json_api(url, child, auth=user.auth, expect_errors=True)
assert res.status_code == 400
assert res.json['errors'][0]['detail'] == 'This field may not be null.'
assert res.json['errors'][0]['source']['pointer'] == '/data/type'
# test_creates_child_incorrect_type
child = {
'data': {
'type': 'Wrong type.',
'attributes': {
'title': 'child',
'description': 'this is a child project',
'category': 'project',
}
}
}
res = app.post_json_api(url, child, auth=user.auth, expect_errors=True)
assert res.status_code == 409
assert res.json['errors'][0]['detail'] == 'This resource has a type of "nodes", but you set the json body\'s type field to "Wrong type.". You probably need to change the type field to match the resource\'s type.'
# test_creates_child_properties_not_nested
child = {
'data': {
'attributes': {
'title': 'child',
'description': 'this is a child project'
},
'category': 'project'
}
}
res = app.post_json_api(url, child, auth=user.auth, expect_errors=True)
assert res.status_code == 400
assert res.json['errors'][0]['detail'] == 'This field is required.'
assert res.json['errors'][0]['source']['pointer'] == '/data/attributes/category'
def test_creates_child_logged_in_write_contributor(
self, app, user, project, child, url):
write_contrib = AuthUserFactory()
project.add_contributor(
write_contrib,
permissions=permissions.WRITE,
auth=Auth(user),
save=True)
res = app.post_json_api(url, child, auth=write_contrib.auth)
assert res.status_code == 201
assert res.json['data']['attributes']['title'] == child['data']['attributes']['title']
assert res.json['data']['attributes']['description'] == child['data']['attributes']['description']
assert res.json['data']['attributes']['category'] == child['data']['attributes']['category']
project.reload()
child_id = res.json['data']['id']
assert child_id == project.nodes[0]._id
assert AbstractNode.load(child_id).logs.latest(
).action == NodeLog.PROJECT_CREATED
def test_creates_child_logged_in_owner(
self, app, user, project, child, url):
res = app.post_json_api(url, child, auth=user.auth)
assert res.status_code == 201
assert res.json['data']['attributes']['title'] == child['data']['attributes']['title']
assert res.json['data']['attributes']['description'] == child['data']['attributes']['description']
assert res.json['data']['attributes']['category'] == child['data']['attributes']['category']
project.reload()
assert res.json['data']['id'] == project.nodes[0]._id
assert project.nodes[0].logs.latest().action == NodeLog.PROJECT_CREATED
def test_creates_child_creates_child_and_sanitizes_html_logged_in_owner(
self, app, user, project, url):
title = '<em>Reasonable</em> <strong>Project</strong>'
description = 'An <script>alert("even reasonabler")</script> child'
res = app.post_json_api(url, {
'data': {
'type': 'nodes',
'attributes': {
'title': title,
'description': description,
'category': 'project',
'public': True
}
}
}, auth=user.auth)
child_id = res.json['data']['id']
assert res.status_code == 201
url = '/{}nodes/{}/'.format(API_BASE, child_id)
res = app.get(url, auth=user.auth)
assert res.json['data']['attributes']['title'] == strip_html(title)
assert res.json['data']['attributes']['description'] == strip_html(
description)
assert res.json['data']['attributes']['category'] == 'project'
project.reload()
child_id = res.json['data']['id']
assert child_id == project.nodes[0]._id
assert AbstractNode.load(child_id).logs.latest(
).action == NodeLog.PROJECT_CREATED
def test_cannot_create_child_on_a_registration(self, app, user, project):
registration = RegistrationFactory(project=project, creator=user)
url = '/{}nodes/{}/children/'.format(API_BASE, registration._id)
res = app.post_json_api(url, {
'data': {
'type': 'nodes',
'attributes': {
'title': fake.catch_phrase(),
'description': fake.bs(),
'category': 'project',
'public': True,
}
}
}, auth=user.auth, expect_errors=True)
assert res.status_code == 404
@pytest.mark.django_db
class TestNodeChildrenBulkCreate:
@pytest.fixture()
def project(self, user):
return ProjectFactory(creator=user, is_public=True)
@pytest.fixture()
def url(self, project):
return '/{}nodes/{}/children/'.format(API_BASE, project._id)
@pytest.fixture()
def child_one(self):
return {
'type': 'nodes',
'attributes': {
'title': 'child',
'description': 'this is a child project',
'category': 'project'
}
}
@pytest.fixture()
def child_two(self):
return {
'type': 'nodes',
'attributes': {
'title': 'second child',
'description': 'this is my hypothesis',
'category': 'hypothesis'
}
}
def test_bulk_children_create_blank_request(self, app, user, url):
res = app.post_json_api(
url, auth=user.auth,
expect_errors=True, bulk=True)
assert res.status_code == 400
def test_bulk_creates_children_limits(self, app, user, child_one, url):
res = app.post_json_api(
url, {'data': [child_one] * 101},
auth=user.auth, expect_errors=True, bulk=True
)
assert res.status_code == 400
assert res.json['errors'][0]['detail'] == 'Bulk operation limit is 100, got 101.'
assert res.json['errors'][0]['source']['pointer'] == '/data'
def test_bulk_creates_children_auth_errors(
self, app, user, project, child_one, child_two, url):
# test_bulk_creates_children_logged_out_user
res = app.post_json_api(
url,
{'data': [child_one, child_two]},
expect_errors=True, bulk=True
)
assert res.status_code == 401
project.reload()
assert len(project.nodes) == 0
# test_bulk_creates_children_logged_in_read_contributor
read_contrib = AuthUserFactory()
project.add_contributor(
read_contrib,
permissions=permissions.READ,
auth=Auth(user),
save=True)
res = app.post_json_api(
url,
{'data': [child_one, child_two]},
auth=read_contrib.auth,
expect_errors=True, bulk=True)
assert res.status_code == 403
project.reload()
assert len(project.nodes) == 0
# test_bulk_creates_children_logged_in_non_contributor
non_contrib = AuthUserFactory()
res = app.post_json_api(
url,
{'data': [child_one, child_two]},
auth=non_contrib.auth,
expect_errors=True, bulk=True)
assert res.status_code == 403
project.reload()
assert len(project.nodes) == 0
def test_bulk_creates_children_logged_in_owner(
self, app, user, project, child_one, child_two, url):
res = app.post_json_api(
url,
{'data': [child_one, child_two]},
auth=user.auth, bulk=True)
assert res.status_code == 201
assert res.json['data'][0]['attributes']['title'] == child_one['attributes']['title']
assert res.json['data'][0]['attributes']['description'] == child_one['attributes']['description']
assert res.json['data'][0]['attributes']['category'] == child_one['attributes']['category']
assert res.json['data'][1]['attributes']['title'] == child_two['attributes']['title']
assert res.json['data'][1]['attributes']['description'] == child_two['attributes']['description']
assert res.json['data'][1]['attributes']['category'] == child_two['attributes']['category']
project.reload()
nodes = project.nodes
assert res.json['data'][0]['id'] == nodes[0]._id
assert res.json['data'][1]['id'] == nodes[1]._id
assert nodes[0].logs.latest().action == NodeLog.PROJECT_CREATED
assert nodes[1].logs.latest().action == NodeLog.PROJECT_CREATED
def test_bulk_creates_children_child_logged_in_write_contributor(
self, app, user, project, child_one, child_two, url):
write_contrib = AuthUserFactory()
project.add_contributor(
write_contrib,
permissions=permissions.WRITE,
auth=Auth(user),
save=True)
res = app.post_json_api(
url,
{'data': [child_one, child_two]},
auth=write_contrib.auth, bulk=True)
assert res.status_code == 201
assert res.json['data'][0]['attributes']['title'] == child_one['attributes']['title']
assert res.json['data'][0]['attributes']['description'] == child_one['attributes']['description']
assert res.json['data'][0]['attributes']['category'] == child_one['attributes']['category']
assert res.json['data'][1]['attributes']['title'] == child_two['attributes']['title']
assert res.json['data'][1]['attributes']['description'] == child_two['attributes']['description']
assert res.json['data'][1]['attributes']['category'] == child_two['attributes']['category']
project.reload()
child_id = res.json['data'][0]['id']
child_two_id = res.json['data'][1]['id']
nodes = project.nodes
assert child_id == nodes[0]._id
assert child_two_id == nodes[1]._id
assert AbstractNode.load(child_id).logs.latest(
).action == NodeLog.PROJECT_CREATED
assert nodes[1].logs.latest().action == NodeLog.PROJECT_CREATED
def test_bulk_creates_children_and_sanitizes_html_logged_in_owner(
self, app, user, project, url):
title = '<em>Reasoning</em> <strong>Aboot Projects</strong>'
description = 'A <script>alert("super reasonable")</script> child'
res = app.post_json_api(url, {
'data': [{
'type': 'nodes',
'attributes': {
'title': title,
'description': description,
'category': 'project',
'public': True
}
}]
}, auth=user.auth, bulk=True)
child_id = res.json['data'][0]['id']
assert res.status_code == 201
url = '/{}nodes/{}/'.format(API_BASE, child_id)
res = app.get(url, auth=user.auth)
assert res.json['data']['attributes']['title'] == strip_html(title)
assert res.json['data']['attributes']['description'] == strip_html(
description)
assert res.json['data']['attributes']['category'] == 'project'
project.reload()
child_id = res.json['data']['id']
assert child_id == project.nodes[0]._id
assert AbstractNode.load(child_id).logs.latest(
).action == NodeLog.PROJECT_CREATED
def test_cannot_bulk_create_children_on_a_registration(
self, app, user, project, child_two):
registration = RegistrationFactory(project=project, creator=user)
url = '/{}nodes/{}/children/'.format(API_BASE, registration._id)
res = app.post_json_api(url, {
'data': [child_two, {
'type': 'nodes',
'attributes': {
'title': fake.catch_phrase(),
'description': fake.bs(),
'category': 'project',
'public': True,
}
}]
}, auth=user.auth, expect_errors=True, bulk=True)
assert res.status_code == 404
project.reload()
assert len(project.nodes) == 0
def test_bulk_creates_children_payload_errors(
self, app, user, project, child_two, url):
# def test_bulk_creates_children_no_type(self, app, user, project,
# child_two, url):
child = {
'data': [child_two, {
'attributes': {
'title': 'child',
'description': 'this is a child project',
'category': 'project',
}
}]
}
res = app.post_json_api(
url, child, auth=user.auth,
expect_errors=True, bulk=True)
assert res.status_code == 400
assert res.json['errors'][0]['detail'] == 'This field may not be null.'
assert res.json['errors'][0]['source']['pointer'] == '/data/1/type'
project.reload()
assert len(project.nodes) == 0
# def test_bulk_creates_children_incorrect_type(self, app, user, project,
# child_two, url):
child = {
'data': [child_two, {
'type': 'Wrong type.',
'attributes': {
'title': 'child',
'description': 'this is a child project',
'category': 'project',
}
}]
}
res = app.post_json_api(
url, child, auth=user.auth,
expect_errors=True, bulk=True)
assert res.status_code == 409
assert res.json['errors'][0]['detail'] == 'This resource has a type of "nodes", but you set the json body\'s type field to "Wrong type.". You probably need to change the type field to match the resource\'s type.'
project.reload()
assert len(project.nodes) == 0
# def test_bulk_creates_children_properties_not_nested(self, app, user,
# project, child_two, url):
child = {
'data': [child_two, {
'title': 'child',
'description': 'this is a child project',
'category': 'project',
}]
}
res = app.post_json_api(
url, child, auth=user.auth,
expect_errors=True, bulk=True)
assert res.status_code == 400
assert res.json['errors'][0]['detail'] == 'This field is required.'
assert res.json['errors'][0]['source']['pointer'] == '/data/1/attributes/category'
project.reload()
assert len(project.nodes) == 0
| Java |
/*
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights
* Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.services.gamelift.model.transform;
import java.util.Map;
import java.util.Map.Entry;
import java.math.*;
import java.nio.ByteBuffer;
import com.amazonaws.services.gamelift.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* CreateAliasResult JSON Unmarshaller
*/
public class CreateAliasResultJsonUnmarshaller implements
Unmarshaller<CreateAliasResult, JsonUnmarshallerContext> {
public CreateAliasResult unmarshall(JsonUnmarshallerContext context)
throws Exception {
CreateAliasResult createAliasResult = new CreateAliasResult();
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL)
return null;
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("Alias", targetDepth)) {
context.nextToken();
createAliasResult.setAlias(AliasJsonUnmarshaller
.getInstance().unmarshall(context));
}
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null
|| context.getLastParsedParentElement().equals(
currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return createAliasResult;
}
private static CreateAliasResultJsonUnmarshaller instance;
public static CreateAliasResultJsonUnmarshaller getInstance() {
if (instance == null)
instance = new CreateAliasResultJsonUnmarshaller();
return instance;
}
}
| Java |
// Copyright 2017 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.devtools.build.android.desugar.io;
import static com.google.common.base.Preconditions.checkArgument;
import com.google.common.io.ByteStreams;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.zip.CRC32;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/** Output provider is a zip file. */
class ZipOutputFileProvider implements OutputFileProvider {
private final ZipOutputStream out;
public ZipOutputFileProvider(Path root) throws IOException {
out = new ZipOutputStream(new BufferedOutputStream(Files.newOutputStream(root)));
}
@Override
public void copyFrom(String filename, InputFileProvider inputFileProvider) throws IOException {
// TODO(bazel-team): Avoid de- and re-compressing resource files
out.putNextEntry(inputFileProvider.getZipEntry(filename));
try (InputStream is = inputFileProvider.getInputStream(filename)) {
ByteStreams.copy(is, out);
}
out.closeEntry();
}
@Override
public void write(String filename, byte[] content) throws IOException {
checkArgument(filename.equals(DESUGAR_DEPS_FILENAME) || filename.endsWith(".class"),
"Expect file to be copied: %s", filename);
writeStoredEntry(out, filename, content);
}
@Override
public void close() throws IOException {
out.close();
}
private static void writeStoredEntry(ZipOutputStream out, String filename, byte[] content)
throws IOException {
// Need to pre-compute checksum for STORED (uncompressed) entries)
CRC32 checksum = new CRC32();
checksum.update(content);
ZipEntry result = new ZipEntry(filename);
result.setTime(0L); // Use stable timestamp Jan 1 1980
result.setCrc(checksum.getValue());
result.setSize(content.length);
result.setCompressedSize(content.length);
// Write uncompressed, since this is just an intermediary artifact that
// we will convert to .dex
result.setMethod(ZipEntry.STORED);
out.putNextEntry(result);
out.write(content);
out.closeEntry();
}
}
| Java |
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
.PHONY: build push
PREFIX = quay.io/fluentd_elasticsearch
IMAGE = elasticsearch
TAG = v7.16.2
build:
docker build --tag ${PREFIX}/${IMAGE}:${TAG} .
docker build --tag ${PREFIX}/${IMAGE}:latest .
push:
docker push ${PREFIX}/${IMAGE}:${TAG}
docker push ${PREFIX}/${IMAGE}:latest
| Java |
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: The String.prototype.charAt.length property has the attribute DontEnum
es5id: 15.5.4.4_A8
description: >
Checking if enumerating the String.prototype.charAt.length
property fails
---*/
//////////////////////////////////////////////////////////////////////////////
//CHECK#0
if (!(String.prototype.charAt.hasOwnProperty('length'))) {
$ERROR('#0: String.prototype.charAt.hasOwnProperty(\'length\') return true. Actual: '+String.prototype.charAt.hasOwnProperty('length'));
}
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// CHECK#1
if (String.prototype.charAt.propertyIsEnumerable('length')) {
$ERROR('#1: String.prototype.charAt.propertyIsEnumerable(\'length\') return false. Actual: '+String.prototype.charAt.propertyIsEnumerable('length'));
}
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// CHECK#2
var count=0;
for (var p in String.prototype.charAt){
if (p==="length") count++;
}
if (count !== 0) {
$ERROR('#2: count=0; for (p in String.prototype.charAt){if (p==="length") count++;}; count === 0. Actual: count ==='+count );
}
//
//////////////////////////////////////////////////////////////////////////////
| Java |
package imagestreamimport
import (
"fmt"
"net/http"
"time"
"github.com/golang/glog"
gocontext "golang.org/x/net/context"
kapierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/diff"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/validation/field"
apirequest "k8s.io/apiserver/pkg/endpoints/request"
"k8s.io/apiserver/pkg/registry/rest"
kapi "k8s.io/kubernetes/pkg/api"
authorizationapi "github.com/openshift/origin/pkg/authorization/api"
"github.com/openshift/origin/pkg/client"
serverapi "github.com/openshift/origin/pkg/cmd/server/api"
"github.com/openshift/origin/pkg/dockerregistry"
"github.com/openshift/origin/pkg/image/api"
imageapiv1 "github.com/openshift/origin/pkg/image/api/v1"
"github.com/openshift/origin/pkg/image/importer"
"github.com/openshift/origin/pkg/image/registry/imagestream"
quotautil "github.com/openshift/origin/pkg/quota/util"
)
// ImporterFunc returns an instance of the importer that should be used per invocation.
type ImporterFunc func(r importer.RepositoryRetriever) importer.Interface
// ImporterDockerRegistryFunc returns an instance of a docker client that should be used per invocation of import,
// may be nil if no legacy import capability is required.
type ImporterDockerRegistryFunc func() dockerregistry.Client
// REST implements the RESTStorage interface for ImageStreamImport
type REST struct {
importFn ImporterFunc
streams imagestream.Registry
internalStreams rest.CreaterUpdater
images rest.Creater
secrets client.ImageStreamSecretsNamespacer
transport http.RoundTripper
insecureTransport http.RoundTripper
clientFn ImporterDockerRegistryFunc
strategy *strategy
sarClient client.SubjectAccessReviewInterface
}
// NewREST returns a REST storage implementation that handles importing images. The clientFn argument is optional
// if v1 Docker Registry importing is not required. Insecure transport is optional, and both transports should not
// include client certs unless you wish to allow the entire cluster to import using those certs.
func NewREST(importFn ImporterFunc, streams imagestream.Registry, internalStreams rest.CreaterUpdater,
images rest.Creater, secrets client.ImageStreamSecretsNamespacer,
transport, insecureTransport http.RoundTripper,
clientFn ImporterDockerRegistryFunc,
allowedImportRegistries *serverapi.AllowedRegistries,
registryFn api.DefaultRegistryFunc,
sarClient client.SubjectAccessReviewInterface,
) *REST {
return &REST{
importFn: importFn,
streams: streams,
internalStreams: internalStreams,
images: images,
secrets: secrets,
transport: transport,
insecureTransport: insecureTransport,
clientFn: clientFn,
strategy: NewStrategy(allowedImportRegistries, registryFn),
sarClient: sarClient,
}
}
// New is only implemented to make REST implement RESTStorage
func (r *REST) New() runtime.Object {
return &api.ImageStreamImport{}
}
func (r *REST) Create(ctx apirequest.Context, obj runtime.Object) (runtime.Object, error) {
isi, ok := obj.(*api.ImageStreamImport)
if !ok {
return nil, kapierrors.NewBadRequest(fmt.Sprintf("obj is not an ImageStreamImport: %#v", obj))
}
inputMeta := isi.ObjectMeta
if err := rest.BeforeCreate(r.strategy, ctx, obj); err != nil {
return nil, err
}
// Check if the user is allowed to create Images or ImageStreamMappings.
// In case the user is allowed to create them, do not validate the ImageStreamImport
// registry location against the registry whitelist, but instead allow to create any
// image from any registry.
user, ok := apirequest.UserFrom(ctx)
if !ok {
return nil, kapierrors.NewBadRequest("unable to get user from context")
}
isCreateImage, err := r.sarClient.Create(authorizationapi.AddUserToSAR(user,
&authorizationapi.SubjectAccessReview{
Action: authorizationapi.Action{
Verb: "create",
Group: api.GroupName,
Resource: "images",
},
},
))
if err != nil {
return nil, err
}
isCreateImageStreamMapping, err := r.sarClient.Create(authorizationapi.AddUserToSAR(user,
&authorizationapi.SubjectAccessReview{
Action: authorizationapi.Action{
Verb: "create",
Group: api.GroupName,
Resource: "imagestreammapping",
},
},
))
if err != nil {
return nil, err
}
if !isCreateImage.Allowed && !isCreateImageStreamMapping.Allowed {
if errs := r.strategy.ValidateAllowedRegistries(isi); len(errs) != 0 {
return nil, kapierrors.NewInvalid(api.Kind("ImageStreamImport"), isi.Name, errs)
}
}
namespace, ok := apirequest.NamespaceFrom(ctx)
if !ok {
return nil, kapierrors.NewBadRequest("a namespace must be specified to import images")
}
if r.clientFn != nil {
if client := r.clientFn(); client != nil {
ctx = apirequest.WithValue(ctx, importer.ContextKeyV1RegistryClient, client)
}
}
// only load secrets if we need them
credentials := importer.NewLazyCredentialsForSecrets(func() ([]kapi.Secret, error) {
secrets, err := r.secrets.ImageStreamSecrets(namespace).Secrets(isi.Name, metav1.ListOptions{})
if err != nil {
return nil, err
}
return secrets.Items, nil
})
importCtx := importer.NewContext(r.transport, r.insecureTransport).WithCredentials(credentials)
imports := r.importFn(importCtx)
if err := imports.Import(ctx.(gocontext.Context), isi); err != nil {
return nil, kapierrors.NewInternalError(err)
}
// if we encountered an error loading credentials and any images could not be retrieved with an access
// related error, modify the message.
// TODO: set a status cause
if err := credentials.Err(); err != nil {
for i, image := range isi.Status.Images {
switch image.Status.Reason {
case metav1.StatusReasonUnauthorized, metav1.StatusReasonForbidden:
isi.Status.Images[i].Status.Message = fmt.Sprintf("Unable to load secrets for this image: %v; (%s)", err, image.Status.Message)
}
}
if r := isi.Status.Repository; r != nil {
switch r.Status.Reason {
case metav1.StatusReasonUnauthorized, metav1.StatusReasonForbidden:
r.Status.Message = fmt.Sprintf("Unable to load secrets for this repository: %v; (%s)", err, r.Status.Message)
}
}
}
// TODO: perform the transformation of the image stream and return it with the ISI if import is false
// so that clients can see what the resulting object would look like.
if !isi.Spec.Import {
clearManifests(isi)
return isi, nil
}
create := false
stream, err := r.streams.GetImageStream(ctx, isi.Name, &metav1.GetOptions{})
if err != nil {
if !kapierrors.IsNotFound(err) {
return nil, err
}
// consistency check, stream must exist
if len(inputMeta.ResourceVersion) > 0 || len(inputMeta.UID) > 0 {
return nil, err
}
create = true
stream = &api.ImageStream{
ObjectMeta: metav1.ObjectMeta{
Name: isi.Name,
Namespace: namespace,
Generation: 0,
},
}
} else {
if len(inputMeta.ResourceVersion) > 0 && inputMeta.ResourceVersion != stream.ResourceVersion {
glog.V(4).Infof("DEBUG: mismatch between requested ResourceVersion %s and located ResourceVersion %s", inputMeta.ResourceVersion, stream.ResourceVersion)
return nil, kapierrors.NewConflict(api.Resource("imagestream"), inputMeta.Name, fmt.Errorf("the image stream was updated from %q to %q", inputMeta.ResourceVersion, stream.ResourceVersion))
}
if len(inputMeta.UID) > 0 && inputMeta.UID != stream.UID {
glog.V(4).Infof("DEBUG: mismatch between requested UID %s and located UID %s", inputMeta.UID, stream.UID)
return nil, kapierrors.NewNotFound(api.Resource("imagestream"), inputMeta.Name)
}
}
if stream.Annotations == nil {
stream.Annotations = make(map[string]string)
}
now := metav1.Now()
_, hasAnnotation := stream.Annotations[api.DockerImageRepositoryCheckAnnotation]
nextGeneration := stream.Generation + 1
original, err := kapi.Scheme.DeepCopy(stream)
if err != nil {
return nil, err
}
// walk the retrieved images, ensuring each one exists in etcd
importedImages := make(map[string]error)
updatedImages := make(map[string]*api.Image)
if spec := isi.Spec.Repository; spec != nil {
for i, status := range isi.Status.Repository.Images {
if checkImportFailure(status, stream, status.Tag, nextGeneration, now) {
continue
}
image := status.Image
ref, err := api.ParseDockerImageReference(image.DockerImageReference)
if err != nil {
utilruntime.HandleError(fmt.Errorf("unable to parse image reference during import: %v", err))
continue
}
from, err := api.ParseDockerImageReference(spec.From.Name)
if err != nil {
utilruntime.HandleError(fmt.Errorf("unable to parse from reference during import: %v", err))
continue
}
tag := ref.Tag
if len(status.Tag) > 0 {
tag = status.Tag
}
// we've imported a set of tags, ensure spec tag will point to this for later imports
from.ID, from.Tag = "", tag
if updated, ok := r.importSuccessful(ctx, image, stream, tag, from.Exact(), nextGeneration,
now, spec.ImportPolicy, spec.ReferencePolicy, importedImages, updatedImages); ok {
isi.Status.Repository.Images[i].Image = updated
}
}
}
for i, spec := range isi.Spec.Images {
if spec.To == nil {
continue
}
tag := spec.To.Name
// record a failure condition
status := isi.Status.Images[i]
if checkImportFailure(status, stream, tag, nextGeneration, now) {
// ensure that we have a spec tag set
ensureSpecTag(stream, tag, spec.From.Name, spec.ImportPolicy, spec.ReferencePolicy, false)
continue
}
// record success
image := status.Image
if updated, ok := r.importSuccessful(ctx, image, stream, tag, spec.From.Name, nextGeneration,
now, spec.ImportPolicy, spec.ReferencePolicy, importedImages, updatedImages); ok {
isi.Status.Images[i].Image = updated
}
}
// TODO: should we allow partial failure?
for _, err := range importedImages {
if err != nil {
return nil, err
}
}
clearManifests(isi)
// ensure defaulting is applied by round trip converting
// TODO: convert to using versioned types.
external, err := kapi.Scheme.ConvertToVersion(stream, imageapiv1.SchemeGroupVersion)
if err != nil {
return nil, err
}
kapi.Scheme.Default(external)
internal, err := kapi.Scheme.ConvertToVersion(external, api.SchemeGroupVersion)
if err != nil {
return nil, err
}
stream = internal.(*api.ImageStream)
// if and only if we have changes between the original and the imported stream, trigger
// an import
hasChanges := !kapi.Semantic.DeepEqual(original, stream)
if create {
stream.Annotations[api.DockerImageRepositoryCheckAnnotation] = now.UTC().Format(time.RFC3339)
glog.V(4).Infof("create new stream: %#v", stream)
obj, err = r.internalStreams.Create(ctx, stream)
} else {
if hasAnnotation && !hasChanges {
glog.V(4).Infof("stream did not change: %#v", stream)
obj, err = original.(*api.ImageStream), nil
} else {
if glog.V(4) {
glog.V(4).Infof("updating stream %s", diff.ObjectDiff(original, stream))
}
stream.Annotations[api.DockerImageRepositoryCheckAnnotation] = now.UTC().Format(time.RFC3339)
obj, _, err = r.internalStreams.Update(ctx, stream.Name, rest.DefaultUpdatedObjectInfo(stream, kapi.Scheme))
}
}
if err != nil {
// if we have am admission limit error then record the conditions on the original stream. Quota errors
// will be recorded by the importer.
if quotautil.IsErrorLimitExceeded(err) {
originalStream := original.(*api.ImageStream)
recordLimitExceededStatus(originalStream, stream, err, now, nextGeneration)
var limitErr error
obj, _, limitErr = r.internalStreams.Update(ctx, stream.Name, rest.DefaultUpdatedObjectInfo(originalStream, kapi.Scheme))
if limitErr != nil {
utilruntime.HandleError(fmt.Errorf("failed to record limit exceeded status in image stream %s/%s: %v", stream.Namespace, stream.Name, limitErr))
}
}
return nil, err
}
isi.Status.Import = obj.(*api.ImageStream)
return isi, nil
}
// recordLimitExceededStatus adds the limit err to any new tag.
func recordLimitExceededStatus(originalStream *api.ImageStream, newStream *api.ImageStream, err error, now metav1.Time, nextGeneration int64) {
for tag := range newStream.Status.Tags {
if _, ok := originalStream.Status.Tags[tag]; !ok {
api.SetTagConditions(originalStream, tag, newImportFailedCondition(err, nextGeneration, now))
}
}
}
func checkImportFailure(status api.ImageImportStatus, stream *api.ImageStream, tag string, nextGeneration int64, now metav1.Time) bool {
if status.Image != nil && status.Status.Status == metav1.StatusSuccess {
return false
}
message := status.Status.Message
if len(message) == 0 {
message = "unknown error prevented import"
}
condition := api.TagEventCondition{
Type: api.ImportSuccess,
Status: kapi.ConditionFalse,
Message: message,
Reason: string(status.Status.Reason),
Generation: nextGeneration,
LastTransitionTime: now,
}
if tag == "" {
if len(status.Tag) > 0 {
tag = status.Tag
} else if status.Image != nil {
if ref, err := api.ParseDockerImageReference(status.Image.DockerImageReference); err == nil {
tag = ref.Tag
}
}
}
if !api.HasTagCondition(stream, tag, condition) {
api.SetTagConditions(stream, tag, condition)
if tagRef, ok := stream.Spec.Tags[tag]; ok {
zero := int64(0)
tagRef.Generation = &zero
stream.Spec.Tags[tag] = tagRef
}
}
return true
}
// ensureSpecTag guarantees that the spec tag is set with the provided from, importPolicy and referencePolicy.
// If reset is passed, the tag will be overwritten.
func ensureSpecTag(stream *api.ImageStream, tag, from string, importPolicy api.TagImportPolicy,
referencePolicy api.TagReferencePolicy, reset bool) api.TagReference {
if stream.Spec.Tags == nil {
stream.Spec.Tags = make(map[string]api.TagReference)
}
specTag, ok := stream.Spec.Tags[tag]
if ok && !reset {
return specTag
}
specTag.From = &kapi.ObjectReference{
Kind: "DockerImage",
Name: from,
}
zero := int64(0)
specTag.Generation = &zero
specTag.ImportPolicy = importPolicy
specTag.ReferencePolicy = referencePolicy
stream.Spec.Tags[tag] = specTag
return specTag
}
// importSuccessful records a successful import into an image stream, setting the spec tag, status tag or conditions, and ensuring
// the image is created in etcd. Images are cached so they are not created multiple times in a row (when multiple tags point to the
// same image), and a failure to persist the image will be summarized before we update the stream. If an image was imported by this
// operation, it *replaces* the imported image (from the remote repository) with the updated image.
func (r *REST) importSuccessful(
ctx apirequest.Context,
image *api.Image, stream *api.ImageStream, tag string, from string, nextGeneration int64, now metav1.Time,
importPolicy api.TagImportPolicy, referencePolicy api.TagReferencePolicy,
importedImages map[string]error, updatedImages map[string]*api.Image,
) (*api.Image, bool) {
r.strategy.PrepareImageForCreate(image)
pullSpec, _ := api.MostAccuratePullSpec(image.DockerImageReference, image.Name, "")
tagEvent := api.TagEvent{
Created: now,
DockerImageReference: pullSpec,
Image: image.Name,
Generation: nextGeneration,
}
if stream.Spec.Tags == nil {
stream.Spec.Tags = make(map[string]api.TagReference)
}
// ensure the spec and status tag match the imported image
changed := api.DifferentTagEvent(stream, tag, tagEvent) || api.DifferentTagGeneration(stream, tag)
specTag, ok := stream.Spec.Tags[tag]
if changed || !ok {
specTag = ensureSpecTag(stream, tag, from, importPolicy, referencePolicy, true)
api.AddTagEventToImageStream(stream, tag, tagEvent)
}
// always reset the import policy
specTag.ImportPolicy = importPolicy
stream.Spec.Tags[tag] = specTag
// import or reuse the image, and ensure tag conditions are set
importErr, alreadyImported := importedImages[image.Name]
if importErr != nil {
api.SetTagConditions(stream, tag, newImportFailedCondition(importErr, nextGeneration, now))
} else {
api.SetTagConditions(stream, tag)
}
// create the image if it does not exist, otherwise cache the updated status from the store for use by other tags
if alreadyImported {
if updatedImage, ok := updatedImages[image.Name]; ok {
return updatedImage, true
}
return nil, false
}
updated, err := r.images.Create(ctx, image)
switch {
case kapierrors.IsAlreadyExists(err):
if err := api.ImageWithMetadata(image); err != nil {
glog.V(4).Infof("Unable to update image metadata during image import when image already exists %q: err", image.Name, err)
}
updated = image
fallthrough
case err == nil:
updatedImage := updated.(*api.Image)
updatedImages[image.Name] = updatedImage
//isi.Status.Repository.Images[i].Image = updatedImage
importedImages[image.Name] = nil
return updatedImage, true
default:
importedImages[image.Name] = err
}
return nil, false
}
// clearManifests unsets the manifest for each object that does not request it
func clearManifests(isi *api.ImageStreamImport) {
for i := range isi.Status.Images {
if !isi.Spec.Images[i].IncludeManifest {
if isi.Status.Images[i].Image != nil {
isi.Status.Images[i].Image.DockerImageManifest = ""
isi.Status.Images[i].Image.DockerImageConfig = ""
}
}
}
if isi.Spec.Repository != nil && !isi.Spec.Repository.IncludeManifest {
for i := range isi.Status.Repository.Images {
if isi.Status.Repository.Images[i].Image != nil {
isi.Status.Repository.Images[i].Image.DockerImageManifest = ""
isi.Status.Repository.Images[i].Image.DockerImageConfig = ""
}
}
}
}
func newImportFailedCondition(err error, gen int64, now metav1.Time) api.TagEventCondition {
c := api.TagEventCondition{
Type: api.ImportSuccess,
Status: kapi.ConditionFalse,
Message: err.Error(),
Generation: gen,
LastTransitionTime: now,
}
if status, ok := err.(kapierrors.APIStatus); ok {
s := status.Status()
c.Reason, c.Message = string(s.Reason), s.Message
}
return c
}
func invalidStatus(kind, position string, errs ...*field.Error) metav1.Status {
return kapierrors.NewInvalid(api.Kind(kind), position, errs).ErrStatus
}
| Java |
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
FROM gcr.io/oss-fuzz-base/base-builder
RUN apt-get update && apt-get install -y make autoconf automake libtool shtool
RUN git clone --depth 1 https://github.com/file/file.git
WORKDIR file
COPY build.sh magic_fuzzer.cc $SRC/
| Java |
/*
* Scala.js (https://www.scala-js.org/)
*
* Copyright EPFL.
*
* Licensed under Apache License 2.0
* (https://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/
package scala.scalajs.js.annotation
import scala.annotation.meta._
/** Marks the annotated class or object as being a member of the JavaScript
* global scope.
*
* The annotated class/object must also be annotated with `@js.native`, and
* therefore extend [[scala.scalajs.js.Any js.Any]].
*
* Given:
* {{{
* @js.native
* @JSGlobal
* class Foo extends js.Object
*
* @js.native
* @JSGlobal("Foobar")
* object Bar extends js.Object
*
* @js.native
* @JSGlobal("Lib.Babar")
* class Babar extends js.Object
* }}}
*
* The following mappings apply (`global` denotes the global scope):
*
* {{{
* Scala.js | JavaScript
* ------------------------+------------------
* new Foo() | new global.Foo()
* Bar | global.Foobar
* js.constructorOf[Babar] | global.Lib.Babar
* }}}
*
* @see [[http://www.scala-js.org/doc/calling-javascript.html Calling JavaScript from Scala.js]]
*/
@field @getter @setter
class JSGlobal extends scala.annotation.StaticAnnotation {
def this(name: String) = this()
}
| Java |
/**
* JBoss, Home of Professional Open Source.
* Copyright 2014-2022 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.pnc.coordinator.test;
import org.jboss.pnc.common.json.ConfigurationParseException;
import org.jboss.pnc.mock.repository.BuildConfigurationRepositoryMock;
import org.jboss.pnc.model.BuildConfiguration;
import org.jboss.pnc.model.BuildConfigurationSet;
import org.jboss.pnc.enums.RebuildMode;
import org.jboss.pnc.spi.datastore.DatastoreException;
import org.jboss.pnc.spi.exception.CoreException;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeoutException;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
/**
* Group consists of configA,config B and configC. <br/>
* configC is independent, configB depends on configA. <br/>
*
*
* config1 is an "outside" dependency of configA
*
* <p>
* Author: Michal Szynkiewicz, [email protected] Date: 9/14/16 Time: 12:09 PM
* </p>
*/
public class OutsideGroupDependentConfigsTest extends AbstractDependentBuildTest {
private BuildConfiguration config1;
private BuildConfiguration configA;
private BuildConfiguration configB;
private BuildConfigurationSet configSet;
@Before
public void initialize() throws DatastoreException, ConfigurationParseException {
config1 = buildConfig("1");
configA = buildConfig("A", config1);
configB = buildConfig("B", configA);
BuildConfiguration configC = buildConfig("C");
configSet = configSet(configA, configB, configC);
buildConfigurationRepository = spy(new BuildConfigurationRepositoryMock());
when(buildConfigurationRepository.queryWithPredicates(any()))
.thenReturn(new ArrayList<>(configSet.getBuildConfigurations()));
super.initialize();
saveConfig(config1);
configSet.getBuildConfigurations().forEach(this::saveConfig);
insertNewBuildRecords(config1, configA, configB, configC);
makeResult(configA).dependOn(config1);
}
@Test
public void shouldNotRebuildIfDependencyIsNotRebuilt()
throws CoreException, TimeoutException, InterruptedException {
build(configSet, RebuildMode.IMPLICIT_DEPENDENCY_CHECK);
waitForEmptyBuildQueue();
List<BuildConfiguration> configsWithTasks = getBuiltConfigs();
assertThat(configsWithTasks).isEmpty();
}
@Test
public void shouldRebuildOnlyDependent() throws CoreException, TimeoutException, InterruptedException {
insertNewBuildRecords(config1);
build(configSet, RebuildMode.IMPLICIT_DEPENDENCY_CHECK);
waitForEmptyBuildQueue();
List<BuildConfiguration> configsWithTasks = getBuiltConfigs();
assertThat(configsWithTasks).hasSameElementsAs(Arrays.asList(configA, configB));
}
} | Java |
/** @prettier */
import { expect } from 'chai';
import { EMPTY, of, EmptyError, defer, throwError, Observable } from 'rxjs';
import { throwIfEmpty, mergeMap, retry, take } from 'rxjs/operators';
import { TestScheduler } from 'rxjs/testing';
import { observableMatcher } from '../helpers/observableMatcher';
/** @test {throwIfEmpty} */
describe('throwIfEmpty', () => {
let rxTestScheduler: TestScheduler;
beforeEach(() => {
rxTestScheduler = new TestScheduler(observableMatcher);
});
describe('with errorFactory', () => {
it('should error when empty', () => {
rxTestScheduler.run(({ cold, expectObservable }) => {
const source = cold('----|');
const expected = ' ----#';
const result = source.pipe(throwIfEmpty(() => new Error('test')));
expectObservable(result).toBe(expected, undefined, new Error('test'));
});
});
it('should throw if empty', () => {
const error = new Error('So empty inside');
let thrown: any;
EMPTY.pipe(throwIfEmpty(() => error)).subscribe({
error(err) {
thrown = err;
},
});
expect(thrown).to.equal(error);
});
it('should NOT throw if NOT empty', () => {
const error = new Error('So empty inside');
let thrown: any;
of('test')
.pipe(throwIfEmpty(() => error))
.subscribe({
error(err) {
thrown = err;
},
});
expect(thrown).to.be.undefined;
});
it('should pass values through', () => {
rxTestScheduler.run(({ cold, expectObservable, expectSubscriptions }) => {
const source = cold('----a---b---c---|');
const sub1 = ' ^---------------!';
const expected = ' ----a---b---c---|';
const result = source.pipe(throwIfEmpty(() => new Error('test')));
expectObservable(result).toBe(expected);
expectSubscriptions(source.subscriptions).toBe([sub1]);
});
});
it('should never when never', () => {
rxTestScheduler.run(({ cold, expectObservable, expectSubscriptions }) => {
const source = cold('-');
const sub1 = ' ^';
const expected = ' -';
const result = source.pipe(throwIfEmpty(() => new Error('test')));
expectObservable(result).toBe(expected);
expectSubscriptions(source.subscriptions).toBe([sub1]);
});
});
it('should error when empty', () => {
rxTestScheduler.run(({ cold, expectObservable, expectSubscriptions }) => {
const source = cold('----|');
const sub1 = ' ^---!';
const expected = ' ----#';
const result = source.pipe(throwIfEmpty(() => new Error('test')));
expectObservable(result).toBe(expected, undefined, new Error('test'));
expectSubscriptions(source.subscriptions).toBe([sub1]);
});
});
it('should throw if empty after retry', () => {
const error = new Error('So empty inside');
let thrown: any;
let sourceIsEmpty = false;
const source = defer(() => {
if (sourceIsEmpty) {
return EMPTY;
}
sourceIsEmpty = true;
return of(1, 2);
});
source
.pipe(
throwIfEmpty(() => error),
mergeMap((value) => {
if (value > 1) {
return throwError(() => new Error());
}
return of(value);
}),
retry(1)
)
.subscribe({
error(err) {
thrown = err;
},
});
expect(thrown).to.equal(error);
});
});
describe('without errorFactory', () => {
it('should throw EmptyError if empty', () => {
let thrown: any;
EMPTY.pipe(throwIfEmpty()).subscribe({
error(err) {
thrown = err;
},
});
expect(thrown).to.be.instanceof(EmptyError);
});
it('should NOT throw if NOT empty', () => {
let thrown: any;
of('test')
.pipe(throwIfEmpty())
.subscribe({
error(err) {
thrown = err;
},
});
expect(thrown).to.be.undefined;
});
it('should pass values through', () => {
rxTestScheduler.run(({ cold, expectObservable, expectSubscriptions }) => {
const source = cold('----a---b---c---|');
const sub1 = ' ^---------------!';
const expected = ' ----a---b---c---|';
const result = source.pipe(throwIfEmpty());
expectObservable(result).toBe(expected);
expectSubscriptions(source.subscriptions).toBe([sub1]);
});
});
it('should never when never', () => {
rxTestScheduler.run(({ cold, expectObservable, expectSubscriptions }) => {
const source = cold('-');
const sub1 = ' ^';
const expected = ' -';
const result = source.pipe(throwIfEmpty());
expectObservable(result).toBe(expected);
expectSubscriptions(source.subscriptions).toBe([sub1]);
});
});
it('should error when empty', () => {
rxTestScheduler.run(({ cold, expectObservable, expectSubscriptions }) => {
const source = cold('----|');
const sub1 = ' ^---!';
const expected = ' ----#';
const result = source.pipe(throwIfEmpty());
expectObservable(result).toBe(expected, undefined, new EmptyError());
expectSubscriptions(source.subscriptions).toBe([sub1]);
});
});
it('should throw if empty after retry', () => {
let thrown: any;
let sourceIsEmpty = false;
const source = defer(() => {
if (sourceIsEmpty) {
return EMPTY;
}
sourceIsEmpty = true;
return of(1, 2);
});
source
.pipe(
throwIfEmpty(),
mergeMap((value) => {
if (value > 1) {
return throwError(() => new Error());
}
return of(value);
}),
retry(1)
)
.subscribe({
error(err) {
thrown = err;
},
});
expect(thrown).to.be.instanceof(EmptyError);
});
});
it('should stop listening to a synchronous observable when unsubscribed', () => {
const sideEffects: number[] = [];
const synchronousObservable = new Observable<number>((subscriber) => {
// This will check to see if the subscriber was closed on each loop
// when the unsubscribe hits (from the `take`), it should be closed
for (let i = 0; !subscriber.closed && i < 10; i++) {
sideEffects.push(i);
subscriber.next(i);
}
});
synchronousObservable.pipe(throwIfEmpty(), take(3)).subscribe(() => {
/* noop */
});
expect(sideEffects).to.deep.equal([0, 1, 2]);
});
});
| Java |
--------------------------------------------------------------------------------
## Treebank Statistics (UD_Hungarian)
This relation is universal.
1 nodes (0%) are attached to their parents as `discourse`.
1 instances of `discourse` (100%) are right-to-left (child precedes parent).
Average distance between parent and child is 3.
The following 1 pairs of parts of speech are connected with `discourse`: [hu-pos/VERB]()-[hu-pos/NOUN]() (1; 100% instances).
~~~ conllu
# visual-style 23 bgColor:blue
# visual-style 23 fgColor:white
# visual-style 26 bgColor:blue
# visual-style 26 fgColor:white
# visual-style 26 23 discourse color:blue
1 A a DET _ Definite=Def|PronType=Art 3 det _ _
2 nagy nagy ADJ _ Case=Nom|Degree=Pos|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None 3 amod:att _ _
3 elődök előd NOUN _ Case=Nom|Number=Plur|Number[psed]=None|Number[psor]=None|Person[psor]=None 11 nmod:att _ _
4 ( ( PUNCT _ _ 6 punct _ _
5 Sean Sean PROPN _ Case=Nom|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None 6 name _ _
6 Connery Connery PROPN _ Case=Nom|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None 3 appos _ _
7 , , PUNCT _ _ 6 punct _ _
8 Roger Roger PROPN _ Case=Nom|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None 9 name _ _
9 Moore Moore PROPN _ Case=Nom|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None 6 conj _ _
10 ) ) PUNCT _ _ 6 punct _ _
11 játékában játék NOUN _ Case=Ine|Number=Sing|Number[psed]=None|Number[psor]=Sing|Person[psor]=3 12 nmod:obl _ _
12 fellelhető fellelhető ADJ _ Case=Nom|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None|VerbForm=PartPres 13 amod:att _ _
13 irónia irónia NOUN _ Case=Nom|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None 18 nsubj _ _
14 Brosnannek Brosnan PROPN _ Case=Gen|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None 18 nmod:att _ _
15 ugyan ugyan ADV _ _ 18 advmod:mode _ _
16 nem nem ADV _ PronType=Neg 18 neg _ _
17 az az DET _ Definite=Def|PronType=Art 18 det _ _
18 erőssége erősség NOUN _ Case=Nom|Number=Sing|Number[psed]=None|Number[psor]=Sing|Person[psor]=3 0 root _ _
19 , , PUNCT _ _ 18 punct _ _
20 de de CONJ _ _ 18 cc _ _
21 hál hál NOUN _ Case=Nom|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None 23 nmod:att _ _
22 ' ' PUNCT _ _ 23 punct _ _
23 isten isten NOUN _ Case=Nom|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None 26 discourse _ _
24 nem nem ADV _ PronType=Neg 26 neg _ _
25 is is ADV _ _ 26 advmod:mode _ _
26 erőlteti erőltet VERB _ Definite=Def|Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin|Voice=Act 18 conj _ _
27 sem sem CONJ _ _ 28 cc _ _
28 ő ő PRON _ Case=Nom|Number=Sing|Number[psed]=None|Number[psor]=None|Person=3|Person[psor]=None|PronType=Prs 26 nsubj _ _
29 , , PUNCT _ _ 28 punct _ _
30 sem sem CONJ _ _ 28 cc _ _
31 a a DET _ Definite=Def|PronType=Art 32 det _ _
32 történet történet NOUN _ Case=Nom|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None 33 nmod:att _ _
33 kiagyalói kiagyalói ADJ _ Case=Nom|Degree=Pos|Number=Sing|Number[psed]=None|Number[psor]=None|Person[psor]=None 28 conj _ _
34 . . PUNCT _ _ 18 punct _ _
~~~
| Java |
/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
#include "hive_metastore_types.h"
#include <algorithm>
namespace Apache { namespace Hadoop { namespace Hive {
int _kHiveObjectTypeValues[] = {
HiveObjectType::GLOBAL,
HiveObjectType::DATABASE,
HiveObjectType::TABLE,
HiveObjectType::PARTITION,
HiveObjectType::COLUMN
};
const char* _kHiveObjectTypeNames[] = {
"GLOBAL",
"DATABASE",
"TABLE",
"PARTITION",
"COLUMN"
};
const std::map<int, const char*> _HiveObjectType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(5, _kHiveObjectTypeValues, _kHiveObjectTypeNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
int _kPrincipalTypeValues[] = {
PrincipalType::USER,
PrincipalType::ROLE,
PrincipalType::GROUP
};
const char* _kPrincipalTypeNames[] = {
"USER",
"ROLE",
"GROUP"
};
const std::map<int, const char*> _PrincipalType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(3, _kPrincipalTypeValues, _kPrincipalTypeNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
int _kPartitionEventTypeValues[] = {
PartitionEventType::LOAD_DONE
};
const char* _kPartitionEventTypeNames[] = {
"LOAD_DONE"
};
const std::map<int, const char*> _PartitionEventType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(1, _kPartitionEventTypeValues, _kPartitionEventTypeNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
int _kTxnStateValues[] = {
TxnState::COMMITTED,
TxnState::ABORTED,
TxnState::OPEN
};
const char* _kTxnStateNames[] = {
"COMMITTED",
"ABORTED",
"OPEN"
};
const std::map<int, const char*> _TxnState_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(3, _kTxnStateValues, _kTxnStateNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
int _kLockLevelValues[] = {
LockLevel::DB,
LockLevel::TABLE,
LockLevel::PARTITION
};
const char* _kLockLevelNames[] = {
"DB",
"TABLE",
"PARTITION"
};
const std::map<int, const char*> _LockLevel_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(3, _kLockLevelValues, _kLockLevelNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
int _kLockStateValues[] = {
LockState::ACQUIRED,
LockState::WAITING,
LockState::ABORT,
LockState::NOT_ACQUIRED
};
const char* _kLockStateNames[] = {
"ACQUIRED",
"WAITING",
"ABORT",
"NOT_ACQUIRED"
};
const std::map<int, const char*> _LockState_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(4, _kLockStateValues, _kLockStateNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
int _kLockTypeValues[] = {
LockType::SHARED_READ,
LockType::SHARED_WRITE,
LockType::EXCLUSIVE
};
const char* _kLockTypeNames[] = {
"SHARED_READ",
"SHARED_WRITE",
"EXCLUSIVE"
};
const std::map<int, const char*> _LockType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(3, _kLockTypeValues, _kLockTypeNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
int _kCompactionTypeValues[] = {
CompactionType::MINOR,
CompactionType::MAJOR
};
const char* _kCompactionTypeNames[] = {
"MINOR",
"MAJOR"
};
const std::map<int, const char*> _CompactionType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(2, _kCompactionTypeValues, _kCompactionTypeNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
int _kGrantRevokeTypeValues[] = {
GrantRevokeType::GRANT,
GrantRevokeType::REVOKE
};
const char* _kGrantRevokeTypeNames[] = {
"GRANT",
"REVOKE"
};
const std::map<int, const char*> _GrantRevokeType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(2, _kGrantRevokeTypeValues, _kGrantRevokeTypeNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
int _kEventRequestTypeValues[] = {
EventRequestType::INSERT,
EventRequestType::UPDATE,
EventRequestType::DELETE
};
const char* _kEventRequestTypeNames[] = {
"INSERT",
"UPDATE",
"DELETE"
};
const std::map<int, const char*> _EventRequestType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(3, _kEventRequestTypeValues, _kEventRequestTypeNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
int _kFunctionTypeValues[] = {
FunctionType::JAVA
};
const char* _kFunctionTypeNames[] = {
"JAVA"
};
const std::map<int, const char*> _FunctionType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(1, _kFunctionTypeValues, _kFunctionTypeNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
int _kResourceTypeValues[] = {
ResourceType::JAR,
ResourceType::FILE,
ResourceType::ARCHIVE
};
const char* _kResourceTypeNames[] = {
"JAR",
"FILE",
"ARCHIVE"
};
const std::map<int, const char*> _ResourceType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(3, _kResourceTypeValues, _kResourceTypeNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
const char* Version::ascii_fingerprint = "07A9615F837F7D0A952B595DD3020972";
const uint8_t Version::binary_fingerprint[16] = {0x07,0xA9,0x61,0x5F,0x83,0x7F,0x7D,0x0A,0x95,0x2B,0x59,0x5D,0xD3,0x02,0x09,0x72};
uint32_t Version::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->version);
this->__isset.version = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->comments);
this->__isset.comments = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t Version::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("Version");
xfer += oprot->writeFieldBegin("version", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->version);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("comments", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->comments);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(Version &a, Version &b) {
using ::std::swap;
swap(a.version, b.version);
swap(a.comments, b.comments);
swap(a.__isset, b.__isset);
}
const char* FieldSchema::ascii_fingerprint = "AB879940BD15B6B25691265F7384B271";
const uint8_t FieldSchema::binary_fingerprint[16] = {0xAB,0x87,0x99,0x40,0xBD,0x15,0xB6,0xB2,0x56,0x91,0x26,0x5F,0x73,0x84,0xB2,0x71};
uint32_t FieldSchema::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->name);
this->__isset.name = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->type);
this->__isset.type = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->comment);
this->__isset.comment = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t FieldSchema::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("FieldSchema");
xfer += oprot->writeFieldBegin("name", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->name);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("type", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->type);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("comment", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->comment);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(FieldSchema &a, FieldSchema &b) {
using ::std::swap;
swap(a.name, b.name);
swap(a.type, b.type);
swap(a.comment, b.comment);
swap(a.__isset, b.__isset);
}
const char* Type::ascii_fingerprint = "20DF02DE523C27F7066C7BD4D9120842";
const uint8_t Type::binary_fingerprint[16] = {0x20,0xDF,0x02,0xDE,0x52,0x3C,0x27,0xF7,0x06,0x6C,0x7B,0xD4,0xD9,0x12,0x08,0x42};
uint32_t Type::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->name);
this->__isset.name = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->type1);
this->__isset.type1 = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->type2);
this->__isset.type2 = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->fields.clear();
uint32_t _size0;
::apache::thrift::protocol::TType _etype3;
xfer += iprot->readListBegin(_etype3, _size0);
this->fields.resize(_size0);
uint32_t _i4;
for (_i4 = 0; _i4 < _size0; ++_i4)
{
xfer += this->fields[_i4].read(iprot);
}
xfer += iprot->readListEnd();
}
this->__isset.fields = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t Type::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("Type");
xfer += oprot->writeFieldBegin("name", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->name);
xfer += oprot->writeFieldEnd();
if (this->__isset.type1) {
xfer += oprot->writeFieldBegin("type1", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->type1);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.type2) {
xfer += oprot->writeFieldBegin("type2", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->type2);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.fields) {
xfer += oprot->writeFieldBegin("fields", ::apache::thrift::protocol::T_LIST, 4);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->fields.size()));
std::vector<FieldSchema> ::const_iterator _iter5;
for (_iter5 = this->fields.begin(); _iter5 != this->fields.end(); ++_iter5)
{
xfer += (*_iter5).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(Type &a, Type &b) {
using ::std::swap;
swap(a.name, b.name);
swap(a.type1, b.type1);
swap(a.type2, b.type2);
swap(a.fields, b.fields);
swap(a.__isset, b.__isset);
}
const char* HiveObjectRef::ascii_fingerprint = "205CD8311CF3AA9EC161BAEF8D7C933C";
const uint8_t HiveObjectRef::binary_fingerprint[16] = {0x20,0x5C,0xD8,0x31,0x1C,0xF3,0xAA,0x9E,0xC1,0x61,0xBA,0xEF,0x8D,0x7C,0x93,0x3C};
uint32_t HiveObjectRef::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast6;
xfer += iprot->readI32(ecast6);
this->objectType = (HiveObjectType::type)ecast6;
this->__isset.objectType = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->dbName);
this->__isset.dbName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->objectName);
this->__isset.objectName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->partValues.clear();
uint32_t _size7;
::apache::thrift::protocol::TType _etype10;
xfer += iprot->readListBegin(_etype10, _size7);
this->partValues.resize(_size7);
uint32_t _i11;
for (_i11 = 0; _i11 < _size7; ++_i11)
{
xfer += iprot->readString(this->partValues[_i11]);
}
xfer += iprot->readListEnd();
}
this->__isset.partValues = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->columnName);
this->__isset.columnName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t HiveObjectRef::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("HiveObjectRef");
xfer += oprot->writeFieldBegin("objectType", ::apache::thrift::protocol::T_I32, 1);
xfer += oprot->writeI32((int32_t)this->objectType);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("dbName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->dbName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("objectName", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->objectName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("partValues", ::apache::thrift::protocol::T_LIST, 4);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->partValues.size()));
std::vector<std::string> ::const_iterator _iter12;
for (_iter12 = this->partValues.begin(); _iter12 != this->partValues.end(); ++_iter12)
{
xfer += oprot->writeString((*_iter12));
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("columnName", ::apache::thrift::protocol::T_STRING, 5);
xfer += oprot->writeString(this->columnName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(HiveObjectRef &a, HiveObjectRef &b) {
using ::std::swap;
swap(a.objectType, b.objectType);
swap(a.dbName, b.dbName);
swap(a.objectName, b.objectName);
swap(a.partValues, b.partValues);
swap(a.columnName, b.columnName);
swap(a.__isset, b.__isset);
}
const char* PrivilegeGrantInfo::ascii_fingerprint = "A58923AF7294BE492D6F90E07E8CEE1F";
const uint8_t PrivilegeGrantInfo::binary_fingerprint[16] = {0xA5,0x89,0x23,0xAF,0x72,0x94,0xBE,0x49,0x2D,0x6F,0x90,0xE0,0x7E,0x8C,0xEE,0x1F};
uint32_t PrivilegeGrantInfo::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->privilege);
this->__isset.privilege = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->createTime);
this->__isset.createTime = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->grantor);
this->__isset.grantor = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast13;
xfer += iprot->readI32(ecast13);
this->grantorType = (PrincipalType::type)ecast13;
this->__isset.grantorType = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_BOOL) {
xfer += iprot->readBool(this->grantOption);
this->__isset.grantOption = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t PrivilegeGrantInfo::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("PrivilegeGrantInfo");
xfer += oprot->writeFieldBegin("privilege", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->privilege);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("createTime", ::apache::thrift::protocol::T_I32, 2);
xfer += oprot->writeI32(this->createTime);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("grantor", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->grantor);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("grantorType", ::apache::thrift::protocol::T_I32, 4);
xfer += oprot->writeI32((int32_t)this->grantorType);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("grantOption", ::apache::thrift::protocol::T_BOOL, 5);
xfer += oprot->writeBool(this->grantOption);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(PrivilegeGrantInfo &a, PrivilegeGrantInfo &b) {
using ::std::swap;
swap(a.privilege, b.privilege);
swap(a.createTime, b.createTime);
swap(a.grantor, b.grantor);
swap(a.grantorType, b.grantorType);
swap(a.grantOption, b.grantOption);
swap(a.__isset, b.__isset);
}
const char* HiveObjectPrivilege::ascii_fingerprint = "83D71969B23BD853E29DBA9D43B29AF8";
const uint8_t HiveObjectPrivilege::binary_fingerprint[16] = {0x83,0xD7,0x19,0x69,0xB2,0x3B,0xD8,0x53,0xE2,0x9D,0xBA,0x9D,0x43,0xB2,0x9A,0xF8};
uint32_t HiveObjectPrivilege::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->hiveObject.read(iprot);
this->__isset.hiveObject = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->principalName);
this->__isset.principalName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast14;
xfer += iprot->readI32(ecast14);
this->principalType = (PrincipalType::type)ecast14;
this->__isset.principalType = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->grantInfo.read(iprot);
this->__isset.grantInfo = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t HiveObjectPrivilege::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("HiveObjectPrivilege");
xfer += oprot->writeFieldBegin("hiveObject", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->hiveObject.write(oprot);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("principalName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->principalName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("principalType", ::apache::thrift::protocol::T_I32, 3);
xfer += oprot->writeI32((int32_t)this->principalType);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("grantInfo", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->grantInfo.write(oprot);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(HiveObjectPrivilege &a, HiveObjectPrivilege &b) {
using ::std::swap;
swap(a.hiveObject, b.hiveObject);
swap(a.principalName, b.principalName);
swap(a.principalType, b.principalType);
swap(a.grantInfo, b.grantInfo);
swap(a.__isset, b.__isset);
}
const char* PrivilegeBag::ascii_fingerprint = "BB89E4701B7B709B046A74C90B1147F2";
const uint8_t PrivilegeBag::binary_fingerprint[16] = {0xBB,0x89,0xE4,0x70,0x1B,0x7B,0x70,0x9B,0x04,0x6A,0x74,0xC9,0x0B,0x11,0x47,0xF2};
uint32_t PrivilegeBag::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->privileges.clear();
uint32_t _size15;
::apache::thrift::protocol::TType _etype18;
xfer += iprot->readListBegin(_etype18, _size15);
this->privileges.resize(_size15);
uint32_t _i19;
for (_i19 = 0; _i19 < _size15; ++_i19)
{
xfer += this->privileges[_i19].read(iprot);
}
xfer += iprot->readListEnd();
}
this->__isset.privileges = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t PrivilegeBag::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("PrivilegeBag");
xfer += oprot->writeFieldBegin("privileges", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->privileges.size()));
std::vector<HiveObjectPrivilege> ::const_iterator _iter20;
for (_iter20 = this->privileges.begin(); _iter20 != this->privileges.end(); ++_iter20)
{
xfer += (*_iter20).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(PrivilegeBag &a, PrivilegeBag &b) {
using ::std::swap;
swap(a.privileges, b.privileges);
swap(a.__isset, b.__isset);
}
const char* PrincipalPrivilegeSet::ascii_fingerprint = "08F75D2533906EA87BE34EA640856683";
const uint8_t PrincipalPrivilegeSet::binary_fingerprint[16] = {0x08,0xF7,0x5D,0x25,0x33,0x90,0x6E,0xA8,0x7B,0xE3,0x4E,0xA6,0x40,0x85,0x66,0x83};
uint32_t PrincipalPrivilegeSet::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_MAP) {
{
this->userPrivileges.clear();
uint32_t _size21;
::apache::thrift::protocol::TType _ktype22;
::apache::thrift::protocol::TType _vtype23;
xfer += iprot->readMapBegin(_ktype22, _vtype23, _size21);
uint32_t _i25;
for (_i25 = 0; _i25 < _size21; ++_i25)
{
std::string _key26;
xfer += iprot->readString(_key26);
std::vector<PrivilegeGrantInfo> & _val27 = this->userPrivileges[_key26];
{
_val27.clear();
uint32_t _size28;
::apache::thrift::protocol::TType _etype31;
xfer += iprot->readListBegin(_etype31, _size28);
_val27.resize(_size28);
uint32_t _i32;
for (_i32 = 0; _i32 < _size28; ++_i32)
{
xfer += _val27[_i32].read(iprot);
}
xfer += iprot->readListEnd();
}
}
xfer += iprot->readMapEnd();
}
this->__isset.userPrivileges = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_MAP) {
{
this->groupPrivileges.clear();
uint32_t _size33;
::apache::thrift::protocol::TType _ktype34;
::apache::thrift::protocol::TType _vtype35;
xfer += iprot->readMapBegin(_ktype34, _vtype35, _size33);
uint32_t _i37;
for (_i37 = 0; _i37 < _size33; ++_i37)
{
std::string _key38;
xfer += iprot->readString(_key38);
std::vector<PrivilegeGrantInfo> & _val39 = this->groupPrivileges[_key38];
{
_val39.clear();
uint32_t _size40;
::apache::thrift::protocol::TType _etype43;
xfer += iprot->readListBegin(_etype43, _size40);
_val39.resize(_size40);
uint32_t _i44;
for (_i44 = 0; _i44 < _size40; ++_i44)
{
xfer += _val39[_i44].read(iprot);
}
xfer += iprot->readListEnd();
}
}
xfer += iprot->readMapEnd();
}
this->__isset.groupPrivileges = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_MAP) {
{
this->rolePrivileges.clear();
uint32_t _size45;
::apache::thrift::protocol::TType _ktype46;
::apache::thrift::protocol::TType _vtype47;
xfer += iprot->readMapBegin(_ktype46, _vtype47, _size45);
uint32_t _i49;
for (_i49 = 0; _i49 < _size45; ++_i49)
{
std::string _key50;
xfer += iprot->readString(_key50);
std::vector<PrivilegeGrantInfo> & _val51 = this->rolePrivileges[_key50];
{
_val51.clear();
uint32_t _size52;
::apache::thrift::protocol::TType _etype55;
xfer += iprot->readListBegin(_etype55, _size52);
_val51.resize(_size52);
uint32_t _i56;
for (_i56 = 0; _i56 < _size52; ++_i56)
{
xfer += _val51[_i56].read(iprot);
}
xfer += iprot->readListEnd();
}
}
xfer += iprot->readMapEnd();
}
this->__isset.rolePrivileges = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t PrincipalPrivilegeSet::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("PrincipalPrivilegeSet");
xfer += oprot->writeFieldBegin("userPrivileges", ::apache::thrift::protocol::T_MAP, 1);
{
xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_LIST, static_cast<uint32_t>(this->userPrivileges.size()));
std::map<std::string, std::vector<PrivilegeGrantInfo> > ::const_iterator _iter57;
for (_iter57 = this->userPrivileges.begin(); _iter57 != this->userPrivileges.end(); ++_iter57)
{
xfer += oprot->writeString(_iter57->first);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(_iter57->second.size()));
std::vector<PrivilegeGrantInfo> ::const_iterator _iter58;
for (_iter58 = _iter57->second.begin(); _iter58 != _iter57->second.end(); ++_iter58)
{
xfer += (*_iter58).write(oprot);
}
xfer += oprot->writeListEnd();
}
}
xfer += oprot->writeMapEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("groupPrivileges", ::apache::thrift::protocol::T_MAP, 2);
{
xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_LIST, static_cast<uint32_t>(this->groupPrivileges.size()));
std::map<std::string, std::vector<PrivilegeGrantInfo> > ::const_iterator _iter59;
for (_iter59 = this->groupPrivileges.begin(); _iter59 != this->groupPrivileges.end(); ++_iter59)
{
xfer += oprot->writeString(_iter59->first);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(_iter59->second.size()));
std::vector<PrivilegeGrantInfo> ::const_iterator _iter60;
for (_iter60 = _iter59->second.begin(); _iter60 != _iter59->second.end(); ++_iter60)
{
xfer += (*_iter60).write(oprot);
}
xfer += oprot->writeListEnd();
}
}
xfer += oprot->writeMapEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("rolePrivileges", ::apache::thrift::protocol::T_MAP, 3);
{
xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_LIST, static_cast<uint32_t>(this->rolePrivileges.size()));
std::map<std::string, std::vector<PrivilegeGrantInfo> > ::const_iterator _iter61;
for (_iter61 = this->rolePrivileges.begin(); _iter61 != this->rolePrivileges.end(); ++_iter61)
{
xfer += oprot->writeString(_iter61->first);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(_iter61->second.size()));
std::vector<PrivilegeGrantInfo> ::const_iterator _iter62;
for (_iter62 = _iter61->second.begin(); _iter62 != _iter61->second.end(); ++_iter62)
{
xfer += (*_iter62).write(oprot);
}
xfer += oprot->writeListEnd();
}
}
xfer += oprot->writeMapEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(PrincipalPrivilegeSet &a, PrincipalPrivilegeSet &b) {
using ::std::swap;
swap(a.userPrivileges, b.userPrivileges);
swap(a.groupPrivileges, b.groupPrivileges);
swap(a.rolePrivileges, b.rolePrivileges);
swap(a.__isset, b.__isset);
}
const char* GrantRevokePrivilegeRequest::ascii_fingerprint = "DF474A3CB526AD40DC0F2C3702F7AA2C";
const uint8_t GrantRevokePrivilegeRequest::binary_fingerprint[16] = {0xDF,0x47,0x4A,0x3C,0xB5,0x26,0xAD,0x40,0xDC,0x0F,0x2C,0x37,0x02,0xF7,0xAA,0x2C};
uint32_t GrantRevokePrivilegeRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast63;
xfer += iprot->readI32(ecast63);
this->requestType = (GrantRevokeType::type)ecast63;
this->__isset.requestType = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->privileges.read(iprot);
this->__isset.privileges = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_BOOL) {
xfer += iprot->readBool(this->revokeGrantOption);
this->__isset.revokeGrantOption = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t GrantRevokePrivilegeRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("GrantRevokePrivilegeRequest");
xfer += oprot->writeFieldBegin("requestType", ::apache::thrift::protocol::T_I32, 1);
xfer += oprot->writeI32((int32_t)this->requestType);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("privileges", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->privileges.write(oprot);
xfer += oprot->writeFieldEnd();
if (this->__isset.revokeGrantOption) {
xfer += oprot->writeFieldBegin("revokeGrantOption", ::apache::thrift::protocol::T_BOOL, 3);
xfer += oprot->writeBool(this->revokeGrantOption);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(GrantRevokePrivilegeRequest &a, GrantRevokePrivilegeRequest &b) {
using ::std::swap;
swap(a.requestType, b.requestType);
swap(a.privileges, b.privileges);
swap(a.revokeGrantOption, b.revokeGrantOption);
swap(a.__isset, b.__isset);
}
const char* GrantRevokePrivilegeResponse::ascii_fingerprint = "BF054652DEF86253C2BEE7D947F167DD";
const uint8_t GrantRevokePrivilegeResponse::binary_fingerprint[16] = {0xBF,0x05,0x46,0x52,0xDE,0xF8,0x62,0x53,0xC2,0xBE,0xE7,0xD9,0x47,0xF1,0x67,0xDD};
uint32_t GrantRevokePrivilegeResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_BOOL) {
xfer += iprot->readBool(this->success);
this->__isset.success = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t GrantRevokePrivilegeResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("GrantRevokePrivilegeResponse");
if (this->__isset.success) {
xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_BOOL, 1);
xfer += oprot->writeBool(this->success);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(GrantRevokePrivilegeResponse &a, GrantRevokePrivilegeResponse &b) {
using ::std::swap;
swap(a.success, b.success);
swap(a.__isset, b.__isset);
}
const char* Role::ascii_fingerprint = "70563A0628F75DF9555F4D24690B1E26";
const uint8_t Role::binary_fingerprint[16] = {0x70,0x56,0x3A,0x06,0x28,0xF7,0x5D,0xF9,0x55,0x5F,0x4D,0x24,0x69,0x0B,0x1E,0x26};
uint32_t Role::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->roleName);
this->__isset.roleName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->createTime);
this->__isset.createTime = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->ownerName);
this->__isset.ownerName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t Role::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("Role");
xfer += oprot->writeFieldBegin("roleName", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->roleName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("createTime", ::apache::thrift::protocol::T_I32, 2);
xfer += oprot->writeI32(this->createTime);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("ownerName", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->ownerName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(Role &a, Role &b) {
using ::std::swap;
swap(a.roleName, b.roleName);
swap(a.createTime, b.createTime);
swap(a.ownerName, b.ownerName);
swap(a.__isset, b.__isset);
}
const char* RolePrincipalGrant::ascii_fingerprint = "899BA3F6214DD1B79D27206BA857C772";
const uint8_t RolePrincipalGrant::binary_fingerprint[16] = {0x89,0x9B,0xA3,0xF6,0x21,0x4D,0xD1,0xB7,0x9D,0x27,0x20,0x6B,0xA8,0x57,0xC7,0x72};
uint32_t RolePrincipalGrant::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->roleName);
this->__isset.roleName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->principalName);
this->__isset.principalName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast64;
xfer += iprot->readI32(ecast64);
this->principalType = (PrincipalType::type)ecast64;
this->__isset.principalType = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_BOOL) {
xfer += iprot->readBool(this->grantOption);
this->__isset.grantOption = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->grantTime);
this->__isset.grantTime = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->grantorName);
this->__isset.grantorName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast65;
xfer += iprot->readI32(ecast65);
this->grantorPrincipalType = (PrincipalType::type)ecast65;
this->__isset.grantorPrincipalType = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t RolePrincipalGrant::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("RolePrincipalGrant");
xfer += oprot->writeFieldBegin("roleName", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->roleName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("principalName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->principalName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("principalType", ::apache::thrift::protocol::T_I32, 3);
xfer += oprot->writeI32((int32_t)this->principalType);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("grantOption", ::apache::thrift::protocol::T_BOOL, 4);
xfer += oprot->writeBool(this->grantOption);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("grantTime", ::apache::thrift::protocol::T_I32, 5);
xfer += oprot->writeI32(this->grantTime);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("grantorName", ::apache::thrift::protocol::T_STRING, 6);
xfer += oprot->writeString(this->grantorName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("grantorPrincipalType", ::apache::thrift::protocol::T_I32, 7);
xfer += oprot->writeI32((int32_t)this->grantorPrincipalType);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(RolePrincipalGrant &a, RolePrincipalGrant &b) {
using ::std::swap;
swap(a.roleName, b.roleName);
swap(a.principalName, b.principalName);
swap(a.principalType, b.principalType);
swap(a.grantOption, b.grantOption);
swap(a.grantTime, b.grantTime);
swap(a.grantorName, b.grantorName);
swap(a.grantorPrincipalType, b.grantorPrincipalType);
swap(a.__isset, b.__isset);
}
const char* GetRoleGrantsForPrincipalRequest::ascii_fingerprint = "D6FD826D949221396F4FFC3ECCD3D192";
const uint8_t GetRoleGrantsForPrincipalRequest::binary_fingerprint[16] = {0xD6,0xFD,0x82,0x6D,0x94,0x92,0x21,0x39,0x6F,0x4F,0xFC,0x3E,0xCC,0xD3,0xD1,0x92};
uint32_t GetRoleGrantsForPrincipalRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_principal_name = false;
bool isset_principal_type = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->principal_name);
isset_principal_name = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast66;
xfer += iprot->readI32(ecast66);
this->principal_type = (PrincipalType::type)ecast66;
isset_principal_type = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_principal_name)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_principal_type)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t GetRoleGrantsForPrincipalRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("GetRoleGrantsForPrincipalRequest");
xfer += oprot->writeFieldBegin("principal_name", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->principal_name);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("principal_type", ::apache::thrift::protocol::T_I32, 2);
xfer += oprot->writeI32((int32_t)this->principal_type);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(GetRoleGrantsForPrincipalRequest &a, GetRoleGrantsForPrincipalRequest &b) {
using ::std::swap;
swap(a.principal_name, b.principal_name);
swap(a.principal_type, b.principal_type);
}
const char* GetRoleGrantsForPrincipalResponse::ascii_fingerprint = "5926B4B3541A62E17663820C7E3BE690";
const uint8_t GetRoleGrantsForPrincipalResponse::binary_fingerprint[16] = {0x59,0x26,0xB4,0xB3,0x54,0x1A,0x62,0xE1,0x76,0x63,0x82,0x0C,0x7E,0x3B,0xE6,0x90};
uint32_t GetRoleGrantsForPrincipalResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_principalGrants = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->principalGrants.clear();
uint32_t _size67;
::apache::thrift::protocol::TType _etype70;
xfer += iprot->readListBegin(_etype70, _size67);
this->principalGrants.resize(_size67);
uint32_t _i71;
for (_i71 = 0; _i71 < _size67; ++_i71)
{
xfer += this->principalGrants[_i71].read(iprot);
}
xfer += iprot->readListEnd();
}
isset_principalGrants = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_principalGrants)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t GetRoleGrantsForPrincipalResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("GetRoleGrantsForPrincipalResponse");
xfer += oprot->writeFieldBegin("principalGrants", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->principalGrants.size()));
std::vector<RolePrincipalGrant> ::const_iterator _iter72;
for (_iter72 = this->principalGrants.begin(); _iter72 != this->principalGrants.end(); ++_iter72)
{
xfer += (*_iter72).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(GetRoleGrantsForPrincipalResponse &a, GetRoleGrantsForPrincipalResponse &b) {
using ::std::swap;
swap(a.principalGrants, b.principalGrants);
}
const char* GetPrincipalsInRoleRequest::ascii_fingerprint = "EFB929595D312AC8F305D5A794CFEDA1";
const uint8_t GetPrincipalsInRoleRequest::binary_fingerprint[16] = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
uint32_t GetPrincipalsInRoleRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_roleName = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->roleName);
isset_roleName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_roleName)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t GetPrincipalsInRoleRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("GetPrincipalsInRoleRequest");
xfer += oprot->writeFieldBegin("roleName", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->roleName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(GetPrincipalsInRoleRequest &a, GetPrincipalsInRoleRequest &b) {
using ::std::swap;
swap(a.roleName, b.roleName);
}
const char* GetPrincipalsInRoleResponse::ascii_fingerprint = "5926B4B3541A62E17663820C7E3BE690";
const uint8_t GetPrincipalsInRoleResponse::binary_fingerprint[16] = {0x59,0x26,0xB4,0xB3,0x54,0x1A,0x62,0xE1,0x76,0x63,0x82,0x0C,0x7E,0x3B,0xE6,0x90};
uint32_t GetPrincipalsInRoleResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_principalGrants = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->principalGrants.clear();
uint32_t _size73;
::apache::thrift::protocol::TType _etype76;
xfer += iprot->readListBegin(_etype76, _size73);
this->principalGrants.resize(_size73);
uint32_t _i77;
for (_i77 = 0; _i77 < _size73; ++_i77)
{
xfer += this->principalGrants[_i77].read(iprot);
}
xfer += iprot->readListEnd();
}
isset_principalGrants = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_principalGrants)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t GetPrincipalsInRoleResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("GetPrincipalsInRoleResponse");
xfer += oprot->writeFieldBegin("principalGrants", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->principalGrants.size()));
std::vector<RolePrincipalGrant> ::const_iterator _iter78;
for (_iter78 = this->principalGrants.begin(); _iter78 != this->principalGrants.end(); ++_iter78)
{
xfer += (*_iter78).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(GetPrincipalsInRoleResponse &a, GetPrincipalsInRoleResponse &b) {
using ::std::swap;
swap(a.principalGrants, b.principalGrants);
}
const char* GrantRevokeRoleRequest::ascii_fingerprint = "907DEA796F2BA7AF76DC2566E75FAEE7";
const uint8_t GrantRevokeRoleRequest::binary_fingerprint[16] = {0x90,0x7D,0xEA,0x79,0x6F,0x2B,0xA7,0xAF,0x76,0xDC,0x25,0x66,0xE7,0x5F,0xAE,0xE7};
uint32_t GrantRevokeRoleRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast79;
xfer += iprot->readI32(ecast79);
this->requestType = (GrantRevokeType::type)ecast79;
this->__isset.requestType = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->roleName);
this->__isset.roleName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->principalName);
this->__isset.principalName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast80;
xfer += iprot->readI32(ecast80);
this->principalType = (PrincipalType::type)ecast80;
this->__isset.principalType = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->grantor);
this->__isset.grantor = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast81;
xfer += iprot->readI32(ecast81);
this->grantorType = (PrincipalType::type)ecast81;
this->__isset.grantorType = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_BOOL) {
xfer += iprot->readBool(this->grantOption);
this->__isset.grantOption = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t GrantRevokeRoleRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("GrantRevokeRoleRequest");
xfer += oprot->writeFieldBegin("requestType", ::apache::thrift::protocol::T_I32, 1);
xfer += oprot->writeI32((int32_t)this->requestType);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("roleName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->roleName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("principalName", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->principalName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("principalType", ::apache::thrift::protocol::T_I32, 4);
xfer += oprot->writeI32((int32_t)this->principalType);
xfer += oprot->writeFieldEnd();
if (this->__isset.grantor) {
xfer += oprot->writeFieldBegin("grantor", ::apache::thrift::protocol::T_STRING, 5);
xfer += oprot->writeString(this->grantor);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.grantorType) {
xfer += oprot->writeFieldBegin("grantorType", ::apache::thrift::protocol::T_I32, 6);
xfer += oprot->writeI32((int32_t)this->grantorType);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.grantOption) {
xfer += oprot->writeFieldBegin("grantOption", ::apache::thrift::protocol::T_BOOL, 7);
xfer += oprot->writeBool(this->grantOption);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(GrantRevokeRoleRequest &a, GrantRevokeRoleRequest &b) {
using ::std::swap;
swap(a.requestType, b.requestType);
swap(a.roleName, b.roleName);
swap(a.principalName, b.principalName);
swap(a.principalType, b.principalType);
swap(a.grantor, b.grantor);
swap(a.grantorType, b.grantorType);
swap(a.grantOption, b.grantOption);
swap(a.__isset, b.__isset);
}
const char* GrantRevokeRoleResponse::ascii_fingerprint = "BF054652DEF86253C2BEE7D947F167DD";
const uint8_t GrantRevokeRoleResponse::binary_fingerprint[16] = {0xBF,0x05,0x46,0x52,0xDE,0xF8,0x62,0x53,0xC2,0xBE,0xE7,0xD9,0x47,0xF1,0x67,0xDD};
uint32_t GrantRevokeRoleResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_BOOL) {
xfer += iprot->readBool(this->success);
this->__isset.success = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t GrantRevokeRoleResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("GrantRevokeRoleResponse");
if (this->__isset.success) {
xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_BOOL, 1);
xfer += oprot->writeBool(this->success);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(GrantRevokeRoleResponse &a, GrantRevokeRoleResponse &b) {
using ::std::swap;
swap(a.success, b.success);
swap(a.__isset, b.__isset);
}
const char* Database::ascii_fingerprint = "553495CAE243A1C583D5C3DD990AED53";
const uint8_t Database::binary_fingerprint[16] = {0x55,0x34,0x95,0xCA,0xE2,0x43,0xA1,0xC5,0x83,0xD5,0xC3,0xDD,0x99,0x0A,0xED,0x53};
uint32_t Database::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->name);
this->__isset.name = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->description);
this->__isset.description = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->locationUri);
this->__isset.locationUri = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_MAP) {
{
this->parameters.clear();
uint32_t _size82;
::apache::thrift::protocol::TType _ktype83;
::apache::thrift::protocol::TType _vtype84;
xfer += iprot->readMapBegin(_ktype83, _vtype84, _size82);
uint32_t _i86;
for (_i86 = 0; _i86 < _size82; ++_i86)
{
std::string _key87;
xfer += iprot->readString(_key87);
std::string& _val88 = this->parameters[_key87];
xfer += iprot->readString(_val88);
}
xfer += iprot->readMapEnd();
}
this->__isset.parameters = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->privileges.read(iprot);
this->__isset.privileges = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->ownerName);
this->__isset.ownerName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast89;
xfer += iprot->readI32(ecast89);
this->ownerType = (PrincipalType::type)ecast89;
this->__isset.ownerType = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t Database::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("Database");
xfer += oprot->writeFieldBegin("name", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->name);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("description", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->description);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("locationUri", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->locationUri);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("parameters", ::apache::thrift::protocol::T_MAP, 4);
{
xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->parameters.size()));
std::map<std::string, std::string> ::const_iterator _iter90;
for (_iter90 = this->parameters.begin(); _iter90 != this->parameters.end(); ++_iter90)
{
xfer += oprot->writeString(_iter90->first);
xfer += oprot->writeString(_iter90->second);
}
xfer += oprot->writeMapEnd();
}
xfer += oprot->writeFieldEnd();
if (this->__isset.privileges) {
xfer += oprot->writeFieldBegin("privileges", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += this->privileges.write(oprot);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.ownerName) {
xfer += oprot->writeFieldBegin("ownerName", ::apache::thrift::protocol::T_STRING, 6);
xfer += oprot->writeString(this->ownerName);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.ownerType) {
xfer += oprot->writeFieldBegin("ownerType", ::apache::thrift::protocol::T_I32, 7);
xfer += oprot->writeI32((int32_t)this->ownerType);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(Database &a, Database &b) {
using ::std::swap;
swap(a.name, b.name);
swap(a.description, b.description);
swap(a.locationUri, b.locationUri);
swap(a.parameters, b.parameters);
swap(a.privileges, b.privileges);
swap(a.ownerName, b.ownerName);
swap(a.ownerType, b.ownerType);
swap(a.__isset, b.__isset);
}
const char* SerDeInfo::ascii_fingerprint = "B1021C32A35A2AEFCD2F57A5424159A7";
const uint8_t SerDeInfo::binary_fingerprint[16] = {0xB1,0x02,0x1C,0x32,0xA3,0x5A,0x2A,0xEF,0xCD,0x2F,0x57,0xA5,0x42,0x41,0x59,0xA7};
uint32_t SerDeInfo::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->name);
this->__isset.name = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->serializationLib);
this->__isset.serializationLib = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_MAP) {
{
this->parameters.clear();
uint32_t _size91;
::apache::thrift::protocol::TType _ktype92;
::apache::thrift::protocol::TType _vtype93;
xfer += iprot->readMapBegin(_ktype92, _vtype93, _size91);
uint32_t _i95;
for (_i95 = 0; _i95 < _size91; ++_i95)
{
std::string _key96;
xfer += iprot->readString(_key96);
std::string& _val97 = this->parameters[_key96];
xfer += iprot->readString(_val97);
}
xfer += iprot->readMapEnd();
}
this->__isset.parameters = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t SerDeInfo::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("SerDeInfo");
xfer += oprot->writeFieldBegin("name", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->name);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("serializationLib", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->serializationLib);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("parameters", ::apache::thrift::protocol::T_MAP, 3);
{
xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->parameters.size()));
std::map<std::string, std::string> ::const_iterator _iter98;
for (_iter98 = this->parameters.begin(); _iter98 != this->parameters.end(); ++_iter98)
{
xfer += oprot->writeString(_iter98->first);
xfer += oprot->writeString(_iter98->second);
}
xfer += oprot->writeMapEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(SerDeInfo &a, SerDeInfo &b) {
using ::std::swap;
swap(a.name, b.name);
swap(a.serializationLib, b.serializationLib);
swap(a.parameters, b.parameters);
swap(a.__isset, b.__isset);
}
const char* Order::ascii_fingerprint = "EEBC915CE44901401D881E6091423036";
const uint8_t Order::binary_fingerprint[16] = {0xEE,0xBC,0x91,0x5C,0xE4,0x49,0x01,0x40,0x1D,0x88,0x1E,0x60,0x91,0x42,0x30,0x36};
uint32_t Order::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->col);
this->__isset.col = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->order);
this->__isset.order = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t Order::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("Order");
xfer += oprot->writeFieldBegin("col", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->col);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("order", ::apache::thrift::protocol::T_I32, 2);
xfer += oprot->writeI32(this->order);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(Order &a, Order &b) {
using ::std::swap;
swap(a.col, b.col);
swap(a.order, b.order);
swap(a.__isset, b.__isset);
}
const char* SkewedInfo::ascii_fingerprint = "4BF2ED84BC3C3EB297A2AE2FA8427EB1";
const uint8_t SkewedInfo::binary_fingerprint[16] = {0x4B,0xF2,0xED,0x84,0xBC,0x3C,0x3E,0xB2,0x97,0xA2,0xAE,0x2F,0xA8,0x42,0x7E,0xB1};
uint32_t SkewedInfo::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->skewedColNames.clear();
uint32_t _size99;
::apache::thrift::protocol::TType _etype102;
xfer += iprot->readListBegin(_etype102, _size99);
this->skewedColNames.resize(_size99);
uint32_t _i103;
for (_i103 = 0; _i103 < _size99; ++_i103)
{
xfer += iprot->readString(this->skewedColNames[_i103]);
}
xfer += iprot->readListEnd();
}
this->__isset.skewedColNames = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->skewedColValues.clear();
uint32_t _size104;
::apache::thrift::protocol::TType _etype107;
xfer += iprot->readListBegin(_etype107, _size104);
this->skewedColValues.resize(_size104);
uint32_t _i108;
for (_i108 = 0; _i108 < _size104; ++_i108)
{
{
this->skewedColValues[_i108].clear();
uint32_t _size109;
::apache::thrift::protocol::TType _etype112;
xfer += iprot->readListBegin(_etype112, _size109);
this->skewedColValues[_i108].resize(_size109);
uint32_t _i113;
for (_i113 = 0; _i113 < _size109; ++_i113)
{
xfer += iprot->readString(this->skewedColValues[_i108][_i113]);
}
xfer += iprot->readListEnd();
}
}
xfer += iprot->readListEnd();
}
this->__isset.skewedColValues = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_MAP) {
{
this->skewedColValueLocationMaps.clear();
uint32_t _size114;
::apache::thrift::protocol::TType _ktype115;
::apache::thrift::protocol::TType _vtype116;
xfer += iprot->readMapBegin(_ktype115, _vtype116, _size114);
uint32_t _i118;
for (_i118 = 0; _i118 < _size114; ++_i118)
{
std::vector<std::string> _key119;
{
_key119.clear();
uint32_t _size121;
::apache::thrift::protocol::TType _etype124;
xfer += iprot->readListBegin(_etype124, _size121);
_key119.resize(_size121);
uint32_t _i125;
for (_i125 = 0; _i125 < _size121; ++_i125)
{
xfer += iprot->readString(_key119[_i125]);
}
xfer += iprot->readListEnd();
}
std::string& _val120 = this->skewedColValueLocationMaps[_key119];
xfer += iprot->readString(_val120);
}
xfer += iprot->readMapEnd();
}
this->__isset.skewedColValueLocationMaps = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t SkewedInfo::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("SkewedInfo");
xfer += oprot->writeFieldBegin("skewedColNames", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->skewedColNames.size()));
std::vector<std::string> ::const_iterator _iter126;
for (_iter126 = this->skewedColNames.begin(); _iter126 != this->skewedColNames.end(); ++_iter126)
{
xfer += oprot->writeString((*_iter126));
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("skewedColValues", ::apache::thrift::protocol::T_LIST, 2);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_LIST, static_cast<uint32_t>(this->skewedColValues.size()));
std::vector<std::vector<std::string> > ::const_iterator _iter127;
for (_iter127 = this->skewedColValues.begin(); _iter127 != this->skewedColValues.end(); ++_iter127)
{
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>((*_iter127).size()));
std::vector<std::string> ::const_iterator _iter128;
for (_iter128 = (*_iter127).begin(); _iter128 != (*_iter127).end(); ++_iter128)
{
xfer += oprot->writeString((*_iter128));
}
xfer += oprot->writeListEnd();
}
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("skewedColValueLocationMaps", ::apache::thrift::protocol::T_MAP, 3);
{
xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_LIST, ::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->skewedColValueLocationMaps.size()));
std::map<std::vector<std::string> , std::string> ::const_iterator _iter129;
for (_iter129 = this->skewedColValueLocationMaps.begin(); _iter129 != this->skewedColValueLocationMaps.end(); ++_iter129)
{
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(_iter129->first.size()));
std::vector<std::string> ::const_iterator _iter130;
for (_iter130 = _iter129->first.begin(); _iter130 != _iter129->first.end(); ++_iter130)
{
xfer += oprot->writeString((*_iter130));
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeString(_iter129->second);
}
xfer += oprot->writeMapEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(SkewedInfo &a, SkewedInfo &b) {
using ::std::swap;
swap(a.skewedColNames, b.skewedColNames);
swap(a.skewedColValues, b.skewedColValues);
swap(a.skewedColValueLocationMaps, b.skewedColValueLocationMaps);
swap(a.__isset, b.__isset);
}
const char* StorageDescriptor::ascii_fingerprint = "CA8C9AA5FE4C32643757D8639CEF0CD7";
const uint8_t StorageDescriptor::binary_fingerprint[16] = {0xCA,0x8C,0x9A,0xA5,0xFE,0x4C,0x32,0x64,0x37,0x57,0xD8,0x63,0x9C,0xEF,0x0C,0xD7};
uint32_t StorageDescriptor::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->cols.clear();
uint32_t _size131;
::apache::thrift::protocol::TType _etype134;
xfer += iprot->readListBegin(_etype134, _size131);
this->cols.resize(_size131);
uint32_t _i135;
for (_i135 = 0; _i135 < _size131; ++_i135)
{
xfer += this->cols[_i135].read(iprot);
}
xfer += iprot->readListEnd();
}
this->__isset.cols = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->location);
this->__isset.location = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->inputFormat);
this->__isset.inputFormat = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->outputFormat);
this->__isset.outputFormat = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_BOOL) {
xfer += iprot->readBool(this->compressed);
this->__isset.compressed = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->numBuckets);
this->__isset.numBuckets = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->serdeInfo.read(iprot);
this->__isset.serdeInfo = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 8:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->bucketCols.clear();
uint32_t _size136;
::apache::thrift::protocol::TType _etype139;
xfer += iprot->readListBegin(_etype139, _size136);
this->bucketCols.resize(_size136);
uint32_t _i140;
for (_i140 = 0; _i140 < _size136; ++_i140)
{
xfer += iprot->readString(this->bucketCols[_i140]);
}
xfer += iprot->readListEnd();
}
this->__isset.bucketCols = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 9:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->sortCols.clear();
uint32_t _size141;
::apache::thrift::protocol::TType _etype144;
xfer += iprot->readListBegin(_etype144, _size141);
this->sortCols.resize(_size141);
uint32_t _i145;
for (_i145 = 0; _i145 < _size141; ++_i145)
{
xfer += this->sortCols[_i145].read(iprot);
}
xfer += iprot->readListEnd();
}
this->__isset.sortCols = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 10:
if (ftype == ::apache::thrift::protocol::T_MAP) {
{
this->parameters.clear();
uint32_t _size146;
::apache::thrift::protocol::TType _ktype147;
::apache::thrift::protocol::TType _vtype148;
xfer += iprot->readMapBegin(_ktype147, _vtype148, _size146);
uint32_t _i150;
for (_i150 = 0; _i150 < _size146; ++_i150)
{
std::string _key151;
xfer += iprot->readString(_key151);
std::string& _val152 = this->parameters[_key151];
xfer += iprot->readString(_val152);
}
xfer += iprot->readMapEnd();
}
this->__isset.parameters = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 11:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->skewedInfo.read(iprot);
this->__isset.skewedInfo = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 12:
if (ftype == ::apache::thrift::protocol::T_BOOL) {
xfer += iprot->readBool(this->storedAsSubDirectories);
this->__isset.storedAsSubDirectories = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t StorageDescriptor::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("StorageDescriptor");
xfer += oprot->writeFieldBegin("cols", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->cols.size()));
std::vector<FieldSchema> ::const_iterator _iter153;
for (_iter153 = this->cols.begin(); _iter153 != this->cols.end(); ++_iter153)
{
xfer += (*_iter153).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("location", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->location);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("inputFormat", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->inputFormat);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("outputFormat", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString(this->outputFormat);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("compressed", ::apache::thrift::protocol::T_BOOL, 5);
xfer += oprot->writeBool(this->compressed);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("numBuckets", ::apache::thrift::protocol::T_I32, 6);
xfer += oprot->writeI32(this->numBuckets);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("serdeInfo", ::apache::thrift::protocol::T_STRUCT, 7);
xfer += this->serdeInfo.write(oprot);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("bucketCols", ::apache::thrift::protocol::T_LIST, 8);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->bucketCols.size()));
std::vector<std::string> ::const_iterator _iter154;
for (_iter154 = this->bucketCols.begin(); _iter154 != this->bucketCols.end(); ++_iter154)
{
xfer += oprot->writeString((*_iter154));
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("sortCols", ::apache::thrift::protocol::T_LIST, 9);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->sortCols.size()));
std::vector<Order> ::const_iterator _iter155;
for (_iter155 = this->sortCols.begin(); _iter155 != this->sortCols.end(); ++_iter155)
{
xfer += (*_iter155).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("parameters", ::apache::thrift::protocol::T_MAP, 10);
{
xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->parameters.size()));
std::map<std::string, std::string> ::const_iterator _iter156;
for (_iter156 = this->parameters.begin(); _iter156 != this->parameters.end(); ++_iter156)
{
xfer += oprot->writeString(_iter156->first);
xfer += oprot->writeString(_iter156->second);
}
xfer += oprot->writeMapEnd();
}
xfer += oprot->writeFieldEnd();
if (this->__isset.skewedInfo) {
xfer += oprot->writeFieldBegin("skewedInfo", ::apache::thrift::protocol::T_STRUCT, 11);
xfer += this->skewedInfo.write(oprot);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.storedAsSubDirectories) {
xfer += oprot->writeFieldBegin("storedAsSubDirectories", ::apache::thrift::protocol::T_BOOL, 12);
xfer += oprot->writeBool(this->storedAsSubDirectories);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(StorageDescriptor &a, StorageDescriptor &b) {
using ::std::swap;
swap(a.cols, b.cols);
swap(a.location, b.location);
swap(a.inputFormat, b.inputFormat);
swap(a.outputFormat, b.outputFormat);
swap(a.compressed, b.compressed);
swap(a.numBuckets, b.numBuckets);
swap(a.serdeInfo, b.serdeInfo);
swap(a.bucketCols, b.bucketCols);
swap(a.sortCols, b.sortCols);
swap(a.parameters, b.parameters);
swap(a.skewedInfo, b.skewedInfo);
swap(a.storedAsSubDirectories, b.storedAsSubDirectories);
swap(a.__isset, b.__isset);
}
const char* Table::ascii_fingerprint = "29EFB2A5970EF572039E5D94CC78AA85";
const uint8_t Table::binary_fingerprint[16] = {0x29,0xEF,0xB2,0xA5,0x97,0x0E,0xF5,0x72,0x03,0x9E,0x5D,0x94,0xCC,0x78,0xAA,0x85};
uint32_t Table::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->tableName);
this->__isset.tableName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->dbName);
this->__isset.dbName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->owner);
this->__isset.owner = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->createTime);
this->__isset.createTime = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->lastAccessTime);
this->__isset.lastAccessTime = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->retention);
this->__isset.retention = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->sd.read(iprot);
this->__isset.sd = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 8:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->partitionKeys.clear();
uint32_t _size157;
::apache::thrift::protocol::TType _etype160;
xfer += iprot->readListBegin(_etype160, _size157);
this->partitionKeys.resize(_size157);
uint32_t _i161;
for (_i161 = 0; _i161 < _size157; ++_i161)
{
xfer += this->partitionKeys[_i161].read(iprot);
}
xfer += iprot->readListEnd();
}
this->__isset.partitionKeys = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 9:
if (ftype == ::apache::thrift::protocol::T_MAP) {
{
this->parameters.clear();
uint32_t _size162;
::apache::thrift::protocol::TType _ktype163;
::apache::thrift::protocol::TType _vtype164;
xfer += iprot->readMapBegin(_ktype163, _vtype164, _size162);
uint32_t _i166;
for (_i166 = 0; _i166 < _size162; ++_i166)
{
std::string _key167;
xfer += iprot->readString(_key167);
std::string& _val168 = this->parameters[_key167];
xfer += iprot->readString(_val168);
}
xfer += iprot->readMapEnd();
}
this->__isset.parameters = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 10:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->viewOriginalText);
this->__isset.viewOriginalText = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 11:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->viewExpandedText);
this->__isset.viewExpandedText = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 12:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->tableType);
this->__isset.tableType = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 13:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->privileges.read(iprot);
this->__isset.privileges = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 14:
if (ftype == ::apache::thrift::protocol::T_BOOL) {
xfer += iprot->readBool(this->temporary);
this->__isset.temporary = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t Table::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("Table");
xfer += oprot->writeFieldBegin("tableName", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->tableName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("dbName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->dbName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("owner", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->owner);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("createTime", ::apache::thrift::protocol::T_I32, 4);
xfer += oprot->writeI32(this->createTime);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("lastAccessTime", ::apache::thrift::protocol::T_I32, 5);
xfer += oprot->writeI32(this->lastAccessTime);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("retention", ::apache::thrift::protocol::T_I32, 6);
xfer += oprot->writeI32(this->retention);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("sd", ::apache::thrift::protocol::T_STRUCT, 7);
xfer += this->sd.write(oprot);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("partitionKeys", ::apache::thrift::protocol::T_LIST, 8);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->partitionKeys.size()));
std::vector<FieldSchema> ::const_iterator _iter169;
for (_iter169 = this->partitionKeys.begin(); _iter169 != this->partitionKeys.end(); ++_iter169)
{
xfer += (*_iter169).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("parameters", ::apache::thrift::protocol::T_MAP, 9);
{
xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->parameters.size()));
std::map<std::string, std::string> ::const_iterator _iter170;
for (_iter170 = this->parameters.begin(); _iter170 != this->parameters.end(); ++_iter170)
{
xfer += oprot->writeString(_iter170->first);
xfer += oprot->writeString(_iter170->second);
}
xfer += oprot->writeMapEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("viewOriginalText", ::apache::thrift::protocol::T_STRING, 10);
xfer += oprot->writeString(this->viewOriginalText);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("viewExpandedText", ::apache::thrift::protocol::T_STRING, 11);
xfer += oprot->writeString(this->viewExpandedText);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("tableType", ::apache::thrift::protocol::T_STRING, 12);
xfer += oprot->writeString(this->tableType);
xfer += oprot->writeFieldEnd();
if (this->__isset.privileges) {
xfer += oprot->writeFieldBegin("privileges", ::apache::thrift::protocol::T_STRUCT, 13);
xfer += this->privileges.write(oprot);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.temporary) {
xfer += oprot->writeFieldBegin("temporary", ::apache::thrift::protocol::T_BOOL, 14);
xfer += oprot->writeBool(this->temporary);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(Table &a, Table &b) {
using ::std::swap;
swap(a.tableName, b.tableName);
swap(a.dbName, b.dbName);
swap(a.owner, b.owner);
swap(a.createTime, b.createTime);
swap(a.lastAccessTime, b.lastAccessTime);
swap(a.retention, b.retention);
swap(a.sd, b.sd);
swap(a.partitionKeys, b.partitionKeys);
swap(a.parameters, b.parameters);
swap(a.viewOriginalText, b.viewOriginalText);
swap(a.viewExpandedText, b.viewExpandedText);
swap(a.tableType, b.tableType);
swap(a.privileges, b.privileges);
swap(a.temporary, b.temporary);
swap(a.__isset, b.__isset);
}
const char* Partition::ascii_fingerprint = "31A52241B88A426C34087FE38343FF51";
const uint8_t Partition::binary_fingerprint[16] = {0x31,0xA5,0x22,0x41,0xB8,0x8A,0x42,0x6C,0x34,0x08,0x7F,0xE3,0x83,0x43,0xFF,0x51};
uint32_t Partition::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->values.clear();
uint32_t _size171;
::apache::thrift::protocol::TType _etype174;
xfer += iprot->readListBegin(_etype174, _size171);
this->values.resize(_size171);
uint32_t _i175;
for (_i175 = 0; _i175 < _size171; ++_i175)
{
xfer += iprot->readString(this->values[_i175]);
}
xfer += iprot->readListEnd();
}
this->__isset.values = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->dbName);
this->__isset.dbName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->tableName);
this->__isset.tableName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->createTime);
this->__isset.createTime = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->lastAccessTime);
this->__isset.lastAccessTime = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->sd.read(iprot);
this->__isset.sd = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_MAP) {
{
this->parameters.clear();
uint32_t _size176;
::apache::thrift::protocol::TType _ktype177;
::apache::thrift::protocol::TType _vtype178;
xfer += iprot->readMapBegin(_ktype177, _vtype178, _size176);
uint32_t _i180;
for (_i180 = 0; _i180 < _size176; ++_i180)
{
std::string _key181;
xfer += iprot->readString(_key181);
std::string& _val182 = this->parameters[_key181];
xfer += iprot->readString(_val182);
}
xfer += iprot->readMapEnd();
}
this->__isset.parameters = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 8:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->privileges.read(iprot);
this->__isset.privileges = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t Partition::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("Partition");
xfer += oprot->writeFieldBegin("values", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->values.size()));
std::vector<std::string> ::const_iterator _iter183;
for (_iter183 = this->values.begin(); _iter183 != this->values.end(); ++_iter183)
{
xfer += oprot->writeString((*_iter183));
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("dbName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->dbName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("tableName", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->tableName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("createTime", ::apache::thrift::protocol::T_I32, 4);
xfer += oprot->writeI32(this->createTime);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("lastAccessTime", ::apache::thrift::protocol::T_I32, 5);
xfer += oprot->writeI32(this->lastAccessTime);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("sd", ::apache::thrift::protocol::T_STRUCT, 6);
xfer += this->sd.write(oprot);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("parameters", ::apache::thrift::protocol::T_MAP, 7);
{
xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->parameters.size()));
std::map<std::string, std::string> ::const_iterator _iter184;
for (_iter184 = this->parameters.begin(); _iter184 != this->parameters.end(); ++_iter184)
{
xfer += oprot->writeString(_iter184->first);
xfer += oprot->writeString(_iter184->second);
}
xfer += oprot->writeMapEnd();
}
xfer += oprot->writeFieldEnd();
if (this->__isset.privileges) {
xfer += oprot->writeFieldBegin("privileges", ::apache::thrift::protocol::T_STRUCT, 8);
xfer += this->privileges.write(oprot);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(Partition &a, Partition &b) {
using ::std::swap;
swap(a.values, b.values);
swap(a.dbName, b.dbName);
swap(a.tableName, b.tableName);
swap(a.createTime, b.createTime);
swap(a.lastAccessTime, b.lastAccessTime);
swap(a.sd, b.sd);
swap(a.parameters, b.parameters);
swap(a.privileges, b.privileges);
swap(a.__isset, b.__isset);
}
const char* PartitionWithoutSD::ascii_fingerprint = "D79FA44499888D0E50B5625E0C536DEA";
const uint8_t PartitionWithoutSD::binary_fingerprint[16] = {0xD7,0x9F,0xA4,0x44,0x99,0x88,0x8D,0x0E,0x50,0xB5,0x62,0x5E,0x0C,0x53,0x6D,0xEA};
uint32_t PartitionWithoutSD::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->values.clear();
uint32_t _size185;
::apache::thrift::protocol::TType _etype188;
xfer += iprot->readListBegin(_etype188, _size185);
this->values.resize(_size185);
uint32_t _i189;
for (_i189 = 0; _i189 < _size185; ++_i189)
{
xfer += iprot->readString(this->values[_i189]);
}
xfer += iprot->readListEnd();
}
this->__isset.values = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->createTime);
this->__isset.createTime = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->lastAccessTime);
this->__isset.lastAccessTime = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->relativePath);
this->__isset.relativePath = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_MAP) {
{
this->parameters.clear();
uint32_t _size190;
::apache::thrift::protocol::TType _ktype191;
::apache::thrift::protocol::TType _vtype192;
xfer += iprot->readMapBegin(_ktype191, _vtype192, _size190);
uint32_t _i194;
for (_i194 = 0; _i194 < _size190; ++_i194)
{
std::string _key195;
xfer += iprot->readString(_key195);
std::string& _val196 = this->parameters[_key195];
xfer += iprot->readString(_val196);
}
xfer += iprot->readMapEnd();
}
this->__isset.parameters = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->privileges.read(iprot);
this->__isset.privileges = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t PartitionWithoutSD::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("PartitionWithoutSD");
xfer += oprot->writeFieldBegin("values", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->values.size()));
std::vector<std::string> ::const_iterator _iter197;
for (_iter197 = this->values.begin(); _iter197 != this->values.end(); ++_iter197)
{
xfer += oprot->writeString((*_iter197));
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("createTime", ::apache::thrift::protocol::T_I32, 2);
xfer += oprot->writeI32(this->createTime);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("lastAccessTime", ::apache::thrift::protocol::T_I32, 3);
xfer += oprot->writeI32(this->lastAccessTime);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("relativePath", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString(this->relativePath);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("parameters", ::apache::thrift::protocol::T_MAP, 5);
{
xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->parameters.size()));
std::map<std::string, std::string> ::const_iterator _iter198;
for (_iter198 = this->parameters.begin(); _iter198 != this->parameters.end(); ++_iter198)
{
xfer += oprot->writeString(_iter198->first);
xfer += oprot->writeString(_iter198->second);
}
xfer += oprot->writeMapEnd();
}
xfer += oprot->writeFieldEnd();
if (this->__isset.privileges) {
xfer += oprot->writeFieldBegin("privileges", ::apache::thrift::protocol::T_STRUCT, 6);
xfer += this->privileges.write(oprot);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(PartitionWithoutSD &a, PartitionWithoutSD &b) {
using ::std::swap;
swap(a.values, b.values);
swap(a.createTime, b.createTime);
swap(a.lastAccessTime, b.lastAccessTime);
swap(a.relativePath, b.relativePath);
swap(a.parameters, b.parameters);
swap(a.privileges, b.privileges);
swap(a.__isset, b.__isset);
}
const char* PartitionSpecWithSharedSD::ascii_fingerprint = "7BEE9305B42DCD083FF06BEE6DDC61CF";
const uint8_t PartitionSpecWithSharedSD::binary_fingerprint[16] = {0x7B,0xEE,0x93,0x05,0xB4,0x2D,0xCD,0x08,0x3F,0xF0,0x6B,0xEE,0x6D,0xDC,0x61,0xCF};
uint32_t PartitionSpecWithSharedSD::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->partitions.clear();
uint32_t _size199;
::apache::thrift::protocol::TType _etype202;
xfer += iprot->readListBegin(_etype202, _size199);
this->partitions.resize(_size199);
uint32_t _i203;
for (_i203 = 0; _i203 < _size199; ++_i203)
{
xfer += this->partitions[_i203].read(iprot);
}
xfer += iprot->readListEnd();
}
this->__isset.partitions = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->sd.read(iprot);
this->__isset.sd = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t PartitionSpecWithSharedSD::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("PartitionSpecWithSharedSD");
xfer += oprot->writeFieldBegin("partitions", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->partitions.size()));
std::vector<PartitionWithoutSD> ::const_iterator _iter204;
for (_iter204 = this->partitions.begin(); _iter204 != this->partitions.end(); ++_iter204)
{
xfer += (*_iter204).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("sd", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->sd.write(oprot);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(PartitionSpecWithSharedSD &a, PartitionSpecWithSharedSD &b) {
using ::std::swap;
swap(a.partitions, b.partitions);
swap(a.sd, b.sd);
swap(a.__isset, b.__isset);
}
const char* PartitionListComposingSpec::ascii_fingerprint = "A048235CB9A257C8A74E3691BEFE0674";
const uint8_t PartitionListComposingSpec::binary_fingerprint[16] = {0xA0,0x48,0x23,0x5C,0xB9,0xA2,0x57,0xC8,0xA7,0x4E,0x36,0x91,0xBE,0xFE,0x06,0x74};
uint32_t PartitionListComposingSpec::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->partitions.clear();
uint32_t _size205;
::apache::thrift::protocol::TType _etype208;
xfer += iprot->readListBegin(_etype208, _size205);
this->partitions.resize(_size205);
uint32_t _i209;
for (_i209 = 0; _i209 < _size205; ++_i209)
{
xfer += this->partitions[_i209].read(iprot);
}
xfer += iprot->readListEnd();
}
this->__isset.partitions = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t PartitionListComposingSpec::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("PartitionListComposingSpec");
xfer += oprot->writeFieldBegin("partitions", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->partitions.size()));
std::vector<Partition> ::const_iterator _iter210;
for (_iter210 = this->partitions.begin(); _iter210 != this->partitions.end(); ++_iter210)
{
xfer += (*_iter210).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(PartitionListComposingSpec &a, PartitionListComposingSpec &b) {
using ::std::swap;
swap(a.partitions, b.partitions);
swap(a.__isset, b.__isset);
}
const char* PartitionSpec::ascii_fingerprint = "C3F548C24D072CF6422F25096143E3E8";
const uint8_t PartitionSpec::binary_fingerprint[16] = {0xC3,0xF5,0x48,0xC2,0x4D,0x07,0x2C,0xF6,0x42,0x2F,0x25,0x09,0x61,0x43,0xE3,0xE8};
uint32_t PartitionSpec::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->dbName);
this->__isset.dbName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->tableName);
this->__isset.tableName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->rootPath);
this->__isset.rootPath = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->sharedSDPartitionSpec.read(iprot);
this->__isset.sharedSDPartitionSpec = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->partitionList.read(iprot);
this->__isset.partitionList = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t PartitionSpec::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("PartitionSpec");
xfer += oprot->writeFieldBegin("dbName", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->dbName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("tableName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->tableName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("rootPath", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->rootPath);
xfer += oprot->writeFieldEnd();
if (this->__isset.sharedSDPartitionSpec) {
xfer += oprot->writeFieldBegin("sharedSDPartitionSpec", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->sharedSDPartitionSpec.write(oprot);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.partitionList) {
xfer += oprot->writeFieldBegin("partitionList", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += this->partitionList.write(oprot);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(PartitionSpec &a, PartitionSpec &b) {
using ::std::swap;
swap(a.dbName, b.dbName);
swap(a.tableName, b.tableName);
swap(a.rootPath, b.rootPath);
swap(a.sharedSDPartitionSpec, b.sharedSDPartitionSpec);
swap(a.partitionList, b.partitionList);
swap(a.__isset, b.__isset);
}
const char* Index::ascii_fingerprint = "09EEF655216AC81802850988D6C470A6";
const uint8_t Index::binary_fingerprint[16] = {0x09,0xEE,0xF6,0x55,0x21,0x6A,0xC8,0x18,0x02,0x85,0x09,0x88,0xD6,0xC4,0x70,0xA6};
uint32_t Index::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->indexName);
this->__isset.indexName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->indexHandlerClass);
this->__isset.indexHandlerClass = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->dbName);
this->__isset.dbName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->origTableName);
this->__isset.origTableName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->createTime);
this->__isset.createTime = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->lastAccessTime);
this->__isset.lastAccessTime = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->indexTableName);
this->__isset.indexTableName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 8:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->sd.read(iprot);
this->__isset.sd = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 9:
if (ftype == ::apache::thrift::protocol::T_MAP) {
{
this->parameters.clear();
uint32_t _size211;
::apache::thrift::protocol::TType _ktype212;
::apache::thrift::protocol::TType _vtype213;
xfer += iprot->readMapBegin(_ktype212, _vtype213, _size211);
uint32_t _i215;
for (_i215 = 0; _i215 < _size211; ++_i215)
{
std::string _key216;
xfer += iprot->readString(_key216);
std::string& _val217 = this->parameters[_key216];
xfer += iprot->readString(_val217);
}
xfer += iprot->readMapEnd();
}
this->__isset.parameters = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 10:
if (ftype == ::apache::thrift::protocol::T_BOOL) {
xfer += iprot->readBool(this->deferredRebuild);
this->__isset.deferredRebuild = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t Index::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("Index");
xfer += oprot->writeFieldBegin("indexName", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->indexName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("indexHandlerClass", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->indexHandlerClass);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("dbName", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->dbName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("origTableName", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString(this->origTableName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("createTime", ::apache::thrift::protocol::T_I32, 5);
xfer += oprot->writeI32(this->createTime);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("lastAccessTime", ::apache::thrift::protocol::T_I32, 6);
xfer += oprot->writeI32(this->lastAccessTime);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("indexTableName", ::apache::thrift::protocol::T_STRING, 7);
xfer += oprot->writeString(this->indexTableName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("sd", ::apache::thrift::protocol::T_STRUCT, 8);
xfer += this->sd.write(oprot);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("parameters", ::apache::thrift::protocol::T_MAP, 9);
{
xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->parameters.size()));
std::map<std::string, std::string> ::const_iterator _iter218;
for (_iter218 = this->parameters.begin(); _iter218 != this->parameters.end(); ++_iter218)
{
xfer += oprot->writeString(_iter218->first);
xfer += oprot->writeString(_iter218->second);
}
xfer += oprot->writeMapEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("deferredRebuild", ::apache::thrift::protocol::T_BOOL, 10);
xfer += oprot->writeBool(this->deferredRebuild);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(Index &a, Index &b) {
using ::std::swap;
swap(a.indexName, b.indexName);
swap(a.indexHandlerClass, b.indexHandlerClass);
swap(a.dbName, b.dbName);
swap(a.origTableName, b.origTableName);
swap(a.createTime, b.createTime);
swap(a.lastAccessTime, b.lastAccessTime);
swap(a.indexTableName, b.indexTableName);
swap(a.sd, b.sd);
swap(a.parameters, b.parameters);
swap(a.deferredRebuild, b.deferredRebuild);
swap(a.__isset, b.__isset);
}
const char* BooleanColumnStatsData::ascii_fingerprint = "EA2D65F1E0BB78760205682082304B41";
const uint8_t BooleanColumnStatsData::binary_fingerprint[16] = {0xEA,0x2D,0x65,0xF1,0xE0,0xBB,0x78,0x76,0x02,0x05,0x68,0x20,0x82,0x30,0x4B,0x41};
uint32_t BooleanColumnStatsData::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_numTrues = false;
bool isset_numFalses = false;
bool isset_numNulls = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->numTrues);
isset_numTrues = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->numFalses);
isset_numFalses = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->numNulls);
isset_numNulls = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_numTrues)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_numFalses)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_numNulls)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t BooleanColumnStatsData::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("BooleanColumnStatsData");
xfer += oprot->writeFieldBegin("numTrues", ::apache::thrift::protocol::T_I64, 1);
xfer += oprot->writeI64(this->numTrues);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("numFalses", ::apache::thrift::protocol::T_I64, 2);
xfer += oprot->writeI64(this->numFalses);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("numNulls", ::apache::thrift::protocol::T_I64, 3);
xfer += oprot->writeI64(this->numNulls);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(BooleanColumnStatsData &a, BooleanColumnStatsData &b) {
using ::std::swap;
swap(a.numTrues, b.numTrues);
swap(a.numFalses, b.numFalses);
swap(a.numNulls, b.numNulls);
}
const char* DoubleColumnStatsData::ascii_fingerprint = "DA7C011321D74C48396AA002E61A0CBB";
const uint8_t DoubleColumnStatsData::binary_fingerprint[16] = {0xDA,0x7C,0x01,0x13,0x21,0xD7,0x4C,0x48,0x39,0x6A,0xA0,0x02,0xE6,0x1A,0x0C,0xBB};
uint32_t DoubleColumnStatsData::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_numNulls = false;
bool isset_numDVs = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_DOUBLE) {
xfer += iprot->readDouble(this->lowValue);
this->__isset.lowValue = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_DOUBLE) {
xfer += iprot->readDouble(this->highValue);
this->__isset.highValue = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->numNulls);
isset_numNulls = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->numDVs);
isset_numDVs = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_numNulls)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_numDVs)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t DoubleColumnStatsData::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("DoubleColumnStatsData");
if (this->__isset.lowValue) {
xfer += oprot->writeFieldBegin("lowValue", ::apache::thrift::protocol::T_DOUBLE, 1);
xfer += oprot->writeDouble(this->lowValue);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.highValue) {
xfer += oprot->writeFieldBegin("highValue", ::apache::thrift::protocol::T_DOUBLE, 2);
xfer += oprot->writeDouble(this->highValue);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldBegin("numNulls", ::apache::thrift::protocol::T_I64, 3);
xfer += oprot->writeI64(this->numNulls);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("numDVs", ::apache::thrift::protocol::T_I64, 4);
xfer += oprot->writeI64(this->numDVs);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(DoubleColumnStatsData &a, DoubleColumnStatsData &b) {
using ::std::swap;
swap(a.lowValue, b.lowValue);
swap(a.highValue, b.highValue);
swap(a.numNulls, b.numNulls);
swap(a.numDVs, b.numDVs);
swap(a.__isset, b.__isset);
}
const char* LongColumnStatsData::ascii_fingerprint = "E685FC220B24E3B8B93604790DCB9AEA";
const uint8_t LongColumnStatsData::binary_fingerprint[16] = {0xE6,0x85,0xFC,0x22,0x0B,0x24,0xE3,0xB8,0xB9,0x36,0x04,0x79,0x0D,0xCB,0x9A,0xEA};
uint32_t LongColumnStatsData::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_numNulls = false;
bool isset_numDVs = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->lowValue);
this->__isset.lowValue = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->highValue);
this->__isset.highValue = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->numNulls);
isset_numNulls = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->numDVs);
isset_numDVs = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_numNulls)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_numDVs)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t LongColumnStatsData::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("LongColumnStatsData");
if (this->__isset.lowValue) {
xfer += oprot->writeFieldBegin("lowValue", ::apache::thrift::protocol::T_I64, 1);
xfer += oprot->writeI64(this->lowValue);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.highValue) {
xfer += oprot->writeFieldBegin("highValue", ::apache::thrift::protocol::T_I64, 2);
xfer += oprot->writeI64(this->highValue);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldBegin("numNulls", ::apache::thrift::protocol::T_I64, 3);
xfer += oprot->writeI64(this->numNulls);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("numDVs", ::apache::thrift::protocol::T_I64, 4);
xfer += oprot->writeI64(this->numDVs);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(LongColumnStatsData &a, LongColumnStatsData &b) {
using ::std::swap;
swap(a.lowValue, b.lowValue);
swap(a.highValue, b.highValue);
swap(a.numNulls, b.numNulls);
swap(a.numDVs, b.numDVs);
swap(a.__isset, b.__isset);
}
const char* StringColumnStatsData::ascii_fingerprint = "D017B08C3DF12C3AB98788B2E67DAAB3";
const uint8_t StringColumnStatsData::binary_fingerprint[16] = {0xD0,0x17,0xB0,0x8C,0x3D,0xF1,0x2C,0x3A,0xB9,0x87,0x88,0xB2,0xE6,0x7D,0xAA,0xB3};
uint32_t StringColumnStatsData::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_maxColLen = false;
bool isset_avgColLen = false;
bool isset_numNulls = false;
bool isset_numDVs = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->maxColLen);
isset_maxColLen = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_DOUBLE) {
xfer += iprot->readDouble(this->avgColLen);
isset_avgColLen = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->numNulls);
isset_numNulls = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->numDVs);
isset_numDVs = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_maxColLen)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_avgColLen)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_numNulls)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_numDVs)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t StringColumnStatsData::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("StringColumnStatsData");
xfer += oprot->writeFieldBegin("maxColLen", ::apache::thrift::protocol::T_I64, 1);
xfer += oprot->writeI64(this->maxColLen);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("avgColLen", ::apache::thrift::protocol::T_DOUBLE, 2);
xfer += oprot->writeDouble(this->avgColLen);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("numNulls", ::apache::thrift::protocol::T_I64, 3);
xfer += oprot->writeI64(this->numNulls);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("numDVs", ::apache::thrift::protocol::T_I64, 4);
xfer += oprot->writeI64(this->numDVs);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(StringColumnStatsData &a, StringColumnStatsData &b) {
using ::std::swap;
swap(a.maxColLen, b.maxColLen);
swap(a.avgColLen, b.avgColLen);
swap(a.numNulls, b.numNulls);
swap(a.numDVs, b.numDVs);
}
const char* BinaryColumnStatsData::ascii_fingerprint = "22B0CB67183FCDB945892B9974518D06";
const uint8_t BinaryColumnStatsData::binary_fingerprint[16] = {0x22,0xB0,0xCB,0x67,0x18,0x3F,0xCD,0xB9,0x45,0x89,0x2B,0x99,0x74,0x51,0x8D,0x06};
uint32_t BinaryColumnStatsData::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_maxColLen = false;
bool isset_avgColLen = false;
bool isset_numNulls = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->maxColLen);
isset_maxColLen = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_DOUBLE) {
xfer += iprot->readDouble(this->avgColLen);
isset_avgColLen = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->numNulls);
isset_numNulls = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_maxColLen)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_avgColLen)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_numNulls)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t BinaryColumnStatsData::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("BinaryColumnStatsData");
xfer += oprot->writeFieldBegin("maxColLen", ::apache::thrift::protocol::T_I64, 1);
xfer += oprot->writeI64(this->maxColLen);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("avgColLen", ::apache::thrift::protocol::T_DOUBLE, 2);
xfer += oprot->writeDouble(this->avgColLen);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("numNulls", ::apache::thrift::protocol::T_I64, 3);
xfer += oprot->writeI64(this->numNulls);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(BinaryColumnStatsData &a, BinaryColumnStatsData &b) {
using ::std::swap;
swap(a.maxColLen, b.maxColLen);
swap(a.avgColLen, b.avgColLen);
swap(a.numNulls, b.numNulls);
}
const char* Decimal::ascii_fingerprint = "C4DDF6759F9B17C5C380806CE743DE8E";
const uint8_t Decimal::binary_fingerprint[16] = {0xC4,0xDD,0xF6,0x75,0x9F,0x9B,0x17,0xC5,0xC3,0x80,0x80,0x6C,0xE7,0x43,0xDE,0x8E};
uint32_t Decimal::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_unscaled = false;
bool isset_scale = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readBinary(this->unscaled);
isset_unscaled = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_I16) {
xfer += iprot->readI16(this->scale);
isset_scale = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_unscaled)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_scale)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t Decimal::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("Decimal");
xfer += oprot->writeFieldBegin("unscaled", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeBinary(this->unscaled);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("scale", ::apache::thrift::protocol::T_I16, 3);
xfer += oprot->writeI16(this->scale);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(Decimal &a, Decimal &b) {
using ::std::swap;
swap(a.unscaled, b.unscaled);
swap(a.scale, b.scale);
}
const char* DecimalColumnStatsData::ascii_fingerprint = "B6D47E7A28922BFA93FE05E9F1B04748";
const uint8_t DecimalColumnStatsData::binary_fingerprint[16] = {0xB6,0xD4,0x7E,0x7A,0x28,0x92,0x2B,0xFA,0x93,0xFE,0x05,0xE9,0xF1,0xB0,0x47,0x48};
uint32_t DecimalColumnStatsData::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_numNulls = false;
bool isset_numDVs = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->lowValue.read(iprot);
this->__isset.lowValue = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->highValue.read(iprot);
this->__isset.highValue = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->numNulls);
isset_numNulls = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->numDVs);
isset_numDVs = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_numNulls)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_numDVs)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t DecimalColumnStatsData::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("DecimalColumnStatsData");
if (this->__isset.lowValue) {
xfer += oprot->writeFieldBegin("lowValue", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->lowValue.write(oprot);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.highValue) {
xfer += oprot->writeFieldBegin("highValue", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->highValue.write(oprot);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldBegin("numNulls", ::apache::thrift::protocol::T_I64, 3);
xfer += oprot->writeI64(this->numNulls);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("numDVs", ::apache::thrift::protocol::T_I64, 4);
xfer += oprot->writeI64(this->numDVs);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(DecimalColumnStatsData &a, DecimalColumnStatsData &b) {
using ::std::swap;
swap(a.lowValue, b.lowValue);
swap(a.highValue, b.highValue);
swap(a.numNulls, b.numNulls);
swap(a.numDVs, b.numDVs);
swap(a.__isset, b.__isset);
}
const char* ColumnStatisticsData::ascii_fingerprint = "D079ACEA6EE0998D0A45CB65FF1EAADD";
const uint8_t ColumnStatisticsData::binary_fingerprint[16] = {0xD0,0x79,0xAC,0xEA,0x6E,0xE0,0x99,0x8D,0x0A,0x45,0xCB,0x65,0xFF,0x1E,0xAA,0xDD};
uint32_t ColumnStatisticsData::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->booleanStats.read(iprot);
this->__isset.booleanStats = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->longStats.read(iprot);
this->__isset.longStats = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->doubleStats.read(iprot);
this->__isset.doubleStats = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->stringStats.read(iprot);
this->__isset.stringStats = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->binaryStats.read(iprot);
this->__isset.binaryStats = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->decimalStats.read(iprot);
this->__isset.decimalStats = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t ColumnStatisticsData::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("ColumnStatisticsData");
xfer += oprot->writeFieldBegin("booleanStats", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->booleanStats.write(oprot);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("longStats", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->longStats.write(oprot);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("doubleStats", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->doubleStats.write(oprot);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("stringStats", ::apache::thrift::protocol::T_STRUCT, 4);
xfer += this->stringStats.write(oprot);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("binaryStats", ::apache::thrift::protocol::T_STRUCT, 5);
xfer += this->binaryStats.write(oprot);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("decimalStats", ::apache::thrift::protocol::T_STRUCT, 6);
xfer += this->decimalStats.write(oprot);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(ColumnStatisticsData &a, ColumnStatisticsData &b) {
using ::std::swap;
swap(a.booleanStats, b.booleanStats);
swap(a.longStats, b.longStats);
swap(a.doubleStats, b.doubleStats);
swap(a.stringStats, b.stringStats);
swap(a.binaryStats, b.binaryStats);
swap(a.decimalStats, b.decimalStats);
swap(a.__isset, b.__isset);
}
const char* ColumnStatisticsObj::ascii_fingerprint = "E49E62CFC71682004614EFEDAC3CD3F4";
const uint8_t ColumnStatisticsObj::binary_fingerprint[16] = {0xE4,0x9E,0x62,0xCF,0xC7,0x16,0x82,0x00,0x46,0x14,0xEF,0xED,0xAC,0x3C,0xD3,0xF4};
uint32_t ColumnStatisticsObj::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_colName = false;
bool isset_colType = false;
bool isset_statsData = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->colName);
isset_colName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->colType);
isset_colType = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->statsData.read(iprot);
isset_statsData = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_colName)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_colType)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_statsData)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t ColumnStatisticsObj::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("ColumnStatisticsObj");
xfer += oprot->writeFieldBegin("colName", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->colName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("colType", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->colType);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("statsData", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->statsData.write(oprot);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(ColumnStatisticsObj &a, ColumnStatisticsObj &b) {
using ::std::swap;
swap(a.colName, b.colName);
swap(a.colType, b.colType);
swap(a.statsData, b.statsData);
}
const char* ColumnStatisticsDesc::ascii_fingerprint = "261759FF6F8FAB53F941453007FE18CB";
const uint8_t ColumnStatisticsDesc::binary_fingerprint[16] = {0x26,0x17,0x59,0xFF,0x6F,0x8F,0xAB,0x53,0xF9,0x41,0x45,0x30,0x07,0xFE,0x18,0xCB};
uint32_t ColumnStatisticsDesc::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_isTblLevel = false;
bool isset_dbName = false;
bool isset_tableName = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_BOOL) {
xfer += iprot->readBool(this->isTblLevel);
isset_isTblLevel = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->dbName);
isset_dbName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->tableName);
isset_tableName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->partName);
this->__isset.partName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->lastAnalyzed);
this->__isset.lastAnalyzed = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_isTblLevel)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_dbName)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_tableName)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t ColumnStatisticsDesc::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("ColumnStatisticsDesc");
xfer += oprot->writeFieldBegin("isTblLevel", ::apache::thrift::protocol::T_BOOL, 1);
xfer += oprot->writeBool(this->isTblLevel);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("dbName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->dbName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("tableName", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->tableName);
xfer += oprot->writeFieldEnd();
if (this->__isset.partName) {
xfer += oprot->writeFieldBegin("partName", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString(this->partName);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.lastAnalyzed) {
xfer += oprot->writeFieldBegin("lastAnalyzed", ::apache::thrift::protocol::T_I64, 5);
xfer += oprot->writeI64(this->lastAnalyzed);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(ColumnStatisticsDesc &a, ColumnStatisticsDesc &b) {
using ::std::swap;
swap(a.isTblLevel, b.isTblLevel);
swap(a.dbName, b.dbName);
swap(a.tableName, b.tableName);
swap(a.partName, b.partName);
swap(a.lastAnalyzed, b.lastAnalyzed);
swap(a.__isset, b.__isset);
}
const char* ColumnStatistics::ascii_fingerprint = "6682E234199B2CD3807B1ED420C6A7F8";
const uint8_t ColumnStatistics::binary_fingerprint[16] = {0x66,0x82,0xE2,0x34,0x19,0x9B,0x2C,0xD3,0x80,0x7B,0x1E,0xD4,0x20,0xC6,0xA7,0xF8};
uint32_t ColumnStatistics::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_statsDesc = false;
bool isset_statsObj = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->statsDesc.read(iprot);
isset_statsDesc = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->statsObj.clear();
uint32_t _size219;
::apache::thrift::protocol::TType _etype222;
xfer += iprot->readListBegin(_etype222, _size219);
this->statsObj.resize(_size219);
uint32_t _i223;
for (_i223 = 0; _i223 < _size219; ++_i223)
{
xfer += this->statsObj[_i223].read(iprot);
}
xfer += iprot->readListEnd();
}
isset_statsObj = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_statsDesc)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_statsObj)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t ColumnStatistics::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("ColumnStatistics");
xfer += oprot->writeFieldBegin("statsDesc", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->statsDesc.write(oprot);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("statsObj", ::apache::thrift::protocol::T_LIST, 2);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->statsObj.size()));
std::vector<ColumnStatisticsObj> ::const_iterator _iter224;
for (_iter224 = this->statsObj.begin(); _iter224 != this->statsObj.end(); ++_iter224)
{
xfer += (*_iter224).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(ColumnStatistics &a, ColumnStatistics &b) {
using ::std::swap;
swap(a.statsDesc, b.statsDesc);
swap(a.statsObj, b.statsObj);
}
const char* AggrStats::ascii_fingerprint = "399BDBAF7503E0BFB5E1D99C83D790CD";
const uint8_t AggrStats::binary_fingerprint[16] = {0x39,0x9B,0xDB,0xAF,0x75,0x03,0xE0,0xBF,0xB5,0xE1,0xD9,0x9C,0x83,0xD7,0x90,0xCD};
uint32_t AggrStats::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_colStats = false;
bool isset_partsFound = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->colStats.clear();
uint32_t _size225;
::apache::thrift::protocol::TType _etype228;
xfer += iprot->readListBegin(_etype228, _size225);
this->colStats.resize(_size225);
uint32_t _i229;
for (_i229 = 0; _i229 < _size225; ++_i229)
{
xfer += this->colStats[_i229].read(iprot);
}
xfer += iprot->readListEnd();
}
isset_colStats = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->partsFound);
isset_partsFound = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_colStats)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_partsFound)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t AggrStats::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("AggrStats");
xfer += oprot->writeFieldBegin("colStats", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->colStats.size()));
std::vector<ColumnStatisticsObj> ::const_iterator _iter230;
for (_iter230 = this->colStats.begin(); _iter230 != this->colStats.end(); ++_iter230)
{
xfer += (*_iter230).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("partsFound", ::apache::thrift::protocol::T_I64, 2);
xfer += oprot->writeI64(this->partsFound);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(AggrStats &a, AggrStats &b) {
using ::std::swap;
swap(a.colStats, b.colStats);
swap(a.partsFound, b.partsFound);
}
const char* SetPartitionsStatsRequest::ascii_fingerprint = "635C0DA9A947DA57AAE693A5DFB86569";
const uint8_t SetPartitionsStatsRequest::binary_fingerprint[16] = {0x63,0x5C,0x0D,0xA9,0xA9,0x47,0xDA,0x57,0xAA,0xE6,0x93,0xA5,0xDF,0xB8,0x65,0x69};
uint32_t SetPartitionsStatsRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_colStats = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->colStats.clear();
uint32_t _size231;
::apache::thrift::protocol::TType _etype234;
xfer += iprot->readListBegin(_etype234, _size231);
this->colStats.resize(_size231);
uint32_t _i235;
for (_i235 = 0; _i235 < _size231; ++_i235)
{
xfer += this->colStats[_i235].read(iprot);
}
xfer += iprot->readListEnd();
}
isset_colStats = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_colStats)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t SetPartitionsStatsRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("SetPartitionsStatsRequest");
xfer += oprot->writeFieldBegin("colStats", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->colStats.size()));
std::vector<ColumnStatistics> ::const_iterator _iter236;
for (_iter236 = this->colStats.begin(); _iter236 != this->colStats.end(); ++_iter236)
{
xfer += (*_iter236).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(SetPartitionsStatsRequest &a, SetPartitionsStatsRequest &b) {
using ::std::swap;
swap(a.colStats, b.colStats);
}
const char* Schema::ascii_fingerprint = "5CFEE46C975F4E2368D905109B8E3B5B";
const uint8_t Schema::binary_fingerprint[16] = {0x5C,0xFE,0xE4,0x6C,0x97,0x5F,0x4E,0x23,0x68,0xD9,0x05,0x10,0x9B,0x8E,0x3B,0x5B};
uint32_t Schema::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->fieldSchemas.clear();
uint32_t _size237;
::apache::thrift::protocol::TType _etype240;
xfer += iprot->readListBegin(_etype240, _size237);
this->fieldSchemas.resize(_size237);
uint32_t _i241;
for (_i241 = 0; _i241 < _size237; ++_i241)
{
xfer += this->fieldSchemas[_i241].read(iprot);
}
xfer += iprot->readListEnd();
}
this->__isset.fieldSchemas = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_MAP) {
{
this->properties.clear();
uint32_t _size242;
::apache::thrift::protocol::TType _ktype243;
::apache::thrift::protocol::TType _vtype244;
xfer += iprot->readMapBegin(_ktype243, _vtype244, _size242);
uint32_t _i246;
for (_i246 = 0; _i246 < _size242; ++_i246)
{
std::string _key247;
xfer += iprot->readString(_key247);
std::string& _val248 = this->properties[_key247];
xfer += iprot->readString(_val248);
}
xfer += iprot->readMapEnd();
}
this->__isset.properties = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t Schema::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("Schema");
xfer += oprot->writeFieldBegin("fieldSchemas", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->fieldSchemas.size()));
std::vector<FieldSchema> ::const_iterator _iter249;
for (_iter249 = this->fieldSchemas.begin(); _iter249 != this->fieldSchemas.end(); ++_iter249)
{
xfer += (*_iter249).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("properties", ::apache::thrift::protocol::T_MAP, 2);
{
xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->properties.size()));
std::map<std::string, std::string> ::const_iterator _iter250;
for (_iter250 = this->properties.begin(); _iter250 != this->properties.end(); ++_iter250)
{
xfer += oprot->writeString(_iter250->first);
xfer += oprot->writeString(_iter250->second);
}
xfer += oprot->writeMapEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(Schema &a, Schema &b) {
using ::std::swap;
swap(a.fieldSchemas, b.fieldSchemas);
swap(a.properties, b.properties);
swap(a.__isset, b.__isset);
}
const char* EnvironmentContext::ascii_fingerprint = "5EA2D527ECA3BA20C77AFC023EE8C05F";
const uint8_t EnvironmentContext::binary_fingerprint[16] = {0x5E,0xA2,0xD5,0x27,0xEC,0xA3,0xBA,0x20,0xC7,0x7A,0xFC,0x02,0x3E,0xE8,0xC0,0x5F};
uint32_t EnvironmentContext::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_MAP) {
{
this->properties.clear();
uint32_t _size251;
::apache::thrift::protocol::TType _ktype252;
::apache::thrift::protocol::TType _vtype253;
xfer += iprot->readMapBegin(_ktype252, _vtype253, _size251);
uint32_t _i255;
for (_i255 = 0; _i255 < _size251; ++_i255)
{
std::string _key256;
xfer += iprot->readString(_key256);
std::string& _val257 = this->properties[_key256];
xfer += iprot->readString(_val257);
}
xfer += iprot->readMapEnd();
}
this->__isset.properties = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t EnvironmentContext::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("EnvironmentContext");
xfer += oprot->writeFieldBegin("properties", ::apache::thrift::protocol::T_MAP, 1);
{
xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->properties.size()));
std::map<std::string, std::string> ::const_iterator _iter258;
for (_iter258 = this->properties.begin(); _iter258 != this->properties.end(); ++_iter258)
{
xfer += oprot->writeString(_iter258->first);
xfer += oprot->writeString(_iter258->second);
}
xfer += oprot->writeMapEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(EnvironmentContext &a, EnvironmentContext &b) {
using ::std::swap;
swap(a.properties, b.properties);
swap(a.__isset, b.__isset);
}
const char* PartitionsByExprResult::ascii_fingerprint = "40B789CC91B508FE36600A14E3F80425";
const uint8_t PartitionsByExprResult::binary_fingerprint[16] = {0x40,0xB7,0x89,0xCC,0x91,0xB5,0x08,0xFE,0x36,0x60,0x0A,0x14,0xE3,0xF8,0x04,0x25};
uint32_t PartitionsByExprResult::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_partitions = false;
bool isset_hasUnknownPartitions = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->partitions.clear();
uint32_t _size259;
::apache::thrift::protocol::TType _etype262;
xfer += iprot->readListBegin(_etype262, _size259);
this->partitions.resize(_size259);
uint32_t _i263;
for (_i263 = 0; _i263 < _size259; ++_i263)
{
xfer += this->partitions[_i263].read(iprot);
}
xfer += iprot->readListEnd();
}
isset_partitions = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_BOOL) {
xfer += iprot->readBool(this->hasUnknownPartitions);
isset_hasUnknownPartitions = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_partitions)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_hasUnknownPartitions)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t PartitionsByExprResult::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("PartitionsByExprResult");
xfer += oprot->writeFieldBegin("partitions", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->partitions.size()));
std::vector<Partition> ::const_iterator _iter264;
for (_iter264 = this->partitions.begin(); _iter264 != this->partitions.end(); ++_iter264)
{
xfer += (*_iter264).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("hasUnknownPartitions", ::apache::thrift::protocol::T_BOOL, 2);
xfer += oprot->writeBool(this->hasUnknownPartitions);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(PartitionsByExprResult &a, PartitionsByExprResult &b) {
using ::std::swap;
swap(a.partitions, b.partitions);
swap(a.hasUnknownPartitions, b.hasUnknownPartitions);
}
const char* PartitionsByExprRequest::ascii_fingerprint = "835944417A026FE6ABD0DF5A35BF52C5";
const uint8_t PartitionsByExprRequest::binary_fingerprint[16] = {0x83,0x59,0x44,0x41,0x7A,0x02,0x6F,0xE6,0xAB,0xD0,0xDF,0x5A,0x35,0xBF,0x52,0xC5};
uint32_t PartitionsByExprRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_dbName = false;
bool isset_tblName = false;
bool isset_expr = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->dbName);
isset_dbName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->tblName);
isset_tblName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readBinary(this->expr);
isset_expr = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->defaultPartitionName);
this->__isset.defaultPartitionName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_I16) {
xfer += iprot->readI16(this->maxParts);
this->__isset.maxParts = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_dbName)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_tblName)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_expr)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t PartitionsByExprRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("PartitionsByExprRequest");
xfer += oprot->writeFieldBegin("dbName", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->dbName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("tblName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->tblName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("expr", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeBinary(this->expr);
xfer += oprot->writeFieldEnd();
if (this->__isset.defaultPartitionName) {
xfer += oprot->writeFieldBegin("defaultPartitionName", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString(this->defaultPartitionName);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.maxParts) {
xfer += oprot->writeFieldBegin("maxParts", ::apache::thrift::protocol::T_I16, 5);
xfer += oprot->writeI16(this->maxParts);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(PartitionsByExprRequest &a, PartitionsByExprRequest &b) {
using ::std::swap;
swap(a.dbName, b.dbName);
swap(a.tblName, b.tblName);
swap(a.expr, b.expr);
swap(a.defaultPartitionName, b.defaultPartitionName);
swap(a.maxParts, b.maxParts);
swap(a.__isset, b.__isset);
}
const char* TableStatsResult::ascii_fingerprint = "CE3E8F0D9B310B8D33CB7A89A75F3E05";
const uint8_t TableStatsResult::binary_fingerprint[16] = {0xCE,0x3E,0x8F,0x0D,0x9B,0x31,0x0B,0x8D,0x33,0xCB,0x7A,0x89,0xA7,0x5F,0x3E,0x05};
uint32_t TableStatsResult::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_tableStats = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->tableStats.clear();
uint32_t _size265;
::apache::thrift::protocol::TType _etype268;
xfer += iprot->readListBegin(_etype268, _size265);
this->tableStats.resize(_size265);
uint32_t _i269;
for (_i269 = 0; _i269 < _size265; ++_i269)
{
xfer += this->tableStats[_i269].read(iprot);
}
xfer += iprot->readListEnd();
}
isset_tableStats = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_tableStats)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t TableStatsResult::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("TableStatsResult");
xfer += oprot->writeFieldBegin("tableStats", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->tableStats.size()));
std::vector<ColumnStatisticsObj> ::const_iterator _iter270;
for (_iter270 = this->tableStats.begin(); _iter270 != this->tableStats.end(); ++_iter270)
{
xfer += (*_iter270).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(TableStatsResult &a, TableStatsResult &b) {
using ::std::swap;
swap(a.tableStats, b.tableStats);
}
const char* PartitionsStatsResult::ascii_fingerprint = "FF175B50C5EF6F442D3AF25B06435A39";
const uint8_t PartitionsStatsResult::binary_fingerprint[16] = {0xFF,0x17,0x5B,0x50,0xC5,0xEF,0x6F,0x44,0x2D,0x3A,0xF2,0x5B,0x06,0x43,0x5A,0x39};
uint32_t PartitionsStatsResult::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_partStats = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_MAP) {
{
this->partStats.clear();
uint32_t _size271;
::apache::thrift::protocol::TType _ktype272;
::apache::thrift::protocol::TType _vtype273;
xfer += iprot->readMapBegin(_ktype272, _vtype273, _size271);
uint32_t _i275;
for (_i275 = 0; _i275 < _size271; ++_i275)
{
std::string _key276;
xfer += iprot->readString(_key276);
std::vector<ColumnStatisticsObj> & _val277 = this->partStats[_key276];
{
_val277.clear();
uint32_t _size278;
::apache::thrift::protocol::TType _etype281;
xfer += iprot->readListBegin(_etype281, _size278);
_val277.resize(_size278);
uint32_t _i282;
for (_i282 = 0; _i282 < _size278; ++_i282)
{
xfer += _val277[_i282].read(iprot);
}
xfer += iprot->readListEnd();
}
}
xfer += iprot->readMapEnd();
}
isset_partStats = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_partStats)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t PartitionsStatsResult::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("PartitionsStatsResult");
xfer += oprot->writeFieldBegin("partStats", ::apache::thrift::protocol::T_MAP, 1);
{
xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_LIST, static_cast<uint32_t>(this->partStats.size()));
std::map<std::string, std::vector<ColumnStatisticsObj> > ::const_iterator _iter283;
for (_iter283 = this->partStats.begin(); _iter283 != this->partStats.end(); ++_iter283)
{
xfer += oprot->writeString(_iter283->first);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(_iter283->second.size()));
std::vector<ColumnStatisticsObj> ::const_iterator _iter284;
for (_iter284 = _iter283->second.begin(); _iter284 != _iter283->second.end(); ++_iter284)
{
xfer += (*_iter284).write(oprot);
}
xfer += oprot->writeListEnd();
}
}
xfer += oprot->writeMapEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(PartitionsStatsResult &a, PartitionsStatsResult &b) {
using ::std::swap;
swap(a.partStats, b.partStats);
}
const char* TableStatsRequest::ascii_fingerprint = "8E2AD6401E83558ECFD6A13D74DD0A3F";
const uint8_t TableStatsRequest::binary_fingerprint[16] = {0x8E,0x2A,0xD6,0x40,0x1E,0x83,0x55,0x8E,0xCF,0xD6,0xA1,0x3D,0x74,0xDD,0x0A,0x3F};
uint32_t TableStatsRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_dbName = false;
bool isset_tblName = false;
bool isset_colNames = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->dbName);
isset_dbName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->tblName);
isset_tblName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->colNames.clear();
uint32_t _size285;
::apache::thrift::protocol::TType _etype288;
xfer += iprot->readListBegin(_etype288, _size285);
this->colNames.resize(_size285);
uint32_t _i289;
for (_i289 = 0; _i289 < _size285; ++_i289)
{
xfer += iprot->readString(this->colNames[_i289]);
}
xfer += iprot->readListEnd();
}
isset_colNames = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_dbName)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_tblName)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_colNames)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t TableStatsRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("TableStatsRequest");
xfer += oprot->writeFieldBegin("dbName", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->dbName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("tblName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->tblName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("colNames", ::apache::thrift::protocol::T_LIST, 3);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->colNames.size()));
std::vector<std::string> ::const_iterator _iter290;
for (_iter290 = this->colNames.begin(); _iter290 != this->colNames.end(); ++_iter290)
{
xfer += oprot->writeString((*_iter290));
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(TableStatsRequest &a, TableStatsRequest &b) {
using ::std::swap;
swap(a.dbName, b.dbName);
swap(a.tblName, b.tblName);
swap(a.colNames, b.colNames);
}
const char* PartitionsStatsRequest::ascii_fingerprint = "5F51D90BC323BCE4B704B7D98EDA0BD4";
const uint8_t PartitionsStatsRequest::binary_fingerprint[16] = {0x5F,0x51,0xD9,0x0B,0xC3,0x23,0xBC,0xE4,0xB7,0x04,0xB7,0xD9,0x8E,0xDA,0x0B,0xD4};
uint32_t PartitionsStatsRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_dbName = false;
bool isset_tblName = false;
bool isset_colNames = false;
bool isset_partNames = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->dbName);
isset_dbName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->tblName);
isset_tblName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->colNames.clear();
uint32_t _size291;
::apache::thrift::protocol::TType _etype294;
xfer += iprot->readListBegin(_etype294, _size291);
this->colNames.resize(_size291);
uint32_t _i295;
for (_i295 = 0; _i295 < _size291; ++_i295)
{
xfer += iprot->readString(this->colNames[_i295]);
}
xfer += iprot->readListEnd();
}
isset_colNames = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->partNames.clear();
uint32_t _size296;
::apache::thrift::protocol::TType _etype299;
xfer += iprot->readListBegin(_etype299, _size296);
this->partNames.resize(_size296);
uint32_t _i300;
for (_i300 = 0; _i300 < _size296; ++_i300)
{
xfer += iprot->readString(this->partNames[_i300]);
}
xfer += iprot->readListEnd();
}
isset_partNames = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_dbName)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_tblName)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_colNames)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_partNames)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t PartitionsStatsRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("PartitionsStatsRequest");
xfer += oprot->writeFieldBegin("dbName", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->dbName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("tblName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->tblName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("colNames", ::apache::thrift::protocol::T_LIST, 3);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->colNames.size()));
std::vector<std::string> ::const_iterator _iter301;
for (_iter301 = this->colNames.begin(); _iter301 != this->colNames.end(); ++_iter301)
{
xfer += oprot->writeString((*_iter301));
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("partNames", ::apache::thrift::protocol::T_LIST, 4);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->partNames.size()));
std::vector<std::string> ::const_iterator _iter302;
for (_iter302 = this->partNames.begin(); _iter302 != this->partNames.end(); ++_iter302)
{
xfer += oprot->writeString((*_iter302));
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(PartitionsStatsRequest &a, PartitionsStatsRequest &b) {
using ::std::swap;
swap(a.dbName, b.dbName);
swap(a.tblName, b.tblName);
swap(a.colNames, b.colNames);
swap(a.partNames, b.partNames);
}
const char* AddPartitionsResult::ascii_fingerprint = "5A689D0823E7BFBB60C799BA60065C31";
const uint8_t AddPartitionsResult::binary_fingerprint[16] = {0x5A,0x68,0x9D,0x08,0x23,0xE7,0xBF,0xBB,0x60,0xC7,0x99,0xBA,0x60,0x06,0x5C,0x31};
uint32_t AddPartitionsResult::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->partitions.clear();
uint32_t _size303;
::apache::thrift::protocol::TType _etype306;
xfer += iprot->readListBegin(_etype306, _size303);
this->partitions.resize(_size303);
uint32_t _i307;
for (_i307 = 0; _i307 < _size303; ++_i307)
{
xfer += this->partitions[_i307].read(iprot);
}
xfer += iprot->readListEnd();
}
this->__isset.partitions = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t AddPartitionsResult::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("AddPartitionsResult");
if (this->__isset.partitions) {
xfer += oprot->writeFieldBegin("partitions", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->partitions.size()));
std::vector<Partition> ::const_iterator _iter308;
for (_iter308 = this->partitions.begin(); _iter308 != this->partitions.end(); ++_iter308)
{
xfer += (*_iter308).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(AddPartitionsResult &a, AddPartitionsResult &b) {
using ::std::swap;
swap(a.partitions, b.partitions);
swap(a.__isset, b.__isset);
}
const char* AddPartitionsRequest::ascii_fingerprint = "94F938D035892CF6873DEDB99358F069";
const uint8_t AddPartitionsRequest::binary_fingerprint[16] = {0x94,0xF9,0x38,0xD0,0x35,0x89,0x2C,0xF6,0x87,0x3D,0xED,0xB9,0x93,0x58,0xF0,0x69};
uint32_t AddPartitionsRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_dbName = false;
bool isset_tblName = false;
bool isset_parts = false;
bool isset_ifNotExists = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->dbName);
isset_dbName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->tblName);
isset_tblName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->parts.clear();
uint32_t _size309;
::apache::thrift::protocol::TType _etype312;
xfer += iprot->readListBegin(_etype312, _size309);
this->parts.resize(_size309);
uint32_t _i313;
for (_i313 = 0; _i313 < _size309; ++_i313)
{
xfer += this->parts[_i313].read(iprot);
}
xfer += iprot->readListEnd();
}
isset_parts = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_BOOL) {
xfer += iprot->readBool(this->ifNotExists);
isset_ifNotExists = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_BOOL) {
xfer += iprot->readBool(this->needResult);
this->__isset.needResult = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_dbName)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_tblName)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_parts)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_ifNotExists)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t AddPartitionsRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("AddPartitionsRequest");
xfer += oprot->writeFieldBegin("dbName", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->dbName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("tblName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->tblName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("parts", ::apache::thrift::protocol::T_LIST, 3);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->parts.size()));
std::vector<Partition> ::const_iterator _iter314;
for (_iter314 = this->parts.begin(); _iter314 != this->parts.end(); ++_iter314)
{
xfer += (*_iter314).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("ifNotExists", ::apache::thrift::protocol::T_BOOL, 4);
xfer += oprot->writeBool(this->ifNotExists);
xfer += oprot->writeFieldEnd();
if (this->__isset.needResult) {
xfer += oprot->writeFieldBegin("needResult", ::apache::thrift::protocol::T_BOOL, 5);
xfer += oprot->writeBool(this->needResult);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(AddPartitionsRequest &a, AddPartitionsRequest &b) {
using ::std::swap;
swap(a.dbName, b.dbName);
swap(a.tblName, b.tblName);
swap(a.parts, b.parts);
swap(a.ifNotExists, b.ifNotExists);
swap(a.needResult, b.needResult);
swap(a.__isset, b.__isset);
}
const char* DropPartitionsResult::ascii_fingerprint = "5A689D0823E7BFBB60C799BA60065C31";
const uint8_t DropPartitionsResult::binary_fingerprint[16] = {0x5A,0x68,0x9D,0x08,0x23,0xE7,0xBF,0xBB,0x60,0xC7,0x99,0xBA,0x60,0x06,0x5C,0x31};
uint32_t DropPartitionsResult::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->partitions.clear();
uint32_t _size315;
::apache::thrift::protocol::TType _etype318;
xfer += iprot->readListBegin(_etype318, _size315);
this->partitions.resize(_size315);
uint32_t _i319;
for (_i319 = 0; _i319 < _size315; ++_i319)
{
xfer += this->partitions[_i319].read(iprot);
}
xfer += iprot->readListEnd();
}
this->__isset.partitions = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t DropPartitionsResult::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("DropPartitionsResult");
if (this->__isset.partitions) {
xfer += oprot->writeFieldBegin("partitions", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->partitions.size()));
std::vector<Partition> ::const_iterator _iter320;
for (_iter320 = this->partitions.begin(); _iter320 != this->partitions.end(); ++_iter320)
{
xfer += (*_iter320).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(DropPartitionsResult &a, DropPartitionsResult &b) {
using ::std::swap;
swap(a.partitions, b.partitions);
swap(a.__isset, b.__isset);
}
const char* DropPartitionsExpr::ascii_fingerprint = "18B162B1D15D8D46509D3911A9F1C2AA";
const uint8_t DropPartitionsExpr::binary_fingerprint[16] = {0x18,0xB1,0x62,0xB1,0xD1,0x5D,0x8D,0x46,0x50,0x9D,0x39,0x11,0xA9,0xF1,0xC2,0xAA};
uint32_t DropPartitionsExpr::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_expr = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readBinary(this->expr);
isset_expr = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->partArchiveLevel);
this->__isset.partArchiveLevel = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_expr)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t DropPartitionsExpr::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("DropPartitionsExpr");
xfer += oprot->writeFieldBegin("expr", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeBinary(this->expr);
xfer += oprot->writeFieldEnd();
if (this->__isset.partArchiveLevel) {
xfer += oprot->writeFieldBegin("partArchiveLevel", ::apache::thrift::protocol::T_I32, 2);
xfer += oprot->writeI32(this->partArchiveLevel);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(DropPartitionsExpr &a, DropPartitionsExpr &b) {
using ::std::swap;
swap(a.expr, b.expr);
swap(a.partArchiveLevel, b.partArchiveLevel);
swap(a.__isset, b.__isset);
}
const char* RequestPartsSpec::ascii_fingerprint = "864492ECAB27996CD222AACDA10C292E";
const uint8_t RequestPartsSpec::binary_fingerprint[16] = {0x86,0x44,0x92,0xEC,0xAB,0x27,0x99,0x6C,0xD2,0x22,0xAA,0xCD,0xA1,0x0C,0x29,0x2E};
uint32_t RequestPartsSpec::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->names.clear();
uint32_t _size321;
::apache::thrift::protocol::TType _etype324;
xfer += iprot->readListBegin(_etype324, _size321);
this->names.resize(_size321);
uint32_t _i325;
for (_i325 = 0; _i325 < _size321; ++_i325)
{
xfer += iprot->readString(this->names[_i325]);
}
xfer += iprot->readListEnd();
}
this->__isset.names = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->exprs.clear();
uint32_t _size326;
::apache::thrift::protocol::TType _etype329;
xfer += iprot->readListBegin(_etype329, _size326);
this->exprs.resize(_size326);
uint32_t _i330;
for (_i330 = 0; _i330 < _size326; ++_i330)
{
xfer += this->exprs[_i330].read(iprot);
}
xfer += iprot->readListEnd();
}
this->__isset.exprs = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t RequestPartsSpec::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("RequestPartsSpec");
xfer += oprot->writeFieldBegin("names", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->names.size()));
std::vector<std::string> ::const_iterator _iter331;
for (_iter331 = this->names.begin(); _iter331 != this->names.end(); ++_iter331)
{
xfer += oprot->writeString((*_iter331));
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("exprs", ::apache::thrift::protocol::T_LIST, 2);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->exprs.size()));
std::vector<DropPartitionsExpr> ::const_iterator _iter332;
for (_iter332 = this->exprs.begin(); _iter332 != this->exprs.end(); ++_iter332)
{
xfer += (*_iter332).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(RequestPartsSpec &a, RequestPartsSpec &b) {
using ::std::swap;
swap(a.names, b.names);
swap(a.exprs, b.exprs);
swap(a.__isset, b.__isset);
}
const char* DropPartitionsRequest::ascii_fingerprint = "EB263FBA01215C480A9A24C11D69E672";
const uint8_t DropPartitionsRequest::binary_fingerprint[16] = {0xEB,0x26,0x3F,0xBA,0x01,0x21,0x5C,0x48,0x0A,0x9A,0x24,0xC1,0x1D,0x69,0xE6,0x72};
uint32_t DropPartitionsRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_dbName = false;
bool isset_tblName = false;
bool isset_parts = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->dbName);
isset_dbName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->tblName);
isset_tblName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->parts.read(iprot);
isset_parts = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_BOOL) {
xfer += iprot->readBool(this->deleteData);
this->__isset.deleteData = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_BOOL) {
xfer += iprot->readBool(this->ifExists);
this->__isset.ifExists = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_BOOL) {
xfer += iprot->readBool(this->ignoreProtection);
this->__isset.ignoreProtection = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->environmentContext.read(iprot);
this->__isset.environmentContext = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 8:
if (ftype == ::apache::thrift::protocol::T_BOOL) {
xfer += iprot->readBool(this->needResult);
this->__isset.needResult = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_dbName)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_tblName)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_parts)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t DropPartitionsRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("DropPartitionsRequest");
xfer += oprot->writeFieldBegin("dbName", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->dbName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("tblName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->tblName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("parts", ::apache::thrift::protocol::T_STRUCT, 3);
xfer += this->parts.write(oprot);
xfer += oprot->writeFieldEnd();
if (this->__isset.deleteData) {
xfer += oprot->writeFieldBegin("deleteData", ::apache::thrift::protocol::T_BOOL, 4);
xfer += oprot->writeBool(this->deleteData);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.ifExists) {
xfer += oprot->writeFieldBegin("ifExists", ::apache::thrift::protocol::T_BOOL, 5);
xfer += oprot->writeBool(this->ifExists);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.ignoreProtection) {
xfer += oprot->writeFieldBegin("ignoreProtection", ::apache::thrift::protocol::T_BOOL, 6);
xfer += oprot->writeBool(this->ignoreProtection);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.environmentContext) {
xfer += oprot->writeFieldBegin("environmentContext", ::apache::thrift::protocol::T_STRUCT, 7);
xfer += this->environmentContext.write(oprot);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.needResult) {
xfer += oprot->writeFieldBegin("needResult", ::apache::thrift::protocol::T_BOOL, 8);
xfer += oprot->writeBool(this->needResult);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(DropPartitionsRequest &a, DropPartitionsRequest &b) {
using ::std::swap;
swap(a.dbName, b.dbName);
swap(a.tblName, b.tblName);
swap(a.parts, b.parts);
swap(a.deleteData, b.deleteData);
swap(a.ifExists, b.ifExists);
swap(a.ignoreProtection, b.ignoreProtection);
swap(a.environmentContext, b.environmentContext);
swap(a.needResult, b.needResult);
swap(a.__isset, b.__isset);
}
const char* ResourceUri::ascii_fingerprint = "19B5240589E680301A7E32DF3971EFBE";
const uint8_t ResourceUri::binary_fingerprint[16] = {0x19,0xB5,0x24,0x05,0x89,0xE6,0x80,0x30,0x1A,0x7E,0x32,0xDF,0x39,0x71,0xEF,0xBE};
uint32_t ResourceUri::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast333;
xfer += iprot->readI32(ecast333);
this->resourceType = (ResourceType::type)ecast333;
this->__isset.resourceType = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->uri);
this->__isset.uri = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t ResourceUri::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("ResourceUri");
xfer += oprot->writeFieldBegin("resourceType", ::apache::thrift::protocol::T_I32, 1);
xfer += oprot->writeI32((int32_t)this->resourceType);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("uri", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->uri);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(ResourceUri &a, ResourceUri &b) {
using ::std::swap;
swap(a.resourceType, b.resourceType);
swap(a.uri, b.uri);
swap(a.__isset, b.__isset);
}
const char* Function::ascii_fingerprint = "72279C515E70F888568542F97616ADB8";
const uint8_t Function::binary_fingerprint[16] = {0x72,0x27,0x9C,0x51,0x5E,0x70,0xF8,0x88,0x56,0x85,0x42,0xF9,0x76,0x16,0xAD,0xB8};
uint32_t Function::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->functionName);
this->__isset.functionName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->dbName);
this->__isset.dbName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->className);
this->__isset.className = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->ownerName);
this->__isset.ownerName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast334;
xfer += iprot->readI32(ecast334);
this->ownerType = (PrincipalType::type)ecast334;
this->__isset.ownerType = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->createTime);
this->__isset.createTime = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast335;
xfer += iprot->readI32(ecast335);
this->functionType = (FunctionType::type)ecast335;
this->__isset.functionType = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 8:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->resourceUris.clear();
uint32_t _size336;
::apache::thrift::protocol::TType _etype339;
xfer += iprot->readListBegin(_etype339, _size336);
this->resourceUris.resize(_size336);
uint32_t _i340;
for (_i340 = 0; _i340 < _size336; ++_i340)
{
xfer += this->resourceUris[_i340].read(iprot);
}
xfer += iprot->readListEnd();
}
this->__isset.resourceUris = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t Function::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("Function");
xfer += oprot->writeFieldBegin("functionName", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->functionName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("dbName", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->dbName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("className", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->className);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("ownerName", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString(this->ownerName);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("ownerType", ::apache::thrift::protocol::T_I32, 5);
xfer += oprot->writeI32((int32_t)this->ownerType);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("createTime", ::apache::thrift::protocol::T_I32, 6);
xfer += oprot->writeI32(this->createTime);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("functionType", ::apache::thrift::protocol::T_I32, 7);
xfer += oprot->writeI32((int32_t)this->functionType);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("resourceUris", ::apache::thrift::protocol::T_LIST, 8);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->resourceUris.size()));
std::vector<ResourceUri> ::const_iterator _iter341;
for (_iter341 = this->resourceUris.begin(); _iter341 != this->resourceUris.end(); ++_iter341)
{
xfer += (*_iter341).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(Function &a, Function &b) {
using ::std::swap;
swap(a.functionName, b.functionName);
swap(a.dbName, b.dbName);
swap(a.className, b.className);
swap(a.ownerName, b.ownerName);
swap(a.ownerType, b.ownerType);
swap(a.createTime, b.createTime);
swap(a.functionType, b.functionType);
swap(a.resourceUris, b.resourceUris);
swap(a.__isset, b.__isset);
}
const char* TxnInfo::ascii_fingerprint = "6C5C0773A901CCA3BE9D085B3B47A767";
const uint8_t TxnInfo::binary_fingerprint[16] = {0x6C,0x5C,0x07,0x73,0xA9,0x01,0xCC,0xA3,0xBE,0x9D,0x08,0x5B,0x3B,0x47,0xA7,0x67};
uint32_t TxnInfo::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_id = false;
bool isset_state = false;
bool isset_user = false;
bool isset_hostname = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->id);
isset_id = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast342;
xfer += iprot->readI32(ecast342);
this->state = (TxnState::type)ecast342;
isset_state = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->user);
isset_user = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->hostname);
isset_hostname = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_id)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_state)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_user)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_hostname)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t TxnInfo::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("TxnInfo");
xfer += oprot->writeFieldBegin("id", ::apache::thrift::protocol::T_I64, 1);
xfer += oprot->writeI64(this->id);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("state", ::apache::thrift::protocol::T_I32, 2);
xfer += oprot->writeI32((int32_t)this->state);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("user", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->user);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("hostname", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString(this->hostname);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(TxnInfo &a, TxnInfo &b) {
using ::std::swap;
swap(a.id, b.id);
swap(a.state, b.state);
swap(a.user, b.user);
swap(a.hostname, b.hostname);
}
const char* GetOpenTxnsInfoResponse::ascii_fingerprint = "CCF769BBD33005B61F2079A6665E3B9C";
const uint8_t GetOpenTxnsInfoResponse::binary_fingerprint[16] = {0xCC,0xF7,0x69,0xBB,0xD3,0x30,0x05,0xB6,0x1F,0x20,0x79,0xA6,0x66,0x5E,0x3B,0x9C};
uint32_t GetOpenTxnsInfoResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_txn_high_water_mark = false;
bool isset_open_txns = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->txn_high_water_mark);
isset_txn_high_water_mark = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->open_txns.clear();
uint32_t _size343;
::apache::thrift::protocol::TType _etype346;
xfer += iprot->readListBegin(_etype346, _size343);
this->open_txns.resize(_size343);
uint32_t _i347;
for (_i347 = 0; _i347 < _size343; ++_i347)
{
xfer += this->open_txns[_i347].read(iprot);
}
xfer += iprot->readListEnd();
}
isset_open_txns = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_txn_high_water_mark)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_open_txns)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t GetOpenTxnsInfoResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("GetOpenTxnsInfoResponse");
xfer += oprot->writeFieldBegin("txn_high_water_mark", ::apache::thrift::protocol::T_I64, 1);
xfer += oprot->writeI64(this->txn_high_water_mark);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("open_txns", ::apache::thrift::protocol::T_LIST, 2);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->open_txns.size()));
std::vector<TxnInfo> ::const_iterator _iter348;
for (_iter348 = this->open_txns.begin(); _iter348 != this->open_txns.end(); ++_iter348)
{
xfer += (*_iter348).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(GetOpenTxnsInfoResponse &a, GetOpenTxnsInfoResponse &b) {
using ::std::swap;
swap(a.txn_high_water_mark, b.txn_high_water_mark);
swap(a.open_txns, b.open_txns);
}
const char* GetOpenTxnsResponse::ascii_fingerprint = "590531FF1BE8611678B255374F6109EE";
const uint8_t GetOpenTxnsResponse::binary_fingerprint[16] = {0x59,0x05,0x31,0xFF,0x1B,0xE8,0x61,0x16,0x78,0xB2,0x55,0x37,0x4F,0x61,0x09,0xEE};
uint32_t GetOpenTxnsResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_txn_high_water_mark = false;
bool isset_open_txns = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->txn_high_water_mark);
isset_txn_high_water_mark = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_SET) {
{
this->open_txns.clear();
uint32_t _size349;
::apache::thrift::protocol::TType _etype352;
xfer += iprot->readSetBegin(_etype352, _size349);
uint32_t _i353;
for (_i353 = 0; _i353 < _size349; ++_i353)
{
int64_t _elem354;
xfer += iprot->readI64(_elem354);
this->open_txns.insert(_elem354);
}
xfer += iprot->readSetEnd();
}
isset_open_txns = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_txn_high_water_mark)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_open_txns)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t GetOpenTxnsResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("GetOpenTxnsResponse");
xfer += oprot->writeFieldBegin("txn_high_water_mark", ::apache::thrift::protocol::T_I64, 1);
xfer += oprot->writeI64(this->txn_high_water_mark);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("open_txns", ::apache::thrift::protocol::T_SET, 2);
{
xfer += oprot->writeSetBegin(::apache::thrift::protocol::T_I64, static_cast<uint32_t>(this->open_txns.size()));
std::set<int64_t> ::const_iterator _iter355;
for (_iter355 = this->open_txns.begin(); _iter355 != this->open_txns.end(); ++_iter355)
{
xfer += oprot->writeI64((*_iter355));
}
xfer += oprot->writeSetEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(GetOpenTxnsResponse &a, GetOpenTxnsResponse &b) {
using ::std::swap;
swap(a.txn_high_water_mark, b.txn_high_water_mark);
swap(a.open_txns, b.open_txns);
}
const char* OpenTxnRequest::ascii_fingerprint = "3368C2F81F2FEF71F11EDACDB2A3ECEF";
const uint8_t OpenTxnRequest::binary_fingerprint[16] = {0x33,0x68,0xC2,0xF8,0x1F,0x2F,0xEF,0x71,0xF1,0x1E,0xDA,0xCD,0xB2,0xA3,0xEC,0xEF};
uint32_t OpenTxnRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_num_txns = false;
bool isset_user = false;
bool isset_hostname = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->num_txns);
isset_num_txns = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->user);
isset_user = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->hostname);
isset_hostname = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_num_txns)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_user)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_hostname)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t OpenTxnRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("OpenTxnRequest");
xfer += oprot->writeFieldBegin("num_txns", ::apache::thrift::protocol::T_I32, 1);
xfer += oprot->writeI32(this->num_txns);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("user", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->user);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("hostname", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->hostname);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(OpenTxnRequest &a, OpenTxnRequest &b) {
using ::std::swap;
swap(a.num_txns, b.num_txns);
swap(a.user, b.user);
swap(a.hostname, b.hostname);
}
const char* OpenTxnsResponse::ascii_fingerprint = "E49D7D1A9013CC81CD0F69D631EF82E4";
const uint8_t OpenTxnsResponse::binary_fingerprint[16] = {0xE4,0x9D,0x7D,0x1A,0x90,0x13,0xCC,0x81,0xCD,0x0F,0x69,0xD6,0x31,0xEF,0x82,0xE4};
uint32_t OpenTxnsResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_txn_ids = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->txn_ids.clear();
uint32_t _size356;
::apache::thrift::protocol::TType _etype359;
xfer += iprot->readListBegin(_etype359, _size356);
this->txn_ids.resize(_size356);
uint32_t _i360;
for (_i360 = 0; _i360 < _size356; ++_i360)
{
xfer += iprot->readI64(this->txn_ids[_i360]);
}
xfer += iprot->readListEnd();
}
isset_txn_ids = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_txn_ids)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t OpenTxnsResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("OpenTxnsResponse");
xfer += oprot->writeFieldBegin("txn_ids", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I64, static_cast<uint32_t>(this->txn_ids.size()));
std::vector<int64_t> ::const_iterator _iter361;
for (_iter361 = this->txn_ids.begin(); _iter361 != this->txn_ids.end(); ++_iter361)
{
xfer += oprot->writeI64((*_iter361));
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(OpenTxnsResponse &a, OpenTxnsResponse &b) {
using ::std::swap;
swap(a.txn_ids, b.txn_ids);
}
const char* AbortTxnRequest::ascii_fingerprint = "56A59CE7FFAF82BCA8A19FAACDE4FB75";
const uint8_t AbortTxnRequest::binary_fingerprint[16] = {0x56,0xA5,0x9C,0xE7,0xFF,0xAF,0x82,0xBC,0xA8,0xA1,0x9F,0xAA,0xCD,0xE4,0xFB,0x75};
uint32_t AbortTxnRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_txnid = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->txnid);
isset_txnid = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_txnid)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t AbortTxnRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("AbortTxnRequest");
xfer += oprot->writeFieldBegin("txnid", ::apache::thrift::protocol::T_I64, 1);
xfer += oprot->writeI64(this->txnid);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(AbortTxnRequest &a, AbortTxnRequest &b) {
using ::std::swap;
swap(a.txnid, b.txnid);
}
const char* CommitTxnRequest::ascii_fingerprint = "56A59CE7FFAF82BCA8A19FAACDE4FB75";
const uint8_t CommitTxnRequest::binary_fingerprint[16] = {0x56,0xA5,0x9C,0xE7,0xFF,0xAF,0x82,0xBC,0xA8,0xA1,0x9F,0xAA,0xCD,0xE4,0xFB,0x75};
uint32_t CommitTxnRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_txnid = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->txnid);
isset_txnid = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_txnid)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t CommitTxnRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("CommitTxnRequest");
xfer += oprot->writeFieldBegin("txnid", ::apache::thrift::protocol::T_I64, 1);
xfer += oprot->writeI64(this->txnid);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(CommitTxnRequest &a, CommitTxnRequest &b) {
using ::std::swap;
swap(a.txnid, b.txnid);
}
const char* LockComponent::ascii_fingerprint = "38B02531B0840AC9C72904A4649FD15F";
const uint8_t LockComponent::binary_fingerprint[16] = {0x38,0xB0,0x25,0x31,0xB0,0x84,0x0A,0xC9,0xC7,0x29,0x04,0xA4,0x64,0x9F,0xD1,0x5F};
uint32_t LockComponent::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_type = false;
bool isset_level = false;
bool isset_dbname = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast362;
xfer += iprot->readI32(ecast362);
this->type = (LockType::type)ecast362;
isset_type = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast363;
xfer += iprot->readI32(ecast363);
this->level = (LockLevel::type)ecast363;
isset_level = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->dbname);
isset_dbname = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->tablename);
this->__isset.tablename = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->partitionname);
this->__isset.partitionname = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_type)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_level)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_dbname)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t LockComponent::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("LockComponent");
xfer += oprot->writeFieldBegin("type", ::apache::thrift::protocol::T_I32, 1);
xfer += oprot->writeI32((int32_t)this->type);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("level", ::apache::thrift::protocol::T_I32, 2);
xfer += oprot->writeI32((int32_t)this->level);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("dbname", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->dbname);
xfer += oprot->writeFieldEnd();
if (this->__isset.tablename) {
xfer += oprot->writeFieldBegin("tablename", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString(this->tablename);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.partitionname) {
xfer += oprot->writeFieldBegin("partitionname", ::apache::thrift::protocol::T_STRING, 5);
xfer += oprot->writeString(this->partitionname);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(LockComponent &a, LockComponent &b) {
using ::std::swap;
swap(a.type, b.type);
swap(a.level, b.level);
swap(a.dbname, b.dbname);
swap(a.tablename, b.tablename);
swap(a.partitionname, b.partitionname);
swap(a.__isset, b.__isset);
}
const char* LockRequest::ascii_fingerprint = "46BC5ED7196BC16CB216AD5CC67C6930";
const uint8_t LockRequest::binary_fingerprint[16] = {0x46,0xBC,0x5E,0xD7,0x19,0x6B,0xC1,0x6C,0xB2,0x16,0xAD,0x5C,0xC6,0x7C,0x69,0x30};
uint32_t LockRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_component = false;
bool isset_user = false;
bool isset_hostname = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->component.clear();
uint32_t _size364;
::apache::thrift::protocol::TType _etype367;
xfer += iprot->readListBegin(_etype367, _size364);
this->component.resize(_size364);
uint32_t _i368;
for (_i368 = 0; _i368 < _size364; ++_i368)
{
xfer += this->component[_i368].read(iprot);
}
xfer += iprot->readListEnd();
}
isset_component = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->txnid);
this->__isset.txnid = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->user);
isset_user = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->hostname);
isset_hostname = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_component)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_user)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_hostname)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t LockRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("LockRequest");
xfer += oprot->writeFieldBegin("component", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->component.size()));
std::vector<LockComponent> ::const_iterator _iter369;
for (_iter369 = this->component.begin(); _iter369 != this->component.end(); ++_iter369)
{
xfer += (*_iter369).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
if (this->__isset.txnid) {
xfer += oprot->writeFieldBegin("txnid", ::apache::thrift::protocol::T_I64, 2);
xfer += oprot->writeI64(this->txnid);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldBegin("user", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->user);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("hostname", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString(this->hostname);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(LockRequest &a, LockRequest &b) {
using ::std::swap;
swap(a.component, b.component);
swap(a.txnid, b.txnid);
swap(a.user, b.user);
swap(a.hostname, b.hostname);
swap(a.__isset, b.__isset);
}
const char* LockResponse::ascii_fingerprint = "DFA40D9D2884599F3D1E7A57578F1384";
const uint8_t LockResponse::binary_fingerprint[16] = {0xDF,0xA4,0x0D,0x9D,0x28,0x84,0x59,0x9F,0x3D,0x1E,0x7A,0x57,0x57,0x8F,0x13,0x84};
uint32_t LockResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_lockid = false;
bool isset_state = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->lockid);
isset_lockid = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast370;
xfer += iprot->readI32(ecast370);
this->state = (LockState::type)ecast370;
isset_state = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_lockid)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_state)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t LockResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("LockResponse");
xfer += oprot->writeFieldBegin("lockid", ::apache::thrift::protocol::T_I64, 1);
xfer += oprot->writeI64(this->lockid);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("state", ::apache::thrift::protocol::T_I32, 2);
xfer += oprot->writeI32((int32_t)this->state);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(LockResponse &a, LockResponse &b) {
using ::std::swap;
swap(a.lockid, b.lockid);
swap(a.state, b.state);
}
const char* CheckLockRequest::ascii_fingerprint = "56A59CE7FFAF82BCA8A19FAACDE4FB75";
const uint8_t CheckLockRequest::binary_fingerprint[16] = {0x56,0xA5,0x9C,0xE7,0xFF,0xAF,0x82,0xBC,0xA8,0xA1,0x9F,0xAA,0xCD,0xE4,0xFB,0x75};
uint32_t CheckLockRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_lockid = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->lockid);
isset_lockid = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_lockid)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t CheckLockRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("CheckLockRequest");
xfer += oprot->writeFieldBegin("lockid", ::apache::thrift::protocol::T_I64, 1);
xfer += oprot->writeI64(this->lockid);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(CheckLockRequest &a, CheckLockRequest &b) {
using ::std::swap;
swap(a.lockid, b.lockid);
}
const char* UnlockRequest::ascii_fingerprint = "56A59CE7FFAF82BCA8A19FAACDE4FB75";
const uint8_t UnlockRequest::binary_fingerprint[16] = {0x56,0xA5,0x9C,0xE7,0xFF,0xAF,0x82,0xBC,0xA8,0xA1,0x9F,0xAA,0xCD,0xE4,0xFB,0x75};
uint32_t UnlockRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_lockid = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->lockid);
isset_lockid = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_lockid)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t UnlockRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("UnlockRequest");
xfer += oprot->writeFieldBegin("lockid", ::apache::thrift::protocol::T_I64, 1);
xfer += oprot->writeI64(this->lockid);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(UnlockRequest &a, UnlockRequest &b) {
using ::std::swap;
swap(a.lockid, b.lockid);
}
const char* ShowLocksRequest::ascii_fingerprint = "99914B932BD37A50B983C5E7C90AE93B";
const uint8_t ShowLocksRequest::binary_fingerprint[16] = {0x99,0x91,0x4B,0x93,0x2B,0xD3,0x7A,0x50,0xB9,0x83,0xC5,0xE7,0xC9,0x0A,0xE9,0x3B};
uint32_t ShowLocksRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
xfer += iprot->skip(ftype);
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t ShowLocksRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("ShowLocksRequest");
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(ShowLocksRequest &a, ShowLocksRequest &b) {
using ::std::swap;
(void) a;
(void) b;
}
const char* ShowLocksResponseElement::ascii_fingerprint = "5AD11F0E0EF1EE0A7C08B00FEFCFF24F";
const uint8_t ShowLocksResponseElement::binary_fingerprint[16] = {0x5A,0xD1,0x1F,0x0E,0x0E,0xF1,0xEE,0x0A,0x7C,0x08,0xB0,0x0F,0xEF,0xCF,0xF2,0x4F};
uint32_t ShowLocksResponseElement::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_lockid = false;
bool isset_dbname = false;
bool isset_state = false;
bool isset_type = false;
bool isset_lastheartbeat = false;
bool isset_user = false;
bool isset_hostname = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->lockid);
isset_lockid = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->dbname);
isset_dbname = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->tablename);
this->__isset.tablename = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->partname);
this->__isset.partname = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast371;
xfer += iprot->readI32(ecast371);
this->state = (LockState::type)ecast371;
isset_state = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast372;
xfer += iprot->readI32(ecast372);
this->type = (LockType::type)ecast372;
isset_type = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->txnid);
this->__isset.txnid = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 8:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->lastheartbeat);
isset_lastheartbeat = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 9:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->acquiredat);
this->__isset.acquiredat = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 10:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->user);
isset_user = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 11:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->hostname);
isset_hostname = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_lockid)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_dbname)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_state)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_type)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_lastheartbeat)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_user)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_hostname)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t ShowLocksResponseElement::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("ShowLocksResponseElement");
xfer += oprot->writeFieldBegin("lockid", ::apache::thrift::protocol::T_I64, 1);
xfer += oprot->writeI64(this->lockid);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("dbname", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->dbname);
xfer += oprot->writeFieldEnd();
if (this->__isset.tablename) {
xfer += oprot->writeFieldBegin("tablename", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->tablename);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.partname) {
xfer += oprot->writeFieldBegin("partname", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString(this->partname);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldBegin("state", ::apache::thrift::protocol::T_I32, 5);
xfer += oprot->writeI32((int32_t)this->state);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("type", ::apache::thrift::protocol::T_I32, 6);
xfer += oprot->writeI32((int32_t)this->type);
xfer += oprot->writeFieldEnd();
if (this->__isset.txnid) {
xfer += oprot->writeFieldBegin("txnid", ::apache::thrift::protocol::T_I64, 7);
xfer += oprot->writeI64(this->txnid);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldBegin("lastheartbeat", ::apache::thrift::protocol::T_I64, 8);
xfer += oprot->writeI64(this->lastheartbeat);
xfer += oprot->writeFieldEnd();
if (this->__isset.acquiredat) {
xfer += oprot->writeFieldBegin("acquiredat", ::apache::thrift::protocol::T_I64, 9);
xfer += oprot->writeI64(this->acquiredat);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldBegin("user", ::apache::thrift::protocol::T_STRING, 10);
xfer += oprot->writeString(this->user);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("hostname", ::apache::thrift::protocol::T_STRING, 11);
xfer += oprot->writeString(this->hostname);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(ShowLocksResponseElement &a, ShowLocksResponseElement &b) {
using ::std::swap;
swap(a.lockid, b.lockid);
swap(a.dbname, b.dbname);
swap(a.tablename, b.tablename);
swap(a.partname, b.partname);
swap(a.state, b.state);
swap(a.type, b.type);
swap(a.txnid, b.txnid);
swap(a.lastheartbeat, b.lastheartbeat);
swap(a.acquiredat, b.acquiredat);
swap(a.user, b.user);
swap(a.hostname, b.hostname);
swap(a.__isset, b.__isset);
}
const char* ShowLocksResponse::ascii_fingerprint = "BD598AA60FE941361FB54C43973C011F";
const uint8_t ShowLocksResponse::binary_fingerprint[16] = {0xBD,0x59,0x8A,0xA6,0x0F,0xE9,0x41,0x36,0x1F,0xB5,0x4C,0x43,0x97,0x3C,0x01,0x1F};
uint32_t ShowLocksResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->locks.clear();
uint32_t _size373;
::apache::thrift::protocol::TType _etype376;
xfer += iprot->readListBegin(_etype376, _size373);
this->locks.resize(_size373);
uint32_t _i377;
for (_i377 = 0; _i377 < _size373; ++_i377)
{
xfer += this->locks[_i377].read(iprot);
}
xfer += iprot->readListEnd();
}
this->__isset.locks = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t ShowLocksResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("ShowLocksResponse");
xfer += oprot->writeFieldBegin("locks", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->locks.size()));
std::vector<ShowLocksResponseElement> ::const_iterator _iter378;
for (_iter378 = this->locks.begin(); _iter378 != this->locks.end(); ++_iter378)
{
xfer += (*_iter378).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(ShowLocksResponse &a, ShowLocksResponse &b) {
using ::std::swap;
swap(a.locks, b.locks);
swap(a.__isset, b.__isset);
}
const char* HeartbeatRequest::ascii_fingerprint = "0354D07C94CB8542872CA1277008860A";
const uint8_t HeartbeatRequest::binary_fingerprint[16] = {0x03,0x54,0xD0,0x7C,0x94,0xCB,0x85,0x42,0x87,0x2C,0xA1,0x27,0x70,0x08,0x86,0x0A};
uint32_t HeartbeatRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->lockid);
this->__isset.lockid = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->txnid);
this->__isset.txnid = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t HeartbeatRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("HeartbeatRequest");
if (this->__isset.lockid) {
xfer += oprot->writeFieldBegin("lockid", ::apache::thrift::protocol::T_I64, 1);
xfer += oprot->writeI64(this->lockid);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.txnid) {
xfer += oprot->writeFieldBegin("txnid", ::apache::thrift::protocol::T_I64, 2);
xfer += oprot->writeI64(this->txnid);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(HeartbeatRequest &a, HeartbeatRequest &b) {
using ::std::swap;
swap(a.lockid, b.lockid);
swap(a.txnid, b.txnid);
swap(a.__isset, b.__isset);
}
const char* HeartbeatTxnRangeRequest::ascii_fingerprint = "F33135321253DAEB67B0E79E416CA831";
const uint8_t HeartbeatTxnRangeRequest::binary_fingerprint[16] = {0xF3,0x31,0x35,0x32,0x12,0x53,0xDA,0xEB,0x67,0xB0,0xE7,0x9E,0x41,0x6C,0xA8,0x31};
uint32_t HeartbeatTxnRangeRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_min = false;
bool isset_max = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->min);
isset_min = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->max);
isset_max = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_min)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_max)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t HeartbeatTxnRangeRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("HeartbeatTxnRangeRequest");
xfer += oprot->writeFieldBegin("min", ::apache::thrift::protocol::T_I64, 1);
xfer += oprot->writeI64(this->min);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("max", ::apache::thrift::protocol::T_I64, 2);
xfer += oprot->writeI64(this->max);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(HeartbeatTxnRangeRequest &a, HeartbeatTxnRangeRequest &b) {
using ::std::swap;
swap(a.min, b.min);
swap(a.max, b.max);
}
const char* HeartbeatTxnRangeResponse::ascii_fingerprint = "33E49A70BD5C04262A0F407E3656E3CF";
const uint8_t HeartbeatTxnRangeResponse::binary_fingerprint[16] = {0x33,0xE4,0x9A,0x70,0xBD,0x5C,0x04,0x26,0x2A,0x0F,0x40,0x7E,0x36,0x56,0xE3,0xCF};
uint32_t HeartbeatTxnRangeResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_aborted = false;
bool isset_nosuch = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_SET) {
{
this->aborted.clear();
uint32_t _size379;
::apache::thrift::protocol::TType _etype382;
xfer += iprot->readSetBegin(_etype382, _size379);
uint32_t _i383;
for (_i383 = 0; _i383 < _size379; ++_i383)
{
int64_t _elem384;
xfer += iprot->readI64(_elem384);
this->aborted.insert(_elem384);
}
xfer += iprot->readSetEnd();
}
isset_aborted = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_SET) {
{
this->nosuch.clear();
uint32_t _size385;
::apache::thrift::protocol::TType _etype388;
xfer += iprot->readSetBegin(_etype388, _size385);
uint32_t _i389;
for (_i389 = 0; _i389 < _size385; ++_i389)
{
int64_t _elem390;
xfer += iprot->readI64(_elem390);
this->nosuch.insert(_elem390);
}
xfer += iprot->readSetEnd();
}
isset_nosuch = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_aborted)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_nosuch)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t HeartbeatTxnRangeResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("HeartbeatTxnRangeResponse");
xfer += oprot->writeFieldBegin("aborted", ::apache::thrift::protocol::T_SET, 1);
{
xfer += oprot->writeSetBegin(::apache::thrift::protocol::T_I64, static_cast<uint32_t>(this->aborted.size()));
std::set<int64_t> ::const_iterator _iter391;
for (_iter391 = this->aborted.begin(); _iter391 != this->aborted.end(); ++_iter391)
{
xfer += oprot->writeI64((*_iter391));
}
xfer += oprot->writeSetEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("nosuch", ::apache::thrift::protocol::T_SET, 2);
{
xfer += oprot->writeSetBegin(::apache::thrift::protocol::T_I64, static_cast<uint32_t>(this->nosuch.size()));
std::set<int64_t> ::const_iterator _iter392;
for (_iter392 = this->nosuch.begin(); _iter392 != this->nosuch.end(); ++_iter392)
{
xfer += oprot->writeI64((*_iter392));
}
xfer += oprot->writeSetEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(HeartbeatTxnRangeResponse &a, HeartbeatTxnRangeResponse &b) {
using ::std::swap;
swap(a.aborted, b.aborted);
swap(a.nosuch, b.nosuch);
}
const char* CompactionRequest::ascii_fingerprint = "899FD1F339D8318D628687CC2CE2864B";
const uint8_t CompactionRequest::binary_fingerprint[16] = {0x89,0x9F,0xD1,0xF3,0x39,0xD8,0x31,0x8D,0x62,0x86,0x87,0xCC,0x2C,0xE2,0x86,0x4B};
uint32_t CompactionRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_dbname = false;
bool isset_tablename = false;
bool isset_type = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->dbname);
isset_dbname = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->tablename);
isset_tablename = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->partitionname);
this->__isset.partitionname = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast393;
xfer += iprot->readI32(ecast393);
this->type = (CompactionType::type)ecast393;
isset_type = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->runas);
this->__isset.runas = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_dbname)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_tablename)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_type)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t CompactionRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("CompactionRequest");
xfer += oprot->writeFieldBegin("dbname", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->dbname);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("tablename", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->tablename);
xfer += oprot->writeFieldEnd();
if (this->__isset.partitionname) {
xfer += oprot->writeFieldBegin("partitionname", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->partitionname);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldBegin("type", ::apache::thrift::protocol::T_I32, 4);
xfer += oprot->writeI32((int32_t)this->type);
xfer += oprot->writeFieldEnd();
if (this->__isset.runas) {
xfer += oprot->writeFieldBegin("runas", ::apache::thrift::protocol::T_STRING, 5);
xfer += oprot->writeString(this->runas);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(CompactionRequest &a, CompactionRequest &b) {
using ::std::swap;
swap(a.dbname, b.dbname);
swap(a.tablename, b.tablename);
swap(a.partitionname, b.partitionname);
swap(a.type, b.type);
swap(a.runas, b.runas);
swap(a.__isset, b.__isset);
}
const char* ShowCompactRequest::ascii_fingerprint = "99914B932BD37A50B983C5E7C90AE93B";
const uint8_t ShowCompactRequest::binary_fingerprint[16] = {0x99,0x91,0x4B,0x93,0x2B,0xD3,0x7A,0x50,0xB9,0x83,0xC5,0xE7,0xC9,0x0A,0xE9,0x3B};
uint32_t ShowCompactRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
xfer += iprot->skip(ftype);
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t ShowCompactRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("ShowCompactRequest");
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(ShowCompactRequest &a, ShowCompactRequest &b) {
using ::std::swap;
(void) a;
(void) b;
}
const char* ShowCompactResponseElement::ascii_fingerprint = "2F338C265DC4FD82DD13F4966FE43F13";
const uint8_t ShowCompactResponseElement::binary_fingerprint[16] = {0x2F,0x33,0x8C,0x26,0x5D,0xC4,0xFD,0x82,0xDD,0x13,0xF4,0x96,0x6F,0xE4,0x3F,0x13};
uint32_t ShowCompactResponseElement::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_dbname = false;
bool isset_tablename = false;
bool isset_type = false;
bool isset_state = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->dbname);
isset_dbname = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->tablename);
isset_tablename = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->partitionname);
this->__isset.partitionname = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_I32) {
int32_t ecast394;
xfer += iprot->readI32(ecast394);
this->type = (CompactionType::type)ecast394;
isset_type = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->state);
isset_state = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->workerid);
this->__isset.workerid = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 7:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->start);
this->__isset.start = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 8:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->runAs);
this->__isset.runAs = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_dbname)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_tablename)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_type)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_state)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t ShowCompactResponseElement::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("ShowCompactResponseElement");
xfer += oprot->writeFieldBegin("dbname", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->dbname);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("tablename", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->tablename);
xfer += oprot->writeFieldEnd();
if (this->__isset.partitionname) {
xfer += oprot->writeFieldBegin("partitionname", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->partitionname);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldBegin("type", ::apache::thrift::protocol::T_I32, 4);
xfer += oprot->writeI32((int32_t)this->type);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("state", ::apache::thrift::protocol::T_STRING, 5);
xfer += oprot->writeString(this->state);
xfer += oprot->writeFieldEnd();
if (this->__isset.workerid) {
xfer += oprot->writeFieldBegin("workerid", ::apache::thrift::protocol::T_STRING, 6);
xfer += oprot->writeString(this->workerid);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.start) {
xfer += oprot->writeFieldBegin("start", ::apache::thrift::protocol::T_I64, 7);
xfer += oprot->writeI64(this->start);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.runAs) {
xfer += oprot->writeFieldBegin("runAs", ::apache::thrift::protocol::T_STRING, 8);
xfer += oprot->writeString(this->runAs);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(ShowCompactResponseElement &a, ShowCompactResponseElement &b) {
using ::std::swap;
swap(a.dbname, b.dbname);
swap(a.tablename, b.tablename);
swap(a.partitionname, b.partitionname);
swap(a.type, b.type);
swap(a.state, b.state);
swap(a.workerid, b.workerid);
swap(a.start, b.start);
swap(a.runAs, b.runAs);
swap(a.__isset, b.__isset);
}
const char* ShowCompactResponse::ascii_fingerprint = "915B7B8DB8966D65769C0F98707BBAE3";
const uint8_t ShowCompactResponse::binary_fingerprint[16] = {0x91,0x5B,0x7B,0x8D,0xB8,0x96,0x6D,0x65,0x76,0x9C,0x0F,0x98,0x70,0x7B,0xBA,0xE3};
uint32_t ShowCompactResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_compacts = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->compacts.clear();
uint32_t _size395;
::apache::thrift::protocol::TType _etype398;
xfer += iprot->readListBegin(_etype398, _size395);
this->compacts.resize(_size395);
uint32_t _i399;
for (_i399 = 0; _i399 < _size395; ++_i399)
{
xfer += this->compacts[_i399].read(iprot);
}
xfer += iprot->readListEnd();
}
isset_compacts = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_compacts)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t ShowCompactResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("ShowCompactResponse");
xfer += oprot->writeFieldBegin("compacts", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->compacts.size()));
std::vector<ShowCompactResponseElement> ::const_iterator _iter400;
for (_iter400 = this->compacts.begin(); _iter400 != this->compacts.end(); ++_iter400)
{
xfer += (*_iter400).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(ShowCompactResponse &a, ShowCompactResponse &b) {
using ::std::swap;
swap(a.compacts, b.compacts);
}
const char* NotificationEventRequest::ascii_fingerprint = "6E578DA8AB10EED824A75534350EBAEF";
const uint8_t NotificationEventRequest::binary_fingerprint[16] = {0x6E,0x57,0x8D,0xA8,0xAB,0x10,0xEE,0xD8,0x24,0xA7,0x55,0x34,0x35,0x0E,0xBA,0xEF};
uint32_t NotificationEventRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_lastEvent = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->lastEvent);
isset_lastEvent = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->maxEvents);
this->__isset.maxEvents = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_lastEvent)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t NotificationEventRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("NotificationEventRequest");
xfer += oprot->writeFieldBegin("lastEvent", ::apache::thrift::protocol::T_I64, 1);
xfer += oprot->writeI64(this->lastEvent);
xfer += oprot->writeFieldEnd();
if (this->__isset.maxEvents) {
xfer += oprot->writeFieldBegin("maxEvents", ::apache::thrift::protocol::T_I32, 2);
xfer += oprot->writeI32(this->maxEvents);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(NotificationEventRequest &a, NotificationEventRequest &b) {
using ::std::swap;
swap(a.lastEvent, b.lastEvent);
swap(a.maxEvents, b.maxEvents);
swap(a.__isset, b.__isset);
}
const char* NotificationEvent::ascii_fingerprint = "ACAF0036D9999F3A389F490F5E22D369";
const uint8_t NotificationEvent::binary_fingerprint[16] = {0xAC,0xAF,0x00,0x36,0xD9,0x99,0x9F,0x3A,0x38,0x9F,0x49,0x0F,0x5E,0x22,0xD3,0x69};
uint32_t NotificationEvent::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_eventId = false;
bool isset_eventTime = false;
bool isset_eventType = false;
bool isset_message = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->eventId);
isset_eventId = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->eventTime);
isset_eventTime = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->eventType);
isset_eventType = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->dbName);
this->__isset.dbName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->tableName);
this->__isset.tableName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 6:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->message);
isset_message = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_eventId)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_eventTime)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_eventType)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_message)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t NotificationEvent::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("NotificationEvent");
xfer += oprot->writeFieldBegin("eventId", ::apache::thrift::protocol::T_I64, 1);
xfer += oprot->writeI64(this->eventId);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("eventTime", ::apache::thrift::protocol::T_I32, 2);
xfer += oprot->writeI32(this->eventTime);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("eventType", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->eventType);
xfer += oprot->writeFieldEnd();
if (this->__isset.dbName) {
xfer += oprot->writeFieldBegin("dbName", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString(this->dbName);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.tableName) {
xfer += oprot->writeFieldBegin("tableName", ::apache::thrift::protocol::T_STRING, 5);
xfer += oprot->writeString(this->tableName);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldBegin("message", ::apache::thrift::protocol::T_STRING, 6);
xfer += oprot->writeString(this->message);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(NotificationEvent &a, NotificationEvent &b) {
using ::std::swap;
swap(a.eventId, b.eventId);
swap(a.eventTime, b.eventTime);
swap(a.eventType, b.eventType);
swap(a.dbName, b.dbName);
swap(a.tableName, b.tableName);
swap(a.message, b.message);
swap(a.__isset, b.__isset);
}
const char* NotificationEventResponse::ascii_fingerprint = "EE3DB23399639114BCD1782A0FB01818";
const uint8_t NotificationEventResponse::binary_fingerprint[16] = {0xEE,0x3D,0xB2,0x33,0x99,0x63,0x91,0x14,0xBC,0xD1,0x78,0x2A,0x0F,0xB0,0x18,0x18};
uint32_t NotificationEventResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_events = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->events.clear();
uint32_t _size401;
::apache::thrift::protocol::TType _etype404;
xfer += iprot->readListBegin(_etype404, _size401);
this->events.resize(_size401);
uint32_t _i405;
for (_i405 = 0; _i405 < _size401; ++_i405)
{
xfer += this->events[_i405].read(iprot);
}
xfer += iprot->readListEnd();
}
isset_events = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_events)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t NotificationEventResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("NotificationEventResponse");
xfer += oprot->writeFieldBegin("events", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->events.size()));
std::vector<NotificationEvent> ::const_iterator _iter406;
for (_iter406 = this->events.begin(); _iter406 != this->events.end(); ++_iter406)
{
xfer += (*_iter406).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(NotificationEventResponse &a, NotificationEventResponse &b) {
using ::std::swap;
swap(a.events, b.events);
}
const char* CurrentNotificationEventId::ascii_fingerprint = "56A59CE7FFAF82BCA8A19FAACDE4FB75";
const uint8_t CurrentNotificationEventId::binary_fingerprint[16] = {0x56,0xA5,0x9C,0xE7,0xFF,0xAF,0x82,0xBC,0xA8,0xA1,0x9F,0xAA,0xCD,0xE4,0xFB,0x75};
uint32_t CurrentNotificationEventId::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_eventId = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->eventId);
isset_eventId = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_eventId)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t CurrentNotificationEventId::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("CurrentNotificationEventId");
xfer += oprot->writeFieldBegin("eventId", ::apache::thrift::protocol::T_I64, 1);
xfer += oprot->writeI64(this->eventId);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(CurrentNotificationEventId &a, CurrentNotificationEventId &b) {
using ::std::swap;
swap(a.eventId, b.eventId);
}
const char* InsertEventRequestData::ascii_fingerprint = "ACE4F644F0FDD289DDC4EE5B83BC13C0";
const uint8_t InsertEventRequestData::binary_fingerprint[16] = {0xAC,0xE4,0xF6,0x44,0xF0,0xFD,0xD2,0x89,0xDD,0xC4,0xEE,0x5B,0x83,0xBC,0x13,0xC0};
uint32_t InsertEventRequestData::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_filesAdded = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->filesAdded.clear();
uint32_t _size407;
::apache::thrift::protocol::TType _etype410;
xfer += iprot->readListBegin(_etype410, _size407);
this->filesAdded.resize(_size407);
uint32_t _i411;
for (_i411 = 0; _i411 < _size407; ++_i411)
{
xfer += iprot->readString(this->filesAdded[_i411]);
}
xfer += iprot->readListEnd();
}
isset_filesAdded = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_filesAdded)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t InsertEventRequestData::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("InsertEventRequestData");
xfer += oprot->writeFieldBegin("filesAdded", ::apache::thrift::protocol::T_LIST, 1);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->filesAdded.size()));
std::vector<std::string> ::const_iterator _iter412;
for (_iter412 = this->filesAdded.begin(); _iter412 != this->filesAdded.end(); ++_iter412)
{
xfer += oprot->writeString((*_iter412));
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(InsertEventRequestData &a, InsertEventRequestData &b) {
using ::std::swap;
swap(a.filesAdded, b.filesAdded);
}
const char* FireEventRequestData::ascii_fingerprint = "187E754B26707EE32451E6A27FB672CE";
const uint8_t FireEventRequestData::binary_fingerprint[16] = {0x18,0x7E,0x75,0x4B,0x26,0x70,0x7E,0xE3,0x24,0x51,0xE6,0xA2,0x7F,0xB6,0x72,0xCE};
uint32_t FireEventRequestData::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->insertData.read(iprot);
this->__isset.insertData = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t FireEventRequestData::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("FireEventRequestData");
xfer += oprot->writeFieldBegin("insertData", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->insertData.write(oprot);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(FireEventRequestData &a, FireEventRequestData &b) {
using ::std::swap;
swap(a.insertData, b.insertData);
swap(a.__isset, b.__isset);
}
const char* FireEventRequest::ascii_fingerprint = "1BA3A7F00159254072C3979B1429B50B";
const uint8_t FireEventRequest::binary_fingerprint[16] = {0x1B,0xA3,0xA7,0xF0,0x01,0x59,0x25,0x40,0x72,0xC3,0x97,0x9B,0x14,0x29,0xB5,0x0B};
uint32_t FireEventRequest::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_successful = false;
bool isset_data = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_BOOL) {
xfer += iprot->readBool(this->successful);
isset_successful = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->data.read(iprot);
isset_data = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->dbName);
this->__isset.dbName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->tableName);
this->__isset.tableName = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->partitionVals.clear();
uint32_t _size413;
::apache::thrift::protocol::TType _etype416;
xfer += iprot->readListBegin(_etype416, _size413);
this->partitionVals.resize(_size413);
uint32_t _i417;
for (_i417 = 0; _i417 < _size413; ++_i417)
{
xfer += iprot->readString(this->partitionVals[_i417]);
}
xfer += iprot->readListEnd();
}
this->__isset.partitionVals = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_successful)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_data)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t FireEventRequest::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("FireEventRequest");
xfer += oprot->writeFieldBegin("successful", ::apache::thrift::protocol::T_BOOL, 1);
xfer += oprot->writeBool(this->successful);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("data", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->data.write(oprot);
xfer += oprot->writeFieldEnd();
if (this->__isset.dbName) {
xfer += oprot->writeFieldBegin("dbName", ::apache::thrift::protocol::T_STRING, 3);
xfer += oprot->writeString(this->dbName);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.tableName) {
xfer += oprot->writeFieldBegin("tableName", ::apache::thrift::protocol::T_STRING, 4);
xfer += oprot->writeString(this->tableName);
xfer += oprot->writeFieldEnd();
}
if (this->__isset.partitionVals) {
xfer += oprot->writeFieldBegin("partitionVals", ::apache::thrift::protocol::T_LIST, 5);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->partitionVals.size()));
std::vector<std::string> ::const_iterator _iter418;
for (_iter418 = this->partitionVals.begin(); _iter418 != this->partitionVals.end(); ++_iter418)
{
xfer += oprot->writeString((*_iter418));
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(FireEventRequest &a, FireEventRequest &b) {
using ::std::swap;
swap(a.successful, b.successful);
swap(a.data, b.data);
swap(a.dbName, b.dbName);
swap(a.tableName, b.tableName);
swap(a.partitionVals, b.partitionVals);
swap(a.__isset, b.__isset);
}
const char* FireEventResponse::ascii_fingerprint = "99914B932BD37A50B983C5E7C90AE93B";
const uint8_t FireEventResponse::binary_fingerprint[16] = {0x99,0x91,0x4B,0x93,0x2B,0xD3,0x7A,0x50,0xB9,0x83,0xC5,0xE7,0xC9,0x0A,0xE9,0x3B};
uint32_t FireEventResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
xfer += iprot->skip(ftype);
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t FireEventResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("FireEventResponse");
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(FireEventResponse &a, FireEventResponse &b) {
using ::std::swap;
(void) a;
(void) b;
}
const char* MetaException::ascii_fingerprint = "EFB929595D312AC8F305D5A794CFEDA1";
const uint8_t MetaException::binary_fingerprint[16] = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
uint32_t MetaException::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->message);
this->__isset.message = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t MetaException::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("MetaException");
xfer += oprot->writeFieldBegin("message", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->message);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(MetaException &a, MetaException &b) {
using ::std::swap;
swap(a.message, b.message);
swap(a.__isset, b.__isset);
}
const char* UnknownTableException::ascii_fingerprint = "EFB929595D312AC8F305D5A794CFEDA1";
const uint8_t UnknownTableException::binary_fingerprint[16] = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
uint32_t UnknownTableException::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->message);
this->__isset.message = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t UnknownTableException::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("UnknownTableException");
xfer += oprot->writeFieldBegin("message", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->message);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(UnknownTableException &a, UnknownTableException &b) {
using ::std::swap;
swap(a.message, b.message);
swap(a.__isset, b.__isset);
}
const char* UnknownDBException::ascii_fingerprint = "EFB929595D312AC8F305D5A794CFEDA1";
const uint8_t UnknownDBException::binary_fingerprint[16] = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
uint32_t UnknownDBException::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->message);
this->__isset.message = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t UnknownDBException::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("UnknownDBException");
xfer += oprot->writeFieldBegin("message", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->message);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(UnknownDBException &a, UnknownDBException &b) {
using ::std::swap;
swap(a.message, b.message);
swap(a.__isset, b.__isset);
}
const char* AlreadyExistsException::ascii_fingerprint = "EFB929595D312AC8F305D5A794CFEDA1";
const uint8_t AlreadyExistsException::binary_fingerprint[16] = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
uint32_t AlreadyExistsException::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->message);
this->__isset.message = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t AlreadyExistsException::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("AlreadyExistsException");
xfer += oprot->writeFieldBegin("message", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->message);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(AlreadyExistsException &a, AlreadyExistsException &b) {
using ::std::swap;
swap(a.message, b.message);
swap(a.__isset, b.__isset);
}
const char* InvalidPartitionException::ascii_fingerprint = "EFB929595D312AC8F305D5A794CFEDA1";
const uint8_t InvalidPartitionException::binary_fingerprint[16] = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
uint32_t InvalidPartitionException::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->message);
this->__isset.message = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t InvalidPartitionException::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("InvalidPartitionException");
xfer += oprot->writeFieldBegin("message", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->message);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(InvalidPartitionException &a, InvalidPartitionException &b) {
using ::std::swap;
swap(a.message, b.message);
swap(a.__isset, b.__isset);
}
const char* UnknownPartitionException::ascii_fingerprint = "EFB929595D312AC8F305D5A794CFEDA1";
const uint8_t UnknownPartitionException::binary_fingerprint[16] = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
uint32_t UnknownPartitionException::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->message);
this->__isset.message = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t UnknownPartitionException::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("UnknownPartitionException");
xfer += oprot->writeFieldBegin("message", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->message);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(UnknownPartitionException &a, UnknownPartitionException &b) {
using ::std::swap;
swap(a.message, b.message);
swap(a.__isset, b.__isset);
}
const char* InvalidObjectException::ascii_fingerprint = "EFB929595D312AC8F305D5A794CFEDA1";
const uint8_t InvalidObjectException::binary_fingerprint[16] = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
uint32_t InvalidObjectException::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->message);
this->__isset.message = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t InvalidObjectException::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("InvalidObjectException");
xfer += oprot->writeFieldBegin("message", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->message);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(InvalidObjectException &a, InvalidObjectException &b) {
using ::std::swap;
swap(a.message, b.message);
swap(a.__isset, b.__isset);
}
const char* NoSuchObjectException::ascii_fingerprint = "EFB929595D312AC8F305D5A794CFEDA1";
const uint8_t NoSuchObjectException::binary_fingerprint[16] = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
uint32_t NoSuchObjectException::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->message);
this->__isset.message = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t NoSuchObjectException::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("NoSuchObjectException");
xfer += oprot->writeFieldBegin("message", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->message);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(NoSuchObjectException &a, NoSuchObjectException &b) {
using ::std::swap;
swap(a.message, b.message);
swap(a.__isset, b.__isset);
}
const char* IndexAlreadyExistsException::ascii_fingerprint = "EFB929595D312AC8F305D5A794CFEDA1";
const uint8_t IndexAlreadyExistsException::binary_fingerprint[16] = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
uint32_t IndexAlreadyExistsException::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->message);
this->__isset.message = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t IndexAlreadyExistsException::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("IndexAlreadyExistsException");
xfer += oprot->writeFieldBegin("message", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->message);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(IndexAlreadyExistsException &a, IndexAlreadyExistsException &b) {
using ::std::swap;
swap(a.message, b.message);
swap(a.__isset, b.__isset);
}
const char* InvalidOperationException::ascii_fingerprint = "EFB929595D312AC8F305D5A794CFEDA1";
const uint8_t InvalidOperationException::binary_fingerprint[16] = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
uint32_t InvalidOperationException::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->message);
this->__isset.message = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t InvalidOperationException::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("InvalidOperationException");
xfer += oprot->writeFieldBegin("message", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->message);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(InvalidOperationException &a, InvalidOperationException &b) {
using ::std::swap;
swap(a.message, b.message);
swap(a.__isset, b.__isset);
}
const char* ConfigValSecurityException::ascii_fingerprint = "EFB929595D312AC8F305D5A794CFEDA1";
const uint8_t ConfigValSecurityException::binary_fingerprint[16] = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
uint32_t ConfigValSecurityException::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->message);
this->__isset.message = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t ConfigValSecurityException::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("ConfigValSecurityException");
xfer += oprot->writeFieldBegin("message", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->message);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(ConfigValSecurityException &a, ConfigValSecurityException &b) {
using ::std::swap;
swap(a.message, b.message);
swap(a.__isset, b.__isset);
}
const char* InvalidInputException::ascii_fingerprint = "EFB929595D312AC8F305D5A794CFEDA1";
const uint8_t InvalidInputException::binary_fingerprint[16] = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
uint32_t InvalidInputException::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->message);
this->__isset.message = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t InvalidInputException::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("InvalidInputException");
xfer += oprot->writeFieldBegin("message", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->message);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(InvalidInputException &a, InvalidInputException &b) {
using ::std::swap;
swap(a.message, b.message);
swap(a.__isset, b.__isset);
}
const char* NoSuchTxnException::ascii_fingerprint = "EFB929595D312AC8F305D5A794CFEDA1";
const uint8_t NoSuchTxnException::binary_fingerprint[16] = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
uint32_t NoSuchTxnException::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->message);
this->__isset.message = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t NoSuchTxnException::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("NoSuchTxnException");
xfer += oprot->writeFieldBegin("message", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->message);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(NoSuchTxnException &a, NoSuchTxnException &b) {
using ::std::swap;
swap(a.message, b.message);
swap(a.__isset, b.__isset);
}
const char* TxnAbortedException::ascii_fingerprint = "EFB929595D312AC8F305D5A794CFEDA1";
const uint8_t TxnAbortedException::binary_fingerprint[16] = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
uint32_t TxnAbortedException::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->message);
this->__isset.message = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t TxnAbortedException::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("TxnAbortedException");
xfer += oprot->writeFieldBegin("message", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->message);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(TxnAbortedException &a, TxnAbortedException &b) {
using ::std::swap;
swap(a.message, b.message);
swap(a.__isset, b.__isset);
}
const char* TxnOpenException::ascii_fingerprint = "EFB929595D312AC8F305D5A794CFEDA1";
const uint8_t TxnOpenException::binary_fingerprint[16] = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
uint32_t TxnOpenException::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->message);
this->__isset.message = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t TxnOpenException::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("TxnOpenException");
xfer += oprot->writeFieldBegin("message", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->message);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(TxnOpenException &a, TxnOpenException &b) {
using ::std::swap;
swap(a.message, b.message);
swap(a.__isset, b.__isset);
}
const char* NoSuchLockException::ascii_fingerprint = "EFB929595D312AC8F305D5A794CFEDA1";
const uint8_t NoSuchLockException::binary_fingerprint[16] = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
uint32_t NoSuchLockException::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->message);
this->__isset.message = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
return xfer;
}
uint32_t NoSuchLockException::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("NoSuchLockException");
xfer += oprot->writeFieldBegin("message", ::apache::thrift::protocol::T_STRING, 1);
xfer += oprot->writeString(this->message);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(NoSuchLockException &a, NoSuchLockException &b) {
using ::std::swap;
swap(a.message, b.message);
swap(a.__isset, b.__isset);
}
}}} // namespace
| Java |
# $NetBSD: Makefile,v 1.2 2011/09/08 18:44:38 jmmv Exp $
NOMAN= # defined
.include <bsd.own.mk>
ATFFILE= no
TESTSDIR= ${TESTSBASE}/lib/libcurses
FILESDIR= ${TESTSDIR}/check_files
FILES= curses_start.chk
FILES+= addch.chk
FILES+= addchstr.chk
FILES+= addstr.chk
FILES+= attributes.chk
FILES+= bell.chk
FILES+= background1.chk
FILES+= background2.chk
FILES+= background3.chk
FILES+= background4.chk
FILES+= background5.chk
FILES+= chgat1.chk
FILES+= chgat2.chk
FILES+= chgat3.chk
FILES+= clear1.chk
FILES+= clear2.chk
FILES+= clear3.chk
FILES+= clear4.chk
FILES+= clear5.chk
FILES+= clear6.chk
FILES+= clear7.chk
FILES+= clear8.chk
FILES+= clear9.chk
FILES+= clear10.chk
FILES+= color_blank_draw.chk
FILES+= color_start.chk
FILES+= color_default.chk
FILES+= color_blue_back.chk
FILES+= color_red_fore.chk
FILES+= color_set.chk
FILES+= copywin1.chk
FILES+= copywin2.chk
FILES+= copywin3.chk
FILES+= copywin4.chk
FILES+= copywin5.chk
FILES+= copywin6.chk
FILES+= copywin7.chk
FILES+= copywin8.chk
FILES+= copywin9.chk
FILES+= copywin10.chk
FILES+= copywin11.chk
FILES+= copywin12.chk
FILES+= copywin13.chk
FILES+= copywin14.chk
FILES+= curs_set1.chk
FILES+= curs_set2.chk
FILES+= curs_set3.chk
FILES+= fill.chk
FILES+= home.chk
FILES+= timeout.chk
FILES+= box_standout.chk
FILES+= wborder.chk
FILES+= wborder_refresh.chk
FILES+= window.chk
FILES+= wscrl1.chk
FILES+= wscrl2.chk
FILES+= wgetstr.chk
FILES+= wgetstr_refresh.chk
FILES+= wprintw_refresh.chk
CLEANFILES=
.include <bsd.test.mk>
.include <bsd.files.mk>
.include <bsd.prog.mk>
| Java |
#
# Copyright 2017 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package storage::hp::lefthand::snmp::mode::components::device;
use strict;
use warnings;
use storage::hp::lefthand::snmp::mode::components::resources qw($map_status);
my $mapping = {
storageDeviceSerialNumber => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.7' },
storageDeviceTemperature => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.9' },
storageDeviceTemperatureCritical => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.10' },
storageDeviceTemperatureLimit => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.11' },
storageDeviceTemperatureStatus => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.12', map => $map_status },
storageDeviceName => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.14' },
storageDeviceSmartHealth => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.17' }, # normal, marginal, faulty
storageDeviceState => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.90' },
storageDeviceStatus => { oid => '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.91', map => $map_status },
};
my $oid_storageDeviceEntry = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1';
sub load {
my ($self) = @_;
push @{$self->{request}}, { oid => $oid_storageDeviceEntry };
}
sub check {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking devices");
$self->{components}->{device} = {name => 'devices', total => 0, skip => 0};
return if ($self->check_filter(section => 'device'));
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_storageDeviceEntry}})) {
next if ($oid !~ /^$mapping->{storageDeviceStatus}->{oid}\.(.*)$/);
my $instance = $1;
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_storageDeviceEntry}, instance => $instance);
if ($result->{storageDeviceState} =~ /off_and_secured|off_or_removed/i) {
$self->absent_problem(section => 'device', instance => $instance);
next;
}
next if ($self->check_filter(section => 'device', instance => $instance));
$self->{components}->{device}->{total}++;
$self->{output}->output_add(long_msg => sprintf("storage device '%s' status is '%s' [instance = %s, state = %s, serial = %s, smart health = %s]",
$result->{storageDeviceName}, $result->{storageDeviceStatus}, $instance, $result->{storageDeviceState},
$result->{storageDeviceSerialNumber}, $result->{storageDeviceSmartHealth}));
my $exit = $self->get_severity(label => 'default', section => 'device', value => $result->{storageDeviceStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("storage device '%s' state is '%s'", $result->{storageDeviceName}, $result->{storageDeviceState}));
}
$exit = $self->get_severity(label => 'smart', section => 'device.smart', value => $result->{storageDeviceSmartHealth});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("storage device '%s' smart health state is '%s'", $result->{storageDeviceName}, $result->{storageDeviceSmartHealth}));
}
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'device.temperature', instance => $instance, value => $result->{storageDeviceTemperature});
if ($checked == 0) {
my $warn_th = '';
my $crit_th = defined($result->{storageDeviceTemperatureCritical}) ? $result->{storageDeviceTemperatureCritical} : '';
$self->{perfdata}->threshold_validate(label => 'warning-device.temperature-instance-' . $instance, value => $warn_th);
$self->{perfdata}->threshold_validate(label => 'critical-device.temperature-instance-' . $instance, value => $crit_th);
$exit = $self->{perfdata}->threshold_check(
value => $result->{storageDeviceTemperature},
threshold => [ { label => 'critical-device.temperature-instance-' . $instance, exit_litteral => 'critical' },
{ label => 'warning-device.temperature-instance-' . $instance, exit_litteral => 'warning' } ]);
$warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-device.temperature-instance-' . $instance);
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-device.temperature-instance-' . $instance)
}
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit2,
short_msg => sprintf("storage device '%s' temperature is %s C", $result->{storageDeviceName}, $result->{storageDeviceTemperature}));
}
$self->{output}->perfdata_add(label => 'temp_' . $result->{storageDeviceName}, unit => 'C',
value => $result->{storageDeviceTemperature},
warning => $warn,
critical => $crit,
max => $result->{storageDeviceTemperatureLimit},
);
}
}
1; | Java |
// This file is part of libfringe, a low-level green threading library.
// Copyright (c) whitequark <[email protected]>
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.
extern crate fringe;
use fringe::OsStack;
use fringe::generator::Generator;
#[test]
fn producer() {
let stack = OsStack::new(0).unwrap();
let mut gen = Generator::new(stack, move |yielder, ()| {
for i in 0.. { yielder.suspend(i) }
});
assert_eq!(gen.next(), Some(0));
assert_eq!(gen.next(), Some(1));
assert_eq!(gen.next(), Some(2));
unsafe { gen.unsafe_unwrap(); }
}
| Java |
#!/usr/bin/env bash
## Users, roles, tenants ##
adminUser=${1:-neutron}
adminRole=admin
l3AdminTenant=L3AdminTenant
serviceTenant=service
# Below user is just for demos so that we don't see all logical instances.
regularUser=viewer
password=viewer
echo -n "Checking if $l3AdminTenant tenant exists ..."
tenantId=`openstack project show $l3AdminTenant 2>&1 | awk '/No|id/ { if ($1 == "No") print "No"; else if ($2 == "id") print $4; }'`
if [ "$tenantId" == "No" ]; then
echo " No, it does not. Creating it."
tenantId=$(openstack project create $l3AdminTenant --domain="default" --or-show -f value -c id)
echo $tenantId
else
echo " Yes, it does."
fi
echo -n "Checking if $regularUser user exists ..."
userId=`openstack user show $regularUser 2>&1 | awk '/No user|id/ { if ($1 == "No") print "No"; else print $4; }'`
if [ "$userId" == "No" ]; then
echo " No, it does not. Creating it."
userId=$(openstack user create $regularUser --password $password --domain="default" --or-show -f value -c id)
echo $userId
else
echo " Yes, it does."
fi
echo -n "Checking if $adminUser user has admin privileges in $l3AdminTenant tenant ..."
isAdmin=`openstack --os-username $adminUser --os-project-name $l3AdminTenant user role list 2>&1 | awk 'BEGIN { res="No" } { if ($4 == "admin") res="Yes"; } END { print res; }'`
if [ "$isAdmin" == "No" ]; then
echo " No, it does not. Giving it admin rights."
admUserId=`openstack user show $adminUser | awk '{ if ($2 == "id") print $4 }'`
admRoleId=`openstack role show $adminRole | awk '{ if ($2 == "id") print $4 }'`
openstack role add $admRoleId --user $admUserId --project $tenantId
else
echo " Yes, it has."
fi
# What follows can be removed once L3AdminTenant is used to lookup UUID of L3AdminTenant
echo -n "Determining UUID of $serviceTenant tenant ..."
tenantId=`openstack project show $serviceTenant 2>&1 | awk '/No tenant|id/ { if ($1 == "No") print "No"; else if ($2 == "id") print $4; }'`
if [ "$tenantId" == "No" ]; then
echo "Error: $serviceTenant tenant does not seem to exist. Aborting!"
exit 1
else
echo " Done."
fi
echo -n "Checking if $adminUser user has admin privileges in $serviceTenant tenant ..."
isAdmin=`openstack --os-username $adminUser --os-project-name $serviceTenant user role list 2>&1 | awk 'BEGIN { res="No" } { if ($4 == "admin") res="Yes"; } END { print res; }'`
if [ "$isAdmin" == "No" ]; then
echo " No, it does not. Giving it admin rights."
admUserId=`openstack user show $adminUser | awk '{ if ($2 == "id") print $4 }'`
admRoleId=`openstack role show $adminRole | awk '{ if ($2 == "id") print $4 }'`
openstack role add $admRoleId --user $admUserId --project $tenantId
else
echo " Yes, it has."
fi
| Java |
/* This file is part of SableCC ( http://sablecc.org ).
*
* See the NOTICE file distributed with this work for copyright information.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sablecc.sablecc.semantics;
public class Context {
private Grammar grammar;
}
| Java |
package network
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// InterfacesClient is the network Client
type InterfacesClient struct {
ManagementClient
}
// NewInterfacesClient creates an instance of the InterfacesClient client.
func NewInterfacesClient(subscriptionID string) InterfacesClient {
return NewInterfacesClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewInterfacesClientWithBaseURI creates an instance of the InterfacesClient client.
func NewInterfacesClientWithBaseURI(baseURI string, subscriptionID string) InterfacesClient {
return InterfacesClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrUpdate creates or updates a network interface. This method may poll for completion. Polling can be canceled
// by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP
// requests.
//
// resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface.
// parameters is parameters supplied to the create or update network interface operation.
func (client InterfacesClient) CreateOrUpdate(resourceGroupName string, networkInterfaceName string, parameters Interface, cancel <-chan struct{}) (<-chan Interface, <-chan error) {
resultChan := make(chan Interface, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result Interface
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkInterfaceName, parameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", resp, "Failure sending request")
return
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client InterfacesClient) CreateOrUpdatePreparer(resourceGroupName string, networkInterfaceName string, parameters Interface, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client InterfacesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoRetryWithRegistration(client.Client),
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client InterfacesClient) CreateOrUpdateResponder(resp *http.Response) (result Interface, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Delete deletes the specified network interface. This method may poll for completion. Polling can be canceled by
// passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface.
func (client InterfacesClient) Delete(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
resultChan := make(chan autorest.Response, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result autorest.Response
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, networkInterfaceName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// DeletePreparer prepares the Delete request.
func (client InterfacesClient) DeletePreparer(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client InterfacesClient) DeleteSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoRetryWithRegistration(client.Client),
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client InterfacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}
// Get gets information about the specified network interface.
//
// resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface.
// expand is expands referenced resources.
func (client InterfacesClient) Get(resourceGroupName string, networkInterfaceName string, expand string) (result Interface, err error) {
req, err := client.GetPreparer(resourceGroupName, networkInterfaceName, expand)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client InterfacesClient) GetPreparer(resourceGroupName string, networkInterfaceName string, expand string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
if len(expand) > 0 {
queryParameters["$expand"] = autorest.Encode("query", expand)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client InterfacesClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoRetryWithRegistration(client.Client))
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client InterfacesClient) GetResponder(resp *http.Response) (result Interface, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// GetEffectiveRouteTable gets all route tables applied to a network interface. This method may poll for completion.
// Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface.
func (client InterfacesClient) GetEffectiveRouteTable(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (<-chan EffectiveRouteListResult, <-chan error) {
resultChan := make(chan EffectiveRouteListResult, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result EffectiveRouteListResult
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.GetEffectiveRouteTablePreparer(resourceGroupName, networkInterfaceName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetEffectiveRouteTable", nil, "Failure preparing request")
return
}
resp, err := client.GetEffectiveRouteTableSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetEffectiveRouteTable", resp, "Failure sending request")
return
}
result, err = client.GetEffectiveRouteTableResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetEffectiveRouteTable", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// GetEffectiveRouteTablePreparer prepares the GetEffectiveRouteTable request.
func (client InterfacesClient) GetEffectiveRouteTablePreparer(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// GetEffectiveRouteTableSender sends the GetEffectiveRouteTable request. The method will close the
// http.Response Body if it receives an error.
func (client InterfacesClient) GetEffectiveRouteTableSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoRetryWithRegistration(client.Client),
azure.DoPollForAsynchronous(client.PollingDelay))
}
// GetEffectiveRouteTableResponder handles the response to the GetEffectiveRouteTable request. The method always
// closes the http.Response Body.
func (client InterfacesClient) GetEffectiveRouteTableResponder(resp *http.Response) (result EffectiveRouteListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// GetVirtualMachineScaleSetNetworkInterface get the specified network interface in a virtual machine scale set.
//
// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual machine
// scale set. virtualmachineIndex is the virtual machine index. networkInterfaceName is the name of the network
// interface. expand is expands referenced resources.
func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterface(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result Interface, err error) {
req, err := client.GetVirtualMachineScaleSetNetworkInterfacePreparer(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", nil, "Failure preparing request")
return
}
resp, err := client.GetVirtualMachineScaleSetNetworkInterfaceSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", resp, "Failure sending request")
return
}
result, err = client.GetVirtualMachineScaleSetNetworkInterfaceResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", resp, "Failure responding to request")
}
return
}
// GetVirtualMachineScaleSetNetworkInterfacePreparer prepares the GetVirtualMachineScaleSetNetworkInterface request.
func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfacePreparer(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"virtualmachineIndex": autorest.Encode("path", virtualmachineIndex),
"virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName),
}
const APIVersion = "2017-03-30"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
if len(expand) > 0 {
queryParameters["$expand"] = autorest.Encode("query", expand)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetVirtualMachineScaleSetNetworkInterfaceSender sends the GetVirtualMachineScaleSetNetworkInterface request. The method will close the
// http.Response Body if it receives an error.
func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfaceSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoRetryWithRegistration(client.Client))
}
// GetVirtualMachineScaleSetNetworkInterfaceResponder handles the response to the GetVirtualMachineScaleSetNetworkInterface request. The method always
// closes the http.Response Body.
func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfaceResponder(resp *http.Response) (result Interface, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// List gets all network interfaces in a resource group.
//
// resourceGroupName is the name of the resource group.
func (client InterfacesClient) List(resourceGroupName string) (result InterfaceListResult, err error) {
req, err := client.ListPreparer(resourceGroupName)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client InterfacesClient) ListPreparer(resourceGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client InterfacesClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoRetryWithRegistration(client.Client))
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client InterfacesClient) ListResponder(resp *http.Response) (result InterfaceListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client InterfacesClient) ListNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) {
req, err := lastResults.InterfaceListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure responding to next results request")
}
return
}
// ListComplete gets all elements from the list without paging.
func (client InterfacesClient) ListComplete(resourceGroupName string, cancel <-chan struct{}) (<-chan Interface, <-chan error) {
resultChan := make(chan Interface)
errChan := make(chan error, 1)
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
}
// ListAll gets all network interfaces in a subscription.
func (client InterfacesClient) ListAll() (result InterfaceListResult, err error) {
req, err := client.ListAllPreparer()
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", nil, "Failure preparing request")
return
}
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure sending request")
return
}
result, err = client.ListAllResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure responding to request")
}
return
}
// ListAllPreparer prepares the ListAll request.
func (client InterfacesClient) ListAllPreparer() (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListAllSender sends the ListAll request. The method will close the
// http.Response Body if it receives an error.
func (client InterfacesClient) ListAllSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoRetryWithRegistration(client.Client))
}
// ListAllResponder handles the response to the ListAll request. The method always
// closes the http.Response Body.
func (client InterfacesClient) ListAllResponder(resp *http.Response) (result InterfaceListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListAllNextResults retrieves the next set of results, if any.
func (client InterfacesClient) ListAllNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) {
req, err := lastResults.InterfaceListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure sending next results request")
}
result, err = client.ListAllResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure responding to next results request")
}
return
}
// ListAllComplete gets all elements from the list without paging.
func (client InterfacesClient) ListAllComplete(cancel <-chan struct{}) (<-chan Interface, <-chan error) {
resultChan := make(chan Interface)
errChan := make(chan error, 1)
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.ListAll()
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListAllNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
}
// ListEffectiveNetworkSecurityGroups gets all network security groups applied to a network interface. This method may
// poll for completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to
// cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface.
func (client InterfacesClient) ListEffectiveNetworkSecurityGroups(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (<-chan EffectiveNetworkSecurityGroupListResult, <-chan error) {
resultChan := make(chan EffectiveNetworkSecurityGroupListResult, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result EffectiveNetworkSecurityGroupListResult
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.ListEffectiveNetworkSecurityGroupsPreparer(resourceGroupName, networkInterfaceName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListEffectiveNetworkSecurityGroups", nil, "Failure preparing request")
return
}
resp, err := client.ListEffectiveNetworkSecurityGroupsSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListEffectiveNetworkSecurityGroups", resp, "Failure sending request")
return
}
result, err = client.ListEffectiveNetworkSecurityGroupsResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListEffectiveNetworkSecurityGroups", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// ListEffectiveNetworkSecurityGroupsPreparer prepares the ListEffectiveNetworkSecurityGroups request.
func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsPreparer(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveNetworkSecurityGroups", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// ListEffectiveNetworkSecurityGroupsSender sends the ListEffectiveNetworkSecurityGroups request. The method will close the
// http.Response Body if it receives an error.
func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoRetryWithRegistration(client.Client),
azure.DoPollForAsynchronous(client.PollingDelay))
}
// ListEffectiveNetworkSecurityGroupsResponder handles the response to the ListEffectiveNetworkSecurityGroups request. The method always
// closes the http.Response Body.
func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsResponder(resp *http.Response) (result EffectiveNetworkSecurityGroupListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListVirtualMachineScaleSetNetworkInterfaces gets all network interfaces in a virtual machine scale set.
//
// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual machine
// scale set.
func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfaces(resourceGroupName string, virtualMachineScaleSetName string) (result InterfaceListResult, err error) {
req, err := client.ListVirtualMachineScaleSetNetworkInterfacesPreparer(resourceGroupName, virtualMachineScaleSetName)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", nil, "Failure preparing request")
return
}
resp, err := client.ListVirtualMachineScaleSetNetworkInterfacesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure sending request")
return
}
result, err = client.ListVirtualMachineScaleSetNetworkInterfacesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure responding to request")
}
return
}
// ListVirtualMachineScaleSetNetworkInterfacesPreparer prepares the ListVirtualMachineScaleSetNetworkInterfaces request.
func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesPreparer(resourceGroupName string, virtualMachineScaleSetName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName),
}
const APIVersion = "2017-03-30"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/networkInterfaces", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListVirtualMachineScaleSetNetworkInterfacesSender sends the ListVirtualMachineScaleSetNetworkInterfaces request. The method will close the
// http.Response Body if it receives an error.
func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoRetryWithRegistration(client.Client))
}
// ListVirtualMachineScaleSetNetworkInterfacesResponder handles the response to the ListVirtualMachineScaleSetNetworkInterfaces request. The method always
// closes the http.Response Body.
func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesResponder(resp *http.Response) (result InterfaceListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListVirtualMachineScaleSetNetworkInterfacesNextResults retrieves the next set of results, if any.
func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) {
req, err := lastResults.InterfaceListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListVirtualMachineScaleSetNetworkInterfacesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure sending next results request")
}
result, err = client.ListVirtualMachineScaleSetNetworkInterfacesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure responding to next results request")
}
return
}
// ListVirtualMachineScaleSetNetworkInterfacesComplete gets all elements from the list without paging.
func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesComplete(resourceGroupName string, virtualMachineScaleSetName string, cancel <-chan struct{}) (<-chan Interface, <-chan error) {
resultChan := make(chan Interface)
errChan := make(chan error, 1)
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.ListVirtualMachineScaleSetNetworkInterfaces(resourceGroupName, virtualMachineScaleSetName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListVirtualMachineScaleSetNetworkInterfacesNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
}
// ListVirtualMachineScaleSetVMNetworkInterfaces gets information about all network interfaces in a virtual machine in
// a virtual machine scale set.
//
// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual machine
// scale set. virtualmachineIndex is the virtual machine index.
func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfaces(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (result InterfaceListResult, err error) {
req, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesPreparer(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", nil, "Failure preparing request")
return
}
resp, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure sending request")
return
}
result, err = client.ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure responding to request")
}
return
}
// ListVirtualMachineScaleSetVMNetworkInterfacesPreparer prepares the ListVirtualMachineScaleSetVMNetworkInterfaces request.
func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesPreparer(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"virtualmachineIndex": autorest.Encode("path", virtualmachineIndex),
"virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName),
}
const APIVersion = "2017-03-30"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListVirtualMachineScaleSetVMNetworkInterfacesSender sends the ListVirtualMachineScaleSetVMNetworkInterfaces request. The method will close the
// http.Response Body if it receives an error.
func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoRetryWithRegistration(client.Client))
}
// ListVirtualMachineScaleSetVMNetworkInterfacesResponder handles the response to the ListVirtualMachineScaleSetVMNetworkInterfaces request. The method always
// closes the http.Response Body.
func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp *http.Response) (result InterfaceListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListVirtualMachineScaleSetVMNetworkInterfacesNextResults retrieves the next set of results, if any.
func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) {
req, err := lastResults.InterfaceListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure sending next results request")
}
result, err = client.ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure responding to next results request")
}
return
}
// ListVirtualMachineScaleSetVMNetworkInterfacesComplete gets all elements from the list without paging.
func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesComplete(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, cancel <-chan struct{}) (<-chan Interface, <-chan error) {
resultChan := make(chan Interface)
errChan := make(chan error, 1)
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.ListVirtualMachineScaleSetVMNetworkInterfaces(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListVirtualMachineScaleSetVMNetworkInterfacesNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
}
| Java |
/*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.presto.operator;
import com.facebook.presto.sql.planner.plan.PlanNodeId;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableList;
import io.airlift.units.DataSize;
import io.airlift.units.Duration;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
import java.util.Optional;
import static com.google.common.base.Preconditions.checkArgument;
import static io.airlift.units.DataSize.succinctBytes;
import static java.util.Objects.requireNonNull;
import static java.util.concurrent.TimeUnit.NANOSECONDS;
@Immutable
public class OperatorStats
{
private final int operatorId;
private final PlanNodeId planNodeId;
private final String operatorType;
private final long totalDrivers;
private final long addInputCalls;
private final Duration addInputWall;
private final Duration addInputCpu;
private final Duration addInputUser;
private final DataSize inputDataSize;
private final long inputPositions;
private final double sumSquaredInputPositions;
private final long getOutputCalls;
private final Duration getOutputWall;
private final Duration getOutputCpu;
private final Duration getOutputUser;
private final DataSize outputDataSize;
private final long outputPositions;
private final Duration blockedWall;
private final long finishCalls;
private final Duration finishWall;
private final Duration finishCpu;
private final Duration finishUser;
private final DataSize memoryReservation;
private final DataSize systemMemoryReservation;
private final Optional<BlockedReason> blockedReason;
private final OperatorInfo info;
@JsonCreator
public OperatorStats(
@JsonProperty("operatorId") int operatorId,
@JsonProperty("planNodeId") PlanNodeId planNodeId,
@JsonProperty("operatorType") String operatorType,
@JsonProperty("totalDrivers") long totalDrivers,
@JsonProperty("addInputCalls") long addInputCalls,
@JsonProperty("addInputWall") Duration addInputWall,
@JsonProperty("addInputCpu") Duration addInputCpu,
@JsonProperty("addInputUser") Duration addInputUser,
@JsonProperty("inputDataSize") DataSize inputDataSize,
@JsonProperty("inputPositions") long inputPositions,
@JsonProperty("sumSquaredInputPositions") double sumSquaredInputPositions,
@JsonProperty("getOutputCalls") long getOutputCalls,
@JsonProperty("getOutputWall") Duration getOutputWall,
@JsonProperty("getOutputCpu") Duration getOutputCpu,
@JsonProperty("getOutputUser") Duration getOutputUser,
@JsonProperty("outputDataSize") DataSize outputDataSize,
@JsonProperty("outputPositions") long outputPositions,
@JsonProperty("blockedWall") Duration blockedWall,
@JsonProperty("finishCalls") long finishCalls,
@JsonProperty("finishWall") Duration finishWall,
@JsonProperty("finishCpu") Duration finishCpu,
@JsonProperty("finishUser") Duration finishUser,
@JsonProperty("memoryReservation") DataSize memoryReservation,
@JsonProperty("systemMemoryReservation") DataSize systemMemoryReservation,
@JsonProperty("blockedReason") Optional<BlockedReason> blockedReason,
@JsonProperty("info") OperatorInfo info)
{
checkArgument(operatorId >= 0, "operatorId is negative");
this.operatorId = operatorId;
this.planNodeId = requireNonNull(planNodeId, "planNodeId is null");
this.operatorType = requireNonNull(operatorType, "operatorType is null");
this.totalDrivers = totalDrivers;
this.addInputCalls = addInputCalls;
this.addInputWall = requireNonNull(addInputWall, "addInputWall is null");
this.addInputCpu = requireNonNull(addInputCpu, "addInputCpu is null");
this.addInputUser = requireNonNull(addInputUser, "addInputUser is null");
this.inputDataSize = requireNonNull(inputDataSize, "inputDataSize is null");
checkArgument(inputPositions >= 0, "inputPositions is negative");
this.inputPositions = inputPositions;
this.sumSquaredInputPositions = sumSquaredInputPositions;
this.getOutputCalls = getOutputCalls;
this.getOutputWall = requireNonNull(getOutputWall, "getOutputWall is null");
this.getOutputCpu = requireNonNull(getOutputCpu, "getOutputCpu is null");
this.getOutputUser = requireNonNull(getOutputUser, "getOutputUser is null");
this.outputDataSize = requireNonNull(outputDataSize, "outputDataSize is null");
checkArgument(outputPositions >= 0, "outputPositions is negative");
this.outputPositions = outputPositions;
this.blockedWall = requireNonNull(blockedWall, "blockedWall is null");
this.finishCalls = finishCalls;
this.finishWall = requireNonNull(finishWall, "finishWall is null");
this.finishCpu = requireNonNull(finishCpu, "finishCpu is null");
this.finishUser = requireNonNull(finishUser, "finishUser is null");
this.memoryReservation = requireNonNull(memoryReservation, "memoryReservation is null");
this.systemMemoryReservation = requireNonNull(systemMemoryReservation, "systemMemoryReservation is null");
this.blockedReason = blockedReason;
this.info = info;
}
@JsonProperty
public int getOperatorId()
{
return operatorId;
}
@JsonProperty
public PlanNodeId getPlanNodeId()
{
return planNodeId;
}
@JsonProperty
public String getOperatorType()
{
return operatorType;
}
@JsonProperty
public long getTotalDrivers()
{
return totalDrivers;
}
@JsonProperty
public long getAddInputCalls()
{
return addInputCalls;
}
@JsonProperty
public Duration getAddInputWall()
{
return addInputWall;
}
@JsonProperty
public Duration getAddInputCpu()
{
return addInputCpu;
}
@JsonProperty
public Duration getAddInputUser()
{
return addInputUser;
}
@JsonProperty
public DataSize getInputDataSize()
{
return inputDataSize;
}
@JsonProperty
public long getInputPositions()
{
return inputPositions;
}
@JsonProperty
public double getSumSquaredInputPositions()
{
return sumSquaredInputPositions;
}
@JsonProperty
public long getGetOutputCalls()
{
return getOutputCalls;
}
@JsonProperty
public Duration getGetOutputWall()
{
return getOutputWall;
}
@JsonProperty
public Duration getGetOutputCpu()
{
return getOutputCpu;
}
@JsonProperty
public Duration getGetOutputUser()
{
return getOutputUser;
}
@JsonProperty
public DataSize getOutputDataSize()
{
return outputDataSize;
}
@JsonProperty
public long getOutputPositions()
{
return outputPositions;
}
@JsonProperty
public Duration getBlockedWall()
{
return blockedWall;
}
@JsonProperty
public long getFinishCalls()
{
return finishCalls;
}
@JsonProperty
public Duration getFinishWall()
{
return finishWall;
}
@JsonProperty
public Duration getFinishCpu()
{
return finishCpu;
}
@JsonProperty
public Duration getFinishUser()
{
return finishUser;
}
@JsonProperty
public DataSize getMemoryReservation()
{
return memoryReservation;
}
@JsonProperty
public DataSize getSystemMemoryReservation()
{
return systemMemoryReservation;
}
@JsonProperty
public Optional<BlockedReason> getBlockedReason()
{
return blockedReason;
}
@Nullable
@JsonProperty
public OperatorInfo getInfo()
{
return info;
}
public OperatorStats add(OperatorStats... operators)
{
return add(ImmutableList.copyOf(operators));
}
public OperatorStats add(Iterable<OperatorStats> operators)
{
long totalDrivers = this.totalDrivers;
long addInputCalls = this.addInputCalls;
long addInputWall = this.addInputWall.roundTo(NANOSECONDS);
long addInputCpu = this.addInputCpu.roundTo(NANOSECONDS);
long addInputUser = this.addInputUser.roundTo(NANOSECONDS);
long inputDataSize = this.inputDataSize.toBytes();
long inputPositions = this.inputPositions;
double sumSquaredInputPositions = this.sumSquaredInputPositions;
long getOutputCalls = this.getOutputCalls;
long getOutputWall = this.getOutputWall.roundTo(NANOSECONDS);
long getOutputCpu = this.getOutputCpu.roundTo(NANOSECONDS);
long getOutputUser = this.getOutputUser.roundTo(NANOSECONDS);
long outputDataSize = this.outputDataSize.toBytes();
long outputPositions = this.outputPositions;
long blockedWall = this.blockedWall.roundTo(NANOSECONDS);
long finishCalls = this.finishCalls;
long finishWall = this.finishWall.roundTo(NANOSECONDS);
long finishCpu = this.finishCpu.roundTo(NANOSECONDS);
long finishUser = this.finishUser.roundTo(NANOSECONDS);
long memoryReservation = this.memoryReservation.toBytes();
long systemMemoryReservation = this.systemMemoryReservation.toBytes();
Optional<BlockedReason> blockedReason = this.blockedReason;
Mergeable<OperatorInfo> base = getMergeableInfoOrNull(info);
for (OperatorStats operator : operators) {
checkArgument(operator.getOperatorId() == operatorId, "Expected operatorId to be %s but was %s", operatorId, operator.getOperatorId());
totalDrivers += operator.totalDrivers;
addInputCalls += operator.getAddInputCalls();
addInputWall += operator.getAddInputWall().roundTo(NANOSECONDS);
addInputCpu += operator.getAddInputCpu().roundTo(NANOSECONDS);
addInputUser += operator.getAddInputUser().roundTo(NANOSECONDS);
inputDataSize += operator.getInputDataSize().toBytes();
inputPositions += operator.getInputPositions();
sumSquaredInputPositions += operator.getSumSquaredInputPositions();
getOutputCalls += operator.getGetOutputCalls();
getOutputWall += operator.getGetOutputWall().roundTo(NANOSECONDS);
getOutputCpu += operator.getGetOutputCpu().roundTo(NANOSECONDS);
getOutputUser += operator.getGetOutputUser().roundTo(NANOSECONDS);
outputDataSize += operator.getOutputDataSize().toBytes();
outputPositions += operator.getOutputPositions();
finishCalls += operator.getFinishCalls();
finishWall += operator.getFinishWall().roundTo(NANOSECONDS);
finishCpu += operator.getFinishCpu().roundTo(NANOSECONDS);
finishUser += operator.getFinishUser().roundTo(NANOSECONDS);
blockedWall += operator.getBlockedWall().roundTo(NANOSECONDS);
memoryReservation += operator.getMemoryReservation().toBytes();
systemMemoryReservation += operator.getSystemMemoryReservation().toBytes();
if (operator.getBlockedReason().isPresent()) {
blockedReason = operator.getBlockedReason();
}
OperatorInfo info = operator.getInfo();
if (base != null && info != null && base.getClass() == info.getClass()) {
base = mergeInfo(base, info);
}
}
return new OperatorStats(
operatorId,
planNodeId,
operatorType,
totalDrivers,
addInputCalls,
new Duration(addInputWall, NANOSECONDS).convertToMostSuccinctTimeUnit(),
new Duration(addInputCpu, NANOSECONDS).convertToMostSuccinctTimeUnit(),
new Duration(addInputUser, NANOSECONDS).convertToMostSuccinctTimeUnit(),
succinctBytes(inputDataSize),
inputPositions,
sumSquaredInputPositions,
getOutputCalls,
new Duration(getOutputWall, NANOSECONDS).convertToMostSuccinctTimeUnit(),
new Duration(getOutputCpu, NANOSECONDS).convertToMostSuccinctTimeUnit(),
new Duration(getOutputUser, NANOSECONDS).convertToMostSuccinctTimeUnit(),
succinctBytes(outputDataSize),
outputPositions,
new Duration(blockedWall, NANOSECONDS).convertToMostSuccinctTimeUnit(),
finishCalls,
new Duration(finishWall, NANOSECONDS).convertToMostSuccinctTimeUnit(),
new Duration(finishCpu, NANOSECONDS).convertToMostSuccinctTimeUnit(),
new Duration(finishUser, NANOSECONDS).convertToMostSuccinctTimeUnit(),
succinctBytes(memoryReservation),
succinctBytes(systemMemoryReservation),
blockedReason,
(OperatorInfo) base);
}
@SuppressWarnings("unchecked")
private static Mergeable<OperatorInfo> getMergeableInfoOrNull(OperatorInfo info)
{
Mergeable<OperatorInfo> base = null;
if (info instanceof Mergeable) {
base = (Mergeable<OperatorInfo>) info;
}
return base;
}
@SuppressWarnings("unchecked")
private static <T> Mergeable<T> mergeInfo(Mergeable<T> base, T other)
{
return (Mergeable<T>) base.mergeWith(other);
}
public OperatorStats summarize()
{
return new OperatorStats(
operatorId,
planNodeId,
operatorType,
totalDrivers,
addInputCalls,
addInputWall,
addInputCpu,
addInputUser,
inputDataSize,
inputPositions,
sumSquaredInputPositions,
getOutputCalls,
getOutputWall,
getOutputCpu,
getOutputUser,
outputDataSize,
outputPositions,
blockedWall,
finishCalls,
finishWall,
finishCpu,
finishUser,
memoryReservation,
systemMemoryReservation,
blockedReason,
(info != null && info.isFinal()) ? info : null);
}
}
| Java |
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Class to compute the difference between two FSAs.
#ifndef FST_DIFFERENCE_H_
#define FST_DIFFERENCE_H_
#include <memory>
#include <fst/cache.h>
#include <fst/complement.h>
#include <fst/compose.h>
namespace fst {
template <class Arc, class M = Matcher<Fst<Arc>>,
class Filter = SequenceComposeFilter<M>,
class StateTable =
GenericComposeStateTable<Arc, typename Filter::FilterState>>
struct DifferenceFstOptions
: public ComposeFstOptions<Arc, M, Filter, StateTable> {
explicit DifferenceFstOptions(const CacheOptions &opts = CacheOptions(),
M *matcher1 = nullptr, M *matcher2 = nullptr,
Filter *filter = nullptr,
StateTable *state_table = nullptr)
: ComposeFstOptions<Arc, M, Filter, StateTable>(opts, matcher1, matcher2,
filter, state_table) {}
};
// Computes the difference between two FSAs. This version is a delayed FST.
// Only strings that are in the first automaton but not in second are retained
// in the result.
//
// The first argument must be an acceptor; the second argument must be an
// unweighted, epsilon-free, deterministic acceptor. One of the arguments must
// be label-sorted.
//
// Complexity: same as ComposeFst.
//
// Caveats: same as ComposeFst.
template <class A>
class DifferenceFst : public ComposeFst<A> {
public:
using Arc = A;
using Weight = typename Arc::Weight;
using StateId = typename Arc::StateId;
using ComposeFst<Arc>::CreateBase1;
// A - B = A ^ B'.
DifferenceFst(const Fst<Arc> &fst1, const Fst<Arc> &fst2,
const CacheOptions &opts = CacheOptions())
: ComposeFst<Arc>(CreateDifferenceImplWithCacheOpts(fst1, fst2, opts)) {
if (!fst1.Properties(kAcceptor, true)) {
FSTERROR() << "DifferenceFst: 1st argument not an acceptor";
GetImpl()->SetProperties(kError, kError);
}
}
template <class Matcher, class Filter, class StateTable>
DifferenceFst(
const Fst<Arc> &fst1, const Fst<Arc> &fst2,
const DifferenceFstOptions<Arc, Matcher, Filter, StateTable> &opts)
: ComposeFst<Arc>(
CreateDifferenceImplWithDifferenceOpts(fst1, fst2, opts)) {
if (!fst1.Properties(kAcceptor, true)) {
FSTERROR() << "DifferenceFst: 1st argument not an acceptor";
GetImpl()->SetProperties(kError, kError);
}
}
// See Fst<>::Copy() for doc.
DifferenceFst(const DifferenceFst<Arc> &fst, bool safe = false)
: ComposeFst<Arc>(fst, safe) {}
// Get a copy of this DifferenceFst. See Fst<>::Copy() for further doc.
DifferenceFst<Arc> *Copy(bool safe = false) const override {
return new DifferenceFst<Arc>(*this, safe);
}
private:
using Impl = internal::ComposeFstImplBase<Arc>;
using ImplToFst<Impl>::GetImpl;
static std::shared_ptr<Impl> CreateDifferenceImplWithCacheOpts(
const Fst<Arc> &fst1, const Fst<Arc> &fst2, const CacheOptions &opts) {
using RM = RhoMatcher<Matcher<Fst<A>>>;
ComplementFst<Arc> cfst(fst2);
ComposeFstOptions<A, RM> copts(
CacheOptions(), new RM(fst1, MATCH_NONE),
new RM(cfst, MATCH_INPUT, ComplementFst<Arc>::kRhoLabel));
return CreateBase1(fst1, cfst, copts);
}
template <class Matcher, class Filter, class StateTable>
static std::shared_ptr<Impl> CreateDifferenceImplWithDifferenceOpts(
const Fst<Arc> &fst1, const Fst<Arc> &fst2,
const DifferenceFstOptions<Arc, Matcher, Filter, StateTable> &opts) {
using RM = RhoMatcher<Matcher>;
ComplementFst<Arc> cfst(fst2);
ComposeFstOptions<Arc, RM> copts(opts);
copts.matcher1 = new RM(fst1, MATCH_NONE, kNoLabel, MATCHER_REWRITE_ALWAYS,
opts.matcher1);
copts.matcher2 = new RM(cfst, MATCH_INPUT, ComplementFst<Arc>::kRhoLabel,
MATCHER_REWRITE_ALWAYS, opts.matcher2);
return CreateBase1(fst1, cfst, copts);
}
};
// Specialization for DifferenceFst.
template <class Arc>
class StateIterator<DifferenceFst<Arc>>
: public StateIterator<ComposeFst<Arc>> {
public:
explicit StateIterator(const DifferenceFst<Arc> &fst)
: StateIterator<ComposeFst<Arc>>(fst) {}
};
// Specialization for DifferenceFst.
template <class Arc>
class ArcIterator<DifferenceFst<Arc>> : public ArcIterator<ComposeFst<Arc>> {
public:
using StateId = typename Arc::StateId;
ArcIterator(const DifferenceFst<Arc> &fst, StateId s)
: ArcIterator<ComposeFst<Arc>>(fst, s) {}
};
using DifferenceOptions = ComposeOptions;
// Useful alias when using StdArc.
using StdDifferenceFst = DifferenceFst<StdArc>;
using DifferenceOptions = ComposeOptions;
// Computes the difference between two FSAs. This version writes the difference
// to an output MutableFst. Only strings that are in the first automaton but not
// in the second are retained in the result.
//
// The first argument must be an acceptor; the second argument must be an
// unweighted, epsilon-free, deterministic acceptor. One of the arguments must
// be label-sorted.
//
// Complexity: same as Compose.
//
// Caveats: same as Compose.
template <class Arc>
void Difference(const Fst<Arc> &ifst1, const Fst<Arc> &ifst2,
MutableFst<Arc> *ofst,
const DifferenceOptions &opts = DifferenceOptions()) {
using M = Matcher<Fst<Arc>>;
// In each case, we cache only the last state for fastest copy.
switch (opts.filter_type) {
case AUTO_FILTER: {
CacheOptions nopts;
nopts.gc_limit = 0;
*ofst = DifferenceFst<Arc>(ifst1, ifst2, nopts);
break;
}
case SEQUENCE_FILTER: {
DifferenceFstOptions<Arc> dopts;
dopts.gc_limit = 0;
*ofst = DifferenceFst<Arc>(ifst1, ifst2, dopts);
break;
}
case ALT_SEQUENCE_FILTER: {
DifferenceFstOptions<Arc, M, AltSequenceComposeFilter<M>> dopts;
dopts.gc_limit = 0;
*ofst = DifferenceFst<Arc>(ifst1, ifst2, dopts);
break;
}
case MATCH_FILTER: {
DifferenceFstOptions<Arc, M, MatchComposeFilter<M>> dopts;
dopts.gc_limit = 0;
*ofst = DifferenceFst<Arc>(ifst1, ifst2, dopts);
break;
}
case NO_MATCH_FILTER: {
DifferenceFstOptions<Arc, M, NoMatchComposeFilter<M>> dopts;
dopts.gc_limit = 0;
*ofst = DifferenceFst<Arc>(ifst1, ifst2, dopts);
break;
}
case NULL_FILTER: {
DifferenceFstOptions<Arc, M, NullComposeFilter<M>> dopts;
dopts.gc_limit = 0;
*ofst = DifferenceFst<Arc>(ifst1, ifst2, dopts);
break;
}
case TRIVIAL_FILTER: {
DifferenceFstOptions<Arc, M, TrivialComposeFilter<M>> dopts;
dopts.gc_limit = 0;
*ofst = DifferenceFst<Arc>(ifst1, ifst2, dopts);
break;
}
}
if (opts.connect) Connect(ofst);
}
} // namespace fst
#endif // FST_DIFFERENCE_H_
| Java |
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.client;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.GenericAction;
import org.elasticsearch.action.admin.cluster.reroute.ClusterRerouteAction;
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotAction;
import org.elasticsearch.action.admin.cluster.stats.ClusterStatsAction;
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptAction;
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheAction;
import org.elasticsearch.action.admin.indices.create.CreateIndexAction;
import org.elasticsearch.action.admin.indices.flush.FlushAction;
import org.elasticsearch.action.admin.indices.stats.IndicesStatsAction;
import org.elasticsearch.action.delete.DeleteAction;
import org.elasticsearch.action.get.GetAction;
import org.elasticsearch.action.index.IndexAction;
import org.elasticsearch.action.search.SearchAction;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.env.Environment;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.threadpool.ThreadPool;
import java.util.HashMap;
import java.util.Map;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue;
public abstract class AbstractClientHeadersTestCase extends ESTestCase {
protected static final Settings HEADER_SETTINGS = Settings.builder()
.put(ThreadContext.PREFIX + ".key1", "val1")
.put(ThreadContext.PREFIX + ".key2", "val 2")
.build();
private static final GenericAction[] ACTIONS = new GenericAction[] {
// client actions
GetAction.INSTANCE, SearchAction.INSTANCE, DeleteAction.INSTANCE, DeleteStoredScriptAction.INSTANCE,
IndexAction.INSTANCE,
// cluster admin actions
ClusterStatsAction.INSTANCE, CreateSnapshotAction.INSTANCE, ClusterRerouteAction.INSTANCE,
// indices admin actions
CreateIndexAction.INSTANCE, IndicesStatsAction.INSTANCE, ClearIndicesCacheAction.INSTANCE, FlushAction.INSTANCE
};
protected ThreadPool threadPool;
private Client client;
@Override
public void setUp() throws Exception {
super.setUp();
Settings settings = Settings.builder()
.put(HEADER_SETTINGS)
.put("path.home", createTempDir().toString())
.put("node.name", "test-" + getTestName())
.put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString())
.build();
threadPool = new ThreadPool(settings);
client = buildClient(settings, ACTIONS);
}
@Override
public void tearDown() throws Exception {
super.tearDown();
client.close();
terminate(threadPool);
}
protected abstract Client buildClient(Settings headersSettings, GenericAction[] testedActions);
public void testActions() {
// TODO this is a really shitty way to test it, we need to figure out a way to test all the client methods
// without specifying each one (reflection doesn't as each action needs its own special settings, without
// them, request validation will fail before the test is executed. (one option is to enable disabling the
// validation in the settings??? - ugly and conceptually wrong)
// choosing arbitrary top level actions to test
client.prepareGet("idx", "type", "id").execute(new AssertingActionListener<>(GetAction.NAME, client.threadPool()));
client.prepareSearch().execute(new AssertingActionListener<>(SearchAction.NAME, client.threadPool()));
client.prepareDelete("idx", "type", "id").execute(new AssertingActionListener<>(DeleteAction.NAME, client.threadPool()));
client.admin().cluster().prepareDeleteStoredScript("lang", "id").execute(new AssertingActionListener<>(DeleteStoredScriptAction.NAME, client.threadPool()));
client.prepareIndex("idx", "type", "id").setSource("source", XContentType.JSON).execute(new AssertingActionListener<>(IndexAction.NAME, client.threadPool()));
// choosing arbitrary cluster admin actions to test
client.admin().cluster().prepareClusterStats().execute(new AssertingActionListener<>(ClusterStatsAction.NAME, client.threadPool()));
client.admin().cluster().prepareCreateSnapshot("repo", "bck").execute(new AssertingActionListener<>(CreateSnapshotAction.NAME, client.threadPool()));
client.admin().cluster().prepareReroute().execute(new AssertingActionListener<>(ClusterRerouteAction.NAME, client.threadPool()));
// choosing arbitrary indices admin actions to test
client.admin().indices().prepareCreate("idx").execute(new AssertingActionListener<>(CreateIndexAction.NAME, client.threadPool()));
client.admin().indices().prepareStats().execute(new AssertingActionListener<>(IndicesStatsAction.NAME, client.threadPool()));
client.admin().indices().prepareClearCache("idx1", "idx2").execute(new AssertingActionListener<>(ClearIndicesCacheAction.NAME, client.threadPool()));
client.admin().indices().prepareFlush().execute(new AssertingActionListener<>(FlushAction.NAME, client.threadPool()));
}
public void testOverrideHeader() throws Exception {
String key1Val = randomAlphaOfLength(5);
Map<String, String> expected = new HashMap<>();
expected.put("key1", key1Val);
expected.put("key2", "val 2");
client.threadPool().getThreadContext().putHeader("key1", key1Val);
client.prepareGet("idx", "type", "id")
.execute(new AssertingActionListener<>(GetAction.NAME, expected, client.threadPool()));
client.admin().cluster().prepareClusterStats()
.execute(new AssertingActionListener<>(ClusterStatsAction.NAME, expected, client.threadPool()));
client.admin().indices().prepareCreate("idx")
.execute(new AssertingActionListener<>(CreateIndexAction.NAME, expected, client.threadPool()));
}
protected static void assertHeaders(Map<String, String> headers, Map<String, String> expected) {
assertNotNull(headers);
assertEquals(expected.size(), headers.size());
for (Map.Entry<String, String> expectedEntry : expected.entrySet()) {
assertEquals(headers.get(expectedEntry.getKey()), expectedEntry.getValue());
}
}
protected static void assertHeaders(ThreadPool pool) {
assertHeaders(pool.getThreadContext().getHeaders(), (Map)HEADER_SETTINGS.getAsSettings(ThreadContext.PREFIX).getAsStructuredMap());
}
public static class InternalException extends Exception {
private final String action;
public InternalException(String action) {
this.action = action;
}
}
protected static class AssertingActionListener<T> implements ActionListener<T> {
private final String action;
private final Map<String, String> expectedHeaders;
private final ThreadPool pool;
public AssertingActionListener(String action, ThreadPool pool) {
this(action, (Map)HEADER_SETTINGS.getAsSettings(ThreadContext.PREFIX).getAsStructuredMap(), pool);
}
public AssertingActionListener(String action, Map<String, String> expectedHeaders, ThreadPool pool) {
this.action = action;
this.expectedHeaders = expectedHeaders;
this.pool = pool;
}
@Override
public void onResponse(T t) {
fail("an internal exception was expected for action [" + action + "]");
}
@Override
public void onFailure(Exception t) {
Throwable e = unwrap(t, InternalException.class);
assertThat("expected action [" + action + "] to throw an internal exception", e, notNullValue());
assertThat(action, equalTo(((InternalException) e).action));
Map<String, String> headers = pool.getThreadContext().getHeaders();
assertHeaders(headers, expectedHeaders);
}
public Throwable unwrap(Throwable t, Class<? extends Throwable> exceptionType) {
int counter = 0;
Throwable result = t;
while (!exceptionType.isInstance(result)) {
if (result.getCause() == null) {
return null;
}
if (result.getCause() == result) {
return null;
}
if (counter++ > 10) {
// dear god, if we got more than 10 levels down, WTF? just bail
fail("Exception cause unwrapping ran for 10 levels: " + ExceptionsHelper.stackTrace(t));
return null;
}
result = result.getCause();
}
return result;
}
}
}
| Java |
// Copyright 2014 The Oppia Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Minor general functional components for end-to-end testing
* with protractor.
*/
var editor = require('./editor.js');
// Time (in ms) to wait when the system needs time for some computations.
var WAIT_TIME = 4000;
// Optionally accepts a waitTime integer in milliseconds.
var waitForSystem = function() {
var waitTime;
if (arguments.length === 1) {
waitTime = arguments[0];
} else {
waitTime = WAIT_TIME;
}
browser.sleep(waitTime);
};
var scrollToTop = function() {
browser.executeScript('window.scrollTo(0,0);');
};
// We will report all console logs of level greater than this.
var CONSOLE_LOG_THRESHOLD = 900;
var CONSOLE_ERRORS_TO_IGNORE = [];
var checkForConsoleErrors = function(errorsToIgnore) {
var irrelevantErrors = errorsToIgnore.concat(CONSOLE_ERRORS_TO_IGNORE);
browser.manage().logs().get('browser').then(function(browserLogs) {
var fatalErrors = [];
for (var i = 0; i < browserLogs.length; i++) {
if (browserLogs[i].level.value > CONSOLE_LOG_THRESHOLD) {
var errorFatal = true;
for (var j = 0; j < irrelevantErrors.length; j++) {
if (browserLogs[i].message.match(irrelevantErrors[j])) {
errorFatal = false;
}
}
if (errorFatal) {
fatalErrors.push(browserLogs[i]);
}
}
}
expect(fatalErrors).toEqual([]);
});
};
var SERVER_URL_PREFIX = 'http://localhost:9001';
var LIBRARY_URL_SUFFIX = '/library';
var EDITOR_URL_SLICE = '/create/';
var PLAYER_URL_SLICE = '/explore/';
var LOGIN_URL_SUFFIX = '/_ah/login';
var ADMIN_URL_SUFFIX = '/admin';
var MODERATOR_URL_SUFFIX = '/moderator';
var DONATION_THANK_URL_SUFFIX = '/thanks';
// Note that this only works in dev, due to the use of cache slugs in prod.
var SCRIPTS_URL_SLICE = '/assets/scripts/';
var EXPLORATION_ID_LENGTH = 12;
var FIRST_STATE_DEFAULT_NAME = 'Introduction';
var _getExplorationId = function(currentUrlPrefix) {
return {
then: function(callbackFunction) {
browser.getCurrentUrl().then(function(url) {
expect(url.slice(0, currentUrlPrefix.length)).toBe(currentUrlPrefix);
var explorationId = url.slice(
currentUrlPrefix.length,
currentUrlPrefix.length + EXPLORATION_ID_LENGTH);
return callbackFunction(explorationId);
});
}
};
};
// If we are currently in the editor, this will return a promise with the
// exploration ID.
var getExplorationIdFromEditor = function() {
return _getExplorationId(SERVER_URL_PREFIX + EDITOR_URL_SLICE);
};
// Likewise for the player
var getExplorationIdFromPlayer = function() {
return _getExplorationId(SERVER_URL_PREFIX + PLAYER_URL_SLICE);
};
// The explorationId here should be a string, not a promise.
var openEditor = function(explorationId) {
browser.get(EDITOR_URL_SLICE + explorationId);
browser.waitForAngular();
editor.exitTutorialIfNecessary();
};
var openPlayer = function(explorationId) {
browser.get(PLAYER_URL_SLICE + explorationId);
browser.waitForAngular();
};
// Takes the user from an exploration editor to its player.
// NOTE: we do not use the preview button because that will open a new window.
var moveToPlayer = function() {
getExplorationIdFromEditor().then(openPlayer);
};
// Takes the user from the exploration player to its editor.
var moveToEditor = function() {
getExplorationIdFromPlayer().then(openEditor);
};
var expect404Error = function() {
expect(element(by.css('.protractor-test-error-container')).getText()).
toMatch('Error 404');
};
// Checks no untranslated values are shown in the page.
var ensurePageHasNoTranslationIds = function() {
// The use of the InnerHTML is hacky, but is faster than checking each
// individual component that contains text.
element(by.css('.oppia-base-container')).getInnerHtml().then(
function(promiseValue) {
// First remove all the attributes translate and variables that are
// not displayed
var REGEX_TRANSLATE_ATTR = new RegExp('translate="I18N_', 'g');
var REGEX_NG_VARIABLE = new RegExp('<\\[\'I18N_', 'g');
expect(promiseValue.replace(REGEX_TRANSLATE_ATTR, '')
.replace(REGEX_NG_VARIABLE, '')).not.toContain('I18N');
});
};
var acceptAlert = function() {
browser.wait(function() {
return browser.switchTo().alert().accept().then(
function() {
return true;
},
function() {
return false;
}
);
});
};
exports.acceptAlert = acceptAlert;
exports.waitForSystem = waitForSystem;
exports.scrollToTop = scrollToTop;
exports.checkForConsoleErrors = checkForConsoleErrors;
exports.SERVER_URL_PREFIX = SERVER_URL_PREFIX;
exports.LIBRARY_URL_SUFFIX = LIBRARY_URL_SUFFIX;
exports.EDITOR_URL_SLICE = EDITOR_URL_SLICE;
exports.LOGIN_URL_SUFFIX = LOGIN_URL_SUFFIX;
exports.MODERATOR_URL_SUFFIX = MODERATOR_URL_SUFFIX;
exports.ADMIN_URL_SUFFIX = ADMIN_URL_SUFFIX;
exports.DONATION_THANK_URL_SUFFIX = DONATION_THANK_URL_SUFFIX;
exports.SCRIPTS_URL_SLICE = SCRIPTS_URL_SLICE;
exports.FIRST_STATE_DEFAULT_NAME = FIRST_STATE_DEFAULT_NAME;
exports.getExplorationIdFromEditor = getExplorationIdFromEditor;
exports.getExplorationIdFromPlayer = getExplorationIdFromPlayer;
exports.openEditor = openEditor;
exports.openPlayer = openPlayer;
exports.moveToPlayer = moveToPlayer;
exports.moveToEditor = moveToEditor;
exports.expect404Error = expect404Error;
exports.ensurePageHasNoTranslationIds = ensurePageHasNoTranslationIds;
| Java |
package org.jetbrains.plugins.scala.lang.formatter;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.EditorFactory;
import com.intellij.openapi.editor.impl.DocumentImpl;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
import com.intellij.testFramework.LightIdeaTestCase;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.plugins.scala.ScalaLanguage;
import org.jetbrains.plugins.scala.lang.formatting.settings.ScalaCodeStyleSettings;
import org.jetbrains.plugins.scala.util.TestUtils;
import java.io.File;
import java.util.EnumMap;
import java.util.Map;
/**
* Base class for java formatter tests that holds utility methods.
*
* @author Denis Zhdanov
* @since Apr 27, 2010 6:26:29 PM
*/
//todo: almost duplicate from Java
public abstract class AbstractScalaFormatterTestBase extends LightIdeaTestCase {
protected enum Action {REFORMAT, INDENT}
private interface TestFormatAction {
void run(PsiFile psiFile, int startOffset, int endOffset);
}
private static final Map<Action, TestFormatAction> ACTIONS = new EnumMap<Action, TestFormatAction>(Action.class);
static {
ACTIONS.put(Action.REFORMAT, new TestFormatAction() {
public void run(PsiFile psiFile, int startOffset, int endOffset) {
CodeStyleManager.getInstance(getProject()).reformatText(psiFile, startOffset, endOffset);
}
});
ACTIONS.put(Action.INDENT, new TestFormatAction() {
public void run(PsiFile psiFile, int startOffset, int endOffset) {
CodeStyleManager.getInstance(getProject()).adjustLineIndent(psiFile, startOffset);
}
});
}
private static final String BASE_PATH = TestUtils.getTestDataPath() + "/psi/formatter";
public TextRange myTextRange;
public TextRange myLineRange;
public CommonCodeStyleSettings getCommonSettings() {
return getSettings().getCommonSettings(ScalaLanguage.INSTANCE);
}
public ScalaCodeStyleSettings getScalaSettings() {
return getSettings().getCustomSettings(ScalaCodeStyleSettings.class);
}
public CodeStyleSettings getSettings() {
return CodeStyleSettingsManager.getSettings(getProject());
}
public CommonCodeStyleSettings.IndentOptions getIndentOptions() {
return getCommonSettings().getIndentOptions();
}
public void doTest() throws Exception {
doTest(getTestName(false) + ".scala", getTestName(false) + "_after.scala");
}
public void doTest(String fileNameBefore, String fileNameAfter) throws Exception {
doTextTest(Action.REFORMAT, loadFile(fileNameBefore), loadFile(fileNameAfter));
}
public void doTextTest(final String text, String textAfter) throws IncorrectOperationException {
doTextTest(Action.REFORMAT, StringUtil.convertLineSeparators(text), StringUtil.convertLineSeparators(textAfter));
}
public void doTextTest(final Action action, final String text, String textAfter) throws IncorrectOperationException {
final PsiFile file = createFile("A.scala", text);
if (myLineRange != null) {
final DocumentImpl document = new DocumentImpl(text);
myTextRange =
new TextRange(document.getLineStartOffset(myLineRange.getStartOffset()), document.getLineEndOffset(myLineRange.getEndOffset()));
}
/*
CommandProcessor.getInstance().executeCommand(getProject(), new Runnable() {
public void run() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
performFormatting(file);
}
});
}
}, null, null);
assertEquals(prepareText(textAfter), prepareText(file.getText()));
*/
final PsiDocumentManager manager = PsiDocumentManager.getInstance(getProject());
final Document document = manager.getDocument(file);
CommandProcessor.getInstance().executeCommand(getProject(), new Runnable() {
public void run() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
document.replaceString(0, document.getTextLength(), text);
manager.commitDocument(document);
try {
TextRange rangeToUse = myTextRange;
if (rangeToUse == null) {
rangeToUse = file.getTextRange();
}
ACTIONS.get(action).run(file, rangeToUse.getStartOffset(), rangeToUse.getEndOffset());
}
catch (IncorrectOperationException e) {
assertTrue(e.getLocalizedMessage(), false);
}
}
});
}
}, "", "");
if (document == null) {
fail("Don't expect the document to be null");
return;
}
assertEquals(prepareText(textAfter), prepareText(document.getText()));
manager.commitDocument(document);
assertEquals(prepareText(textAfter), prepareText(file.getText()));
}
//todo: was unused, should be deleted (??)
/* public void doMethodTest(final String before, final String after) throws Exception {
doTextTest(
Action.REFORMAT,
"class Foo{\n" + " void foo() {\n" + before + '\n' + " }\n" + "}",
"class Foo {\n" + " void foo() {\n" + shiftIndentInside(after, 8, false) + '\n' + " }\n" + "}"
);
}
public void doClassTest(final String before, final String after) throws Exception {
doTextTest(
Action.REFORMAT,
"class Foo{\n" + before + '\n' + "}",
"class Foo {\n" + shiftIndentInside(after, 4, false) + '\n' + "}"
);
}*/
private static String prepareText(String actual) {
if (actual.startsWith("\n")) {
actual = actual.substring(1);
}
if (actual.startsWith("\n")) {
actual = actual.substring(1);
}
// Strip trailing spaces
final Document doc = EditorFactory.getInstance().createDocument(actual);
CommandProcessor.getInstance().executeCommand(getProject(), new Runnable() {
public void run() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
((DocumentImpl)doc).stripTrailingSpaces(getProject());
}
});
}
}, "formatting", null);
return doc.getText().trim();
}
private static String loadFile(String name) throws Exception {
String fullName = BASE_PATH + File.separatorChar + name;
String text = new String(FileUtil.loadFileText(new File(fullName)));
text = StringUtil.convertLineSeparators(text);
return text;
}
@Override
protected void setUp() throws Exception {
super.setUp();
TestUtils.disableTimerThread();
}
}
| Java |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>HashGroupify (ARX Developer Documentation)</title>
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="HashGroupify (ARX Developer Documentation)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/HashGroupify.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev Class</li>
<li><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/HashGroupify.GroupStatistics.html" title="class in org.deidentifier.arx.framework.check.groupify"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/deidentifier/arx/framework/check/groupify/HashGroupify.html" target="_top">Frames</a></li>
<li><a href="HashGroupify.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li><a href="#nested_class_summary">Nested</a> | </li>
<li>Field | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.deidentifier.arx.framework.check.groupify</div>
<h2 title="Class HashGroupify" class="title">Class HashGroupify</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.deidentifier.arx.framework.check.groupify.HashGroupify</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html" title="interface in org.deidentifier.arx.framework.check.groupify">IHashGroupify</a></dd>
</dl>
<hr>
<br>
<pre>public class <span class="strong">HashGroupify</span>
extends java.lang.Object
implements <a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html" title="interface in org.deidentifier.arx.framework.check.groupify">IHashGroupify</a></pre>
<div class="block">A hash groupify operator. It implements a hash table with chaining and keeps
track of additional properties per equivalence class</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested_class_summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation">
<caption><span>Nested Classes</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class </code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/HashGroupify.GroupStatistics.html" title="class in org.deidentifier.arx.framework.check.groupify">HashGroupify.GroupStatistics</a></strong></code>
<div class="block">Statistics about the groups, excluding outliers.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/HashGroupify.html#HashGroupify(int,%20org.deidentifier.arx.ARXConfiguration.ARXConfigurationInternal)">HashGroupify</a></strong>(int capacity,
<a href="../../../../../../org/deidentifier/arx/ARXConfiguration.ARXConfigurationInternal.html" title="class in org.deidentifier.arx">ARXConfiguration.ARXConfigurationInternal</a> config)</code>
<div class="block">Constructs a new hash groupify operator.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/HashGroupify.html#addAll(int[],%20int,%20int,%20int[],%20int)">addAll</a></strong>(int[] key,
int representant,
int count,
int[] sensitive,
int pcount)</code>
<div class="block">Generic adder for all combinations of criteria in mode transform ALL.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/HashGroupify.html#addGroupify(int[],%20int,%20int,%20org.deidentifier.arx.framework.check.distribution.Distribution[],%20int)">addGroupify</a></strong>(int[] key,
int representant,
int count,
<a href="../../../../../../org/deidentifier/arx/framework/check/distribution/Distribution.html" title="class in org.deidentifier.arx.framework.check.distribution">Distribution</a>[] distributions,
int pcount)</code>
<div class="block">Generic adder for all combinations of criteria in mode transform GROUPIFY.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/HashGroupify.html#addSnapshot(int[],%20int,%20int,%20int[][],%20int[][],%20int)">addSnapshot</a></strong>(int[] key,
int representant,
int count,
int[][] elements,
int[][] frequencies,
int pcount)</code>
<div class="block">Generic adder for all combinations of criteria in mode transform SNAPSHOT.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/HashGroupify.html#analyze(org.deidentifier.arx.framework.lattice.Node,%20boolean)">analyze</a></strong>(<a href="../../../../../../org/deidentifier/arx/framework/lattice/Node.html" title="class in org.deidentifier.arx.framework.lattice">Node</a> transformation,
boolean force)</code>
<div class="block">Computes the anonymity properties and suppressed tuples etc.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/HashGroupify.html#clear()">clear</a></strong>()</code>
<div class="block">Clear.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/HashGroupifyEntry.html" title="class in org.deidentifier.arx.framework.check.groupify">HashGroupifyEntry</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/HashGroupify.html#getFirstEntry()">getFirstEntry</a></strong>()</code>
<div class="block">Gets the first entry.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/HashGroupify.GroupStatistics.html" title="class in org.deidentifier.arx.framework.check.groupify">HashGroupify.GroupStatistics</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/HashGroupify.html#getGroupStatistics()">getGroupStatistics</a></strong>()</code>
<div class="block">Returns statistics about the groups.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/HashGroupify.html#isAnonymous()">isAnonymous</a></strong>()</code>
<div class="block">Are all defined privacy criteria fulfilled by this transformation, given the specified limit on suppressed tuples.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/HashGroupify.html#isKAnonymous()">isKAnonymous</a></strong>()</code>
<div class="block">Is the current transformation k-anonymous.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/HashGroupify.html#markOutliers(int[][])">markOutliers</a></strong>(int[][] data)</code>
<div class="block">Marks all outliers.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/HashGroupify.html#resetSuppression()">resetSuppression</a></strong>()</code>
<div class="block">This method will reset all flags that indicate that equivalence classes are suppressed.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/HashGroupify.html#size()">size</a></strong>()</code>
<div class="block">Size.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="HashGroupify(int, org.deidentifier.arx.ARXConfiguration.ARXConfigurationInternal)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>HashGroupify</h4>
<pre>public HashGroupify(int capacity,
<a href="../../../../../../org/deidentifier/arx/ARXConfiguration.ARXConfigurationInternal.html" title="class in org.deidentifier.arx">ARXConfiguration.ARXConfigurationInternal</a> config)</pre>
<div class="block">Constructs a new hash groupify operator.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>capacity</code> - The capacity</dd><dd><code>config</code> - The config</dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="addAll(int[], int, int, int[], int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addAll</h4>
<pre>public void addAll(int[] key,
int representant,
int count,
int[] sensitive,
int pcount)</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#addAll(int[],%20int,%20int,%20int[],%20int)">IHashGroupify</a></code></strong></div>
<div class="block">Generic adder for all combinations of criteria in mode transform ALL.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#addAll(int[],%20int,%20int,%20int[],%20int)">addAll</a></code> in interface <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html" title="interface in org.deidentifier.arx.framework.check.groupify">IHashGroupify</a></code></dd>
</dl>
</li>
</ul>
<a name="addGroupify(int[], int, int, org.deidentifier.arx.framework.check.distribution.Distribution[], int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addGroupify</h4>
<pre>public void addGroupify(int[] key,
int representant,
int count,
<a href="../../../../../../org/deidentifier/arx/framework/check/distribution/Distribution.html" title="class in org.deidentifier.arx.framework.check.distribution">Distribution</a>[] distributions,
int pcount)</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#addGroupify(int[],%20int,%20int,%20org.deidentifier.arx.framework.check.distribution.Distribution[],%20int)">IHashGroupify</a></code></strong></div>
<div class="block">Generic adder for all combinations of criteria in mode transform GROUPIFY.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#addGroupify(int[],%20int,%20int,%20org.deidentifier.arx.framework.check.distribution.Distribution[],%20int)">addGroupify</a></code> in interface <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html" title="interface in org.deidentifier.arx.framework.check.groupify">IHashGroupify</a></code></dd>
</dl>
</li>
</ul>
<a name="addSnapshot(int[], int, int, int[][], int[][], int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addSnapshot</h4>
<pre>public void addSnapshot(int[] key,
int representant,
int count,
int[][] elements,
int[][] frequencies,
int pcount)</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#addSnapshot(int[],%20int,%20int,%20int[][],%20int[][],%20int)">IHashGroupify</a></code></strong></div>
<div class="block">Generic adder for all combinations of criteria in mode transform SNAPSHOT.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#addSnapshot(int[],%20int,%20int,%20int[][],%20int[][],%20int)">addSnapshot</a></code> in interface <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html" title="interface in org.deidentifier.arx.framework.check.groupify">IHashGroupify</a></code></dd>
</dl>
</li>
</ul>
<a name="analyze(org.deidentifier.arx.framework.lattice.Node, boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>analyze</h4>
<pre>public void analyze(<a href="../../../../../../org/deidentifier/arx/framework/lattice/Node.html" title="class in org.deidentifier.arx.framework.lattice">Node</a> transformation,
boolean force)</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#analyze(org.deidentifier.arx.framework.lattice.Node,%20boolean)">IHashGroupify</a></code></strong></div>
<div class="block">Computes the anonymity properties and suppressed tuples etc. Must be called
when all tuples have been passed to the operator. When the flag is set to true
the method will make sure that all equivalence classes that do not fulfill all
privacy criteria are marked for suppression. If the flag is set to false,
the operator may perform an early abort, which may lead to an inconsistent classification
of equivalence classes.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#analyze(org.deidentifier.arx.framework.lattice.Node,%20boolean)">analyze</a></code> in interface <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html" title="interface in org.deidentifier.arx.framework.check.groupify">IHashGroupify</a></code></dd>
</dl>
</li>
</ul>
<a name="clear()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>clear</h4>
<pre>public void clear()</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#clear()">IHashGroupify</a></code></strong></div>
<div class="block">Clear.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#clear()">clear</a></code> in interface <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html" title="interface in org.deidentifier.arx.framework.check.groupify">IHashGroupify</a></code></dd>
</dl>
</li>
</ul>
<a name="getFirstEntry()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getFirstEntry</h4>
<pre>public <a href="../../../../../../org/deidentifier/arx/framework/check/groupify/HashGroupifyEntry.html" title="class in org.deidentifier.arx.framework.check.groupify">HashGroupifyEntry</a> getFirstEntry()</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#getFirstEntry()">IHashGroupify</a></code></strong></div>
<div class="block">Gets the first entry.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#getFirstEntry()">getFirstEntry</a></code> in interface <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html" title="interface in org.deidentifier.arx.framework.check.groupify">IHashGroupify</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>the first entry</dd></dl>
</li>
</ul>
<a name="getGroupStatistics()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getGroupStatistics</h4>
<pre>public <a href="../../../../../../org/deidentifier/arx/framework/check/groupify/HashGroupify.GroupStatistics.html" title="class in org.deidentifier.arx.framework.check.groupify">HashGroupify.GroupStatistics</a> getGroupStatistics()</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#getGroupStatistics()">IHashGroupify</a></code></strong></div>
<div class="block">Returns statistics about the groups.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#getGroupStatistics()">getGroupStatistics</a></code> in interface <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html" title="interface in org.deidentifier.arx.framework.check.groupify">IHashGroupify</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd></dd></dl>
</li>
</ul>
<a name="isAnonymous()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isAnonymous</h4>
<pre>public boolean isAnonymous()</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#isAnonymous()">IHashGroupify</a></code></strong></div>
<div class="block">Are all defined privacy criteria fulfilled by this transformation, given the specified limit on suppressed tuples.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#isAnonymous()">isAnonymous</a></code> in interface <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html" title="interface in org.deidentifier.arx.framework.check.groupify">IHashGroupify</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>true, if successful</dd></dl>
</li>
</ul>
<a name="isKAnonymous()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isKAnonymous</h4>
<pre>public boolean isKAnonymous()</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#isKAnonymous()">IHashGroupify</a></code></strong></div>
<div class="block">Is the current transformation k-anonymous. Always returns true, if no k-anonymity (sub-)criterion was specified</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#isKAnonymous()">isKAnonymous</a></code> in interface <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html" title="interface in org.deidentifier.arx.framework.check.groupify">IHashGroupify</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd></dd></dl>
</li>
</ul>
<a name="markOutliers(int[][])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>markOutliers</h4>
<pre>public void markOutliers(int[][] data)</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#markOutliers(int[][])">IHashGroupify</a></code></strong></div>
<div class="block">Marks all outliers.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#markOutliers(int[][])">markOutliers</a></code> in interface <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html" title="interface in org.deidentifier.arx.framework.check.groupify">IHashGroupify</a></code></dd>
</dl>
</li>
</ul>
<a name="resetSuppression()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>resetSuppression</h4>
<pre>public void resetSuppression()</pre>
<div class="block">This method will reset all flags that indicate that equivalence classes are suppressed.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#resetSuppression()">resetSuppression</a></code> in interface <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html" title="interface in org.deidentifier.arx.framework.check.groupify">IHashGroupify</a></code></dd>
</dl>
</li>
</ul>
<a name="size()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>size</h4>
<pre>public int size()</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#size()">IHashGroupify</a></code></strong></div>
<div class="block">Size.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html#size()">size</a></code> in interface <code><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/IHashGroupify.html" title="interface in org.deidentifier.arx.framework.check.groupify">IHashGroupify</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>the int</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/HashGroupify.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev Class</li>
<li><a href="../../../../../../org/deidentifier/arx/framework/check/groupify/HashGroupify.GroupStatistics.html" title="class in org.deidentifier.arx.framework.check.groupify"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/deidentifier/arx/framework/check/groupify/HashGroupify.html" target="_top">Frames</a></li>
<li><a href="HashGroupify.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li><a href="#nested_class_summary">Nested</a> | </li>
<li>Field | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| Java |
<?php
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* see
* http://www.opensocial.org/Technical-Resources/opensocial-spec-v081/opensocial-reference#opensocial.Activity
*/
class Shindig_Activity {
public $appId;
public $body;
public $bodyId;
public $externalId;
public $id;
public $mediaItems;
public $postedTime;
public $priority;
public $streamFaviconUrl;
public $streamSourceUrl;
public $streamTitle;
public $streamUrl;
public $templateParams;
public $title;
public $titleId;
public $url;
public $userId;
public function __construct($id, $userId) {
$this->id = $id;
$this->userId = $userId;
}
public function getAppId() {
return $this->appId;
}
public function setAppId($appId) {
$this->appId = $appId;
}
public function getBody() {
return $this->body;
}
public function setBody($body) {
$this->body = $body;
}
public function getBodyId() {
return $this->bodyId;
}
public function setBodyId($bodyId) {
$this->bodyId = $bodyId;
}
public function getExternalId() {
return $this->externalId;
}
public function setExternalId($externalId) {
$this->externalId = $externalId;
}
public function getId() {
return $this->id;
}
public function setId($id) {
$this->id = $id;
}
public function getMediaItems() {
return $this->mediaItems;
}
public function setMediaItems($mediaItems) {
$this->mediaItems = $mediaItems;
}
public function getPostedTime() {
return $this->postedTime;
}
public function setPostedTime($postedTime) {
$this->postedTime = $postedTime;
}
public function getPriority() {
return $this->priority;
}
public function setPriority($priority) {
$this->priority = $priority;
}
public function getStreamFaviconUrl() {
return $this->streamFaviconUrl;
}
public function setStreamFaviconUrl($streamFaviconUrl) {
$this->streamFaviconUrl = $streamFaviconUrl;
}
public function getStreamSourceUrl() {
return $this->streamSourceUrl;
}
public function setStreamSourceUrl($streamSourceUrl) {
$this->streamSourceUrl = $streamSourceUrl;
}
public function getStreamTitle() {
return $this->streamTitle;
}
public function setStreamTitle($streamTitle) {
$this->streamTitle = $streamTitle;
}
public function getStreamUrl() {
return $this->streamUrl;
}
public function setStreamUrl($streamUrl) {
$this->streamUrl = $streamUrl;
}
public function getTemplateParams() {
return $this->templateParams;
}
public function setTemplateParams($templateParams) {
$this->templateParams = $templateParams;
}
public function getTitle() {
return $this->title;
}
public function setTitle($title) {
$this->title = strip_tags($title, '<b><i><a><span><img>');
}
public function getTitleId() {
return $this->titleId;
}
public function setTitleId($titleId) {
$this->titleId = $titleId;
}
public function getUrl() {
return $this->url;
}
public function setUrl($url) {
$this->url = $url;
}
public function getUserId() {
return $this->userId;
}
public function setUserId($userId) {
$this->userId = $userId;
}
}
| Java |
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.openapi.module.impl.scopes;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.*;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.util.containers.ContainerUtil;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
import java.util.*;
/**
* @author max
*/
public class LibraryRuntimeClasspathScope extends GlobalSearchScope {
private final ProjectFileIndex myIndex;
private final LinkedHashSet<VirtualFile> myEntries = new LinkedHashSet<VirtualFile>();
private int myCachedHashCode = 0;
public LibraryRuntimeClasspathScope(final Project project, final List<Module> modules) {
super(project);
myIndex = ProjectRootManager.getInstance(project).getFileIndex();
final Set<Sdk> processedSdk = new THashSet<Sdk>();
final Set<Library> processedLibraries = new THashSet<Library>();
final Set<Module> processedModules = new THashSet<Module>();
final Condition<OrderEntry> condition = new Condition<OrderEntry>() {
@Override
public boolean value(OrderEntry orderEntry) {
if (orderEntry instanceof ModuleOrderEntry) {
final Module module = ((ModuleOrderEntry)orderEntry).getModule();
return module != null && !processedModules.contains(module);
}
return true;
}
};
for (Module module : modules) {
buildEntries(module, processedModules, processedLibraries, processedSdk, condition);
}
}
public LibraryRuntimeClasspathScope(Project project, LibraryOrderEntry entry) {
super(project);
myIndex = ProjectRootManager.getInstance(project).getFileIndex();
Collections.addAll(myEntries, entry.getRootFiles(OrderRootType.CLASSES));
}
public int hashCode() {
if (myCachedHashCode == 0) {
myCachedHashCode = myEntries.hashCode();
}
return myCachedHashCode;
}
public boolean equals(Object object) {
if (object == this) return true;
if (object == null || object.getClass() != LibraryRuntimeClasspathScope.class) return false;
final LibraryRuntimeClasspathScope that = (LibraryRuntimeClasspathScope)object;
return that.myEntries.equals(myEntries);
}
private void buildEntries(@NotNull final Module module,
@NotNull final Set<Module> processedModules,
@NotNull final Set<Library> processedLibraries,
@NotNull final Set<Sdk> processedSdk,
Condition<OrderEntry> condition) {
if (!processedModules.add(module)) return;
ModuleRootManager.getInstance(module).orderEntries().recursively().satisfying(condition).process(new RootPolicy<LinkedHashSet<VirtualFile>>() {
public LinkedHashSet<VirtualFile> visitLibraryOrderEntry(final LibraryOrderEntry libraryOrderEntry,
final LinkedHashSet<VirtualFile> value) {
final Library library = libraryOrderEntry.getLibrary();
if (library != null && processedLibraries.add(library)) {
ContainerUtil.addAll(value, libraryOrderEntry.getRootFiles(OrderRootType.CLASSES));
}
return value;
}
public LinkedHashSet<VirtualFile> visitModuleSourceOrderEntry(final ModuleSourceOrderEntry moduleSourceOrderEntry,
final LinkedHashSet<VirtualFile> value) {
processedModules.add(moduleSourceOrderEntry.getOwnerModule());
ContainerUtil.addAll(value, moduleSourceOrderEntry.getRootModel().getSourceRoots());
return value;
}
@Override
public LinkedHashSet<VirtualFile> visitModuleOrderEntry(ModuleOrderEntry moduleOrderEntry, LinkedHashSet<VirtualFile> value) {
final Module depModule = moduleOrderEntry.getModule();
if (depModule != null) {
ContainerUtil.addAll(value, ModuleRootManager.getInstance(depModule).getSourceRoots());
}
return value;
}
public LinkedHashSet<VirtualFile> visitJdkOrderEntry(final JdkOrderEntry jdkOrderEntry, final LinkedHashSet<VirtualFile> value) {
final Sdk jdk = jdkOrderEntry.getJdk();
if (jdk != null && processedSdk.add(jdk)) {
ContainerUtil.addAll(value, jdkOrderEntry.getRootFiles(OrderRootType.CLASSES));
}
return value;
}
}, myEntries);
}
public boolean contains(VirtualFile file) {
return myEntries.contains(getFileRoot(file));
}
@Nullable
private VirtualFile getFileRoot(VirtualFile file) {
if (myIndex.isLibraryClassFile(file)) {
return myIndex.getClassRootForFile(file);
}
if (myIndex.isInContent(file)) {
return myIndex.getSourceRootForFile(file);
}
if (myIndex.isInLibraryClasses(file)) {
return myIndex.getClassRootForFile(file);
}
return null;
}
public int compare(VirtualFile file1, VirtualFile file2) {
final VirtualFile r1 = getFileRoot(file1);
final VirtualFile r2 = getFileRoot(file2);
for (VirtualFile root : myEntries) {
if (Comparing.equal(r1, root)) return 1;
if (Comparing.equal(r2, root)) return -1;
}
return 0;
}
@TestOnly
public List<VirtualFile> getRoots() {
return new ArrayList<VirtualFile>(myEntries);
}
public boolean isSearchInModuleContent(@NotNull Module aModule) {
return false;
}
public boolean isSearchInLibraries() {
return true;
}
}
| Java |
/**
* Copyright (C) 2013-2014 EaseMob Technologies. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*******************************************************************************
* Copyright 2011, 2012 Chris Banes.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package com.easemob.chatuidemo.widget.photoview;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.widget.OverScroller;
import android.widget.Scroller;
public abstract class ScrollerProxy {
public static ScrollerProxy getScroller(Context context) {
if (VERSION.SDK_INT < VERSION_CODES.GINGERBREAD) {
return new PreGingerScroller(context);
} else {
return new GingerScroller(context);
}
}
public abstract boolean computeScrollOffset();
public abstract void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY,
int maxY, int overX, int overY);
public abstract void forceFinished(boolean finished);
public abstract int getCurrX();
public abstract int getCurrY();
@TargetApi(9)
private static class GingerScroller extends ScrollerProxy {
private OverScroller mScroller;
public GingerScroller(Context context) {
mScroller = new OverScroller(context);
}
@Override
public boolean computeScrollOffset() {
return mScroller.computeScrollOffset();
}
@Override
public void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY, int maxY,
int overX, int overY) {
mScroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY, overX, overY);
}
@Override
public void forceFinished(boolean finished) {
mScroller.forceFinished(finished);
}
@Override
public int getCurrX() {
return mScroller.getCurrX();
}
@Override
public int getCurrY() {
return mScroller.getCurrY();
}
}
private static class PreGingerScroller extends ScrollerProxy {
private Scroller mScroller;
public PreGingerScroller(Context context) {
mScroller = new Scroller(context);
}
@Override
public boolean computeScrollOffset() {
return mScroller.computeScrollOffset();
}
@Override
public void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY, int maxY,
int overX, int overY) {
mScroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY);
}
@Override
public void forceFinished(boolean finished) {
mScroller.forceFinished(finished);
}
@Override
public int getCurrX() {
return mScroller.getCurrX();
}
@Override
public int getCurrY() {
return mScroller.getCurrY();
}
}
}
| Java |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.druid.sql.calcite.expression.builtin;
import org.apache.calcite.rex.RexCall;
import org.apache.calcite.rex.RexLiteral;
import org.apache.calcite.rex.RexNode;
import org.apache.calcite.sql.SqlOperator;
import org.apache.calcite.sql.fun.SqlStdOperatorTable;
import org.apache.druid.query.filter.DimFilter;
import org.apache.druid.query.filter.LikeDimFilter;
import org.apache.druid.segment.VirtualColumn;
import org.apache.druid.segment.column.RowSignature;
import org.apache.druid.sql.calcite.expression.DirectOperatorConversion;
import org.apache.druid.sql.calcite.expression.DruidExpression;
import org.apache.druid.sql.calcite.expression.Expressions;
import org.apache.druid.sql.calcite.planner.PlannerContext;
import org.apache.druid.sql.calcite.rel.VirtualColumnRegistry;
import javax.annotation.Nullable;
import java.util.List;
public class LikeOperatorConversion extends DirectOperatorConversion
{
private static final SqlOperator SQL_FUNCTION = SqlStdOperatorTable.LIKE;
public LikeOperatorConversion()
{
super(SQL_FUNCTION, "like");
}
@Override
public SqlOperator calciteOperator()
{
return SQL_FUNCTION;
}
@Nullable
@Override
public DimFilter toDruidFilter(
PlannerContext plannerContext,
RowSignature rowSignature,
@Nullable VirtualColumnRegistry virtualColumnRegistry,
RexNode rexNode
)
{
final List<RexNode> operands = ((RexCall) rexNode).getOperands();
final DruidExpression druidExpression = Expressions.toDruidExpression(
plannerContext,
rowSignature,
operands.get(0)
);
if (druidExpression == null) {
return null;
}
if (druidExpression.isSimpleExtraction()) {
return new LikeDimFilter(
druidExpression.getSimpleExtraction().getColumn(),
RexLiteral.stringValue(operands.get(1)),
operands.size() > 2 ? RexLiteral.stringValue(operands.get(2)) : null,
druidExpression.getSimpleExtraction().getExtractionFn()
);
} else if (virtualColumnRegistry != null) {
VirtualColumn v = virtualColumnRegistry.getOrCreateVirtualColumnForExpression(
plannerContext,
druidExpression,
operands.get(0).getType().getSqlTypeName()
);
return new LikeDimFilter(
v.getOutputName(),
RexLiteral.stringValue(operands.get(1)),
operands.size() > 2 ? RexLiteral.stringValue(operands.get(2)) : null,
null
);
} else {
return null;
}
}
}
| Java |
/// Copyright (c) 2009 Microsoft Corporation
///
/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
/// that the following conditions are met:
/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
/// the following disclaimer.
/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
/// the following disclaimer in the documentation and/or other materials provided with the distribution.
/// * Neither the name of Microsoft nor the names of its contributors may be used to
/// endorse or promote products derived from this software without specific prior written permission.
///
/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ES5Harness.registerTest({
id: "15.2.3.6-3-37",
path: "TestCases/chapter15/15.2/15.2.3/15.2.3.6/15.2.3.6-3-37.js",
description: "Object.defineProperty - 'Attributes' is a Number object that uses Object's [[Get]] method to access the 'enumerable' property (8.10.5 step 3.a)",
test: function testcase() {
var obj = {};
var accessed = false;
var numObj = new Number(-2);
numObj.enumerable = true;
Object.defineProperty(obj, "property", numObj);
for (var prop in obj) {
if (prop === "property") {
accessed = true;
}
}
return accessed;
},
precondition: function prereq() {
return fnExists(Object.defineProperty);
}
});
| Java |
# Apache Aurora development environment
This directory contains [Packer](https://packer.io) scripts
to build and distribute the base development environment for Aurora.
The goal of this environment is to pre-fetch dependencies and artifacts
needed for the integration test environment so that `vagrant up` is
cheap after the box has been fetched for the first time.
As dependencies (libraries, or external packages) of Aurora change, it
will be helpful to update this box and keep this cost low.
## Updating the box
1. Download [packer](https://www.packer.io/downloads.html)
2. Modify build scripts to make the changes you want
(e.g. install packages via `apt`)
3. Fetch the latest version of our base box
$ vagrant box update --box bento/ubuntu-16.04
The box will be stored in version-specific directory under
`~/.vagrant.d/boxes/bento-VAGRANTSLASH-ubuntu-16.04/`. Find the path to the `.ovf` file for the
latest version of the box. For the remainder of this document, this path will be referred to as
`$UBUNTU_OVF`.
4. Build the new box
Using the path from the previous step, run the following command to start the build.
$ packer build -var "base_box_ovf=$UBUNTU_OVF" aurora.json
This takes a while, approximately 20 minutes. When finished, your working directory will
contain a file named `packer_virtualbox-ovf_virtualbox.box`.
5. Verify your box locally
$ vagrant box add --name aurora-dev-env-testing \
packer_virtualbox-ovf_virtualbox.box
This will make a vagrant box named `aurora-dev-env-testing` locally available to vagrant
(i.e. not on Vagrant Cloud). We use a different name here to avoid confusion that could
arise from using an unreleased base box.
Edit the [`Vagrantfile`](../../Vagrantfile), changing the line
config.vm.box = "apache-aurora/dev-environment"
to
config.vm.box = "aurora-dev-env-testing"
and comment out vm version
# config.vm.box_version = "0.0.X"
At this point, you can use the box as normal to run integration tests.
6. Upload the box to Vagrant Cloud
Our boxes are stored in [Vagrant Cloud](https://vagrantcloud.com/apache-aurora/dev-environment).
In order to upload a new version of our box, you must have committer access to upload
a dev image box, please ask in [email protected] or our Slack Channel
if you would like to contribute. More info can be found by visiting our
[community page](http://aurora.apache.org/community/).
Once you have access to our Vagrant Cloud organization, a token can be generated by
going to your [security settings](https://app.vagrantup.com/settings/security).
Store the token in a safe place as it will be needed for future submissions.
Next, three environmental variables must be set: `$UBUNTU_OVF`, `$VAGRANT_CLOUD_TOKEN`,
and `$BOX_VERSION`.
$ export UBUNTU_OVF=<Location of base image (.ovf) on local machine>
$ export VAGRANT_CLOUD_TOKEN=<API Token from Hashicorp>
$ export BOX_VERSION=<SemVer to be given to this box>
**Make sure the variables are set correctly before proceeding as a mistake can cause
the very time consuming process to fail or clobber a previous box.**
$ env | grep -E "UBUNTU_OVF|VAGRANT_CLOUD_TOKEN|BOX_VERSION"
Then finally run the release packer configuration which will upload the vagrant box.
$ packer build aurora-release.json
Note: This process will rebuild the box and upload it to the Vagrant Cloud. Unfortunately,
there currently is no way to skip the build step as the output from the first post-processor
(Vagrant) is required for the second (Vagrant-Cloud).
You may now change the version in [`Vagrantfile`](../../Vagrantfile) to the one specified in
`$BOX_VERSION` and commit the change.
| Java |
/*
* Copyright (C) 2015 The Guava Authors
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.common.collect.testing;
import com.google.common.annotations.GwtIncompatible;
import java.util.List;
/**
* Creates, based on your criteria, a JUnit test suite that exhaustively tests
* a ConcurrentNavigableMap implementation.
*
* @author Louis Wasserman
*/
@GwtIncompatible
public class ConcurrentNavigableMapTestSuiteBuilder<K, V>
extends NavigableMapTestSuiteBuilder<K, V> {
public static <K, V> ConcurrentNavigableMapTestSuiteBuilder<K, V> using(
TestSortedMapGenerator<K, V> generator) {
ConcurrentNavigableMapTestSuiteBuilder<K, V> result =
new ConcurrentNavigableMapTestSuiteBuilder<K, V>();
result.usingGenerator(generator);
return result;
}
@Override
protected List<Class<? extends AbstractTester>> getTesters() {
List<Class<? extends AbstractTester>> testers = Helpers.copyToList(super.getTesters());
testers.addAll(ConcurrentMapTestSuiteBuilder.TESTERS);
return testers;
}
@Override
NavigableMapTestSuiteBuilder<K, V> subSuiteUsing(TestSortedMapGenerator<K, V> generator) {
return using(generator);
}
}
| Java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.