You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by om...@apache.org on 2015/06/22 22:17:26 UTC
[48/51] [partial] orc git commit: ORC-3. Import c++ code from github.
http://git-wip-us.apache.org/repos/asf/orc/blob/7de5d89d/c++/include/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/c++/include/CMakeLists.txt b/c++/include/CMakeLists.txt
new file mode 100644
index 0000000..474c733
--- /dev/null
+++ b/c++/include/CMakeLists.txt
@@ -0,0 +1,82 @@
+# 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.
+
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAGS} ${WARN_FLAGS}")
+
+INCLUDE(CheckCXXSourceCompiles)
+
+CHECK_CXX_SOURCE_COMPILES("
+ #include <initializer_list>
+ struct A {
+ A(std::initializer_list<int> list);
+ };
+ int main(int,char*[]){
+ }"
+ ORC_CXX_HAS_INITIALIZER_LIST
+)
+
+CHECK_CXX_SOURCE_COMPILES("
+ int main(int,char*[]) noexcept {
+ return 0;
+ }"
+ ORC_CXX_HAS_NOEXCEPT
+)
+
+CHECK_CXX_SOURCE_COMPILES("
+ int main(int,char* argv[]){
+ return argv[0] != nullptr;
+ }"
+ ORC_CXX_HAS_NULLPTR
+)
+
+CHECK_CXX_SOURCE_COMPILES("
+ struct A {
+ virtual ~A();
+ virtual void foo();
+ };
+ struct B: public A {
+ virtual void foo() override;
+ };
+ int main(int,char*[]){
+ }"
+ ORC_CXX_HAS_OVERRIDE
+)
+
+CHECK_CXX_SOURCE_COMPILES("
+ #include<memory>
+ int main(int,char* []){
+ std::unique_ptr<int> ptr(new int);
+ }"
+ ORC_CXX_HAS_UNIQUE_PTR
+)
+
+CHECK_CXX_SOURCE_COMPILES("
+ #include <cstdint>
+ int main(int, char*[]) { }"
+ ORC_CXX_HAS_CSTDINT
+)
+
+configure_file (
+ "orc/orc-config.hh.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/orc/orc-config.hh"
+ )
+
+install(FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/orc/orc-config.hh"
+ "orc/ColumnPrinter.hh"
+ "orc/Int128.hh"
+ "orc/MemoryPool.hh"
+ "orc/OrcFile.hh"
+ "orc/Reader.hh"
+ "orc/Vector.hh"
+ DESTINATION "include/orc"
+ )
http://git-wip-us.apache.org/repos/asf/orc/blob/7de5d89d/c++/include/orc/ColumnPrinter.hh
----------------------------------------------------------------------
diff --git a/c++/include/orc/ColumnPrinter.hh b/c++/include/orc/ColumnPrinter.hh
new file mode 100644
index 0000000..17c1901
--- /dev/null
+++ b/c++/include/orc/ColumnPrinter.hh
@@ -0,0 +1,52 @@
+/**
+ * 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.
+ */
+
+#ifndef ORC_COLUMN_PRINTER_HH
+#define ORC_COLUMN_PRINTER_HH
+
+#include "orc/orc-config.hh"
+#include "orc/OrcFile.hh"
+#include "orc/Vector.hh"
+
+#include <stdio.h>
+#include <string>
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace orc {
+
+ class ColumnPrinter {
+ protected:
+ std::string &buffer;
+ const Type& type;
+ bool hasNulls ;
+ const char* notNull;
+
+ public:
+ ColumnPrinter(std::string&, const Type&);
+ virtual ~ColumnPrinter();
+ virtual void printRow(uint64_t rowId) = 0;
+ // should be called once at the start of each batch of rows
+ virtual void reset(const ColumnVectorBatch& batch);
+ };
+
+ ORC_UNIQUE_PTR<ColumnPrinter> createColumnPrinter(std::string&,
+ const Type& type);
+}
+#endif
http://git-wip-us.apache.org/repos/asf/orc/blob/7de5d89d/c++/include/orc/Int128.hh
----------------------------------------------------------------------
diff --git a/c++/include/orc/Int128.hh b/c++/include/orc/Int128.hh
new file mode 100644
index 0000000..70793dc
--- /dev/null
+++ b/c++/include/orc/Int128.hh
@@ -0,0 +1,336 @@
+/**
+ * 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.
+ */
+
+#ifndef ORC_INT_128
+#define ORC_INT_128
+
+#include "orc/orc-config.hh"
+
+#include <stdexcept>
+#include <string>
+
+namespace orc {
+
+ /**
+ * Represents a signed 128-bit integer in two's complement.
+ * Calculations wrap around and overflow is ignored.
+ *
+ * For a discussion of the algorithms, look at Knuth's volume 2,
+ * Semi-numerical Algorithms section 4.3.1.
+ *
+ */
+ class Int128 {
+ public:
+ Int128() {
+ highbits = 0;
+ lowbits = 0;
+ }
+
+ /**
+ * Convert a signed 64 bit value into an Int128.
+ */
+ Int128(int64_t right) {
+ if (right >= 0) {
+ highbits = 0;
+ lowbits = static_cast<uint64_t>(right);
+ } else {
+ highbits = -1;
+ lowbits = static_cast<uint64_t>(right);
+ }
+ }
+
+ /**
+ * Create from the twos complement representation.
+ */
+ Int128(int64_t high, uint64_t low) {
+ highbits = high;
+ lowbits = low;
+ }
+
+ /**
+ * Parse the number from a base 10 string representation.
+ */
+ explicit Int128(const std::string&);
+
+ /**
+ * Maximum positive value allowed by the type.
+ */
+ static Int128 maximumValue();
+
+ /**
+ * Minimum negative value allowed by the type.
+ */
+ static Int128 minimumValue();
+
+ Int128& negate() {
+ lowbits = ~lowbits + 1;
+ highbits = ~highbits;
+ if (lowbits == 0) {
+ highbits += 1;
+ }
+ return *this;
+ }
+
+ Int128& abs() {
+ if (highbits < 0) {
+ negate();
+ }
+ return *this;
+ }
+
+ Int128& invert() {
+ lowbits = ~lowbits;
+ highbits = ~highbits;
+ return *this;
+ }
+
+ /**
+ * Add a number to this one. The result is truncated to 128 bits.
+ * @param right the number to add
+ * @return *this
+ */
+ Int128& operator+=(const Int128 &right) {
+ uint64_t sum = lowbits + right.lowbits;
+ highbits += right.highbits;
+ if (sum < lowbits) {
+ highbits += 1;
+ }
+ lowbits = sum;
+ return *this;
+ }
+
+ /**
+ * Subtract a number from this one. The result is truncated to 128 bits.
+ * @param right the number to subtract
+ * @return *this
+ */
+ Int128& operator-=(const Int128 &right) {
+ uint64_t diff = lowbits - right.lowbits;
+ highbits -= right.highbits;
+ if (diff > lowbits) {
+ highbits -= 1;
+ }
+ lowbits = diff;
+ return *this;
+ }
+
+ /**
+ * Multiply this number by a number. The result is truncated to 128 bits.
+ * @param right the number to multiply by
+ * @return *this
+ */
+ Int128& operator*=(const Int128 &right);
+
+ /**
+ * Divide this number by right and return the result. This operation is
+ * not destructive.
+ *
+ * The answer rounds to zero. Signs work like:
+ * 21 / 5 -> 4, 1
+ * -21 / 5 -> -4, -1
+ * 21 / -5 -> -4, 1
+ * -21 / -5 -> 4, -1
+ * @param right the number to divide by
+ * @param remainder the remainder after the division
+ */
+ Int128 divide(const Int128 &right, Int128& remainder) const;
+
+ /**
+ * Logical or between two Int128.
+ * @param right the number to or in
+ * @return *this
+ */
+ Int128& operator|=(const Int128 &right) {
+ lowbits |= right.lowbits;
+ highbits |= right.highbits;
+ return *this;
+ }
+
+ /**
+ * Logical and between two Int128.
+ * @param right the number to and in
+ * @return *this
+ */
+ Int128& operator&=(const Int128 &right) {
+ lowbits &= right.lowbits;
+ highbits &= right.highbits;
+ return *this;
+ }
+
+ /**
+ * Shift left by the given number of bits.
+ * Values larger than 2**127 will shift into the sign bit.
+ */
+ Int128& operator<<=(uint32_t bits) {
+ if (bits != 0) {
+ if (bits < 64) {
+ highbits <<= bits;
+ highbits |= (lowbits >> (64 - bits));
+ lowbits <<= bits;
+ } else if (bits < 128) {
+ highbits = static_cast<int64_t>(lowbits) << (bits - 64);
+ lowbits = 0;
+ } else {
+ highbits = 0;
+ lowbits = 0;
+ }
+ }
+ return *this;
+ }
+
+ /**
+ * Shift right by the given number of bits. Negative values will
+ * sign extend and fill with one bits.
+ */
+ Int128& operator>>=(uint32_t bits) {
+ if (bits != 0) {
+ if (bits < 64) {
+ lowbits >>= bits;
+ lowbits |= static_cast<uint64_t>(highbits << (64 - bits));
+ highbits = static_cast<int64_t>
+ (static_cast<uint64_t>(highbits) >> bits);
+ } else if (bits < 128) {
+ lowbits = static_cast<uint64_t>(highbits >> (bits - 64));
+ highbits = highbits >= 0 ? 0 : -1l;
+ } else {
+ highbits = highbits >= 0 ? 0 : -1l;
+ lowbits = static_cast<uint64_t>(highbits);
+ }
+ }
+ return *this;
+ }
+
+ bool operator==(const Int128& right) const {
+ return highbits == right.highbits && lowbits == right.lowbits;
+ }
+
+ bool operator!=(const Int128& right) const {
+ return highbits != right.highbits || lowbits != right.lowbits;
+ }
+
+ bool operator<(const Int128 &right) const {
+ if (highbits == right.highbits) {
+ return lowbits < right.lowbits;
+ } else {
+ return highbits < right.highbits;
+ }
+ }
+
+ bool operator<=(const Int128 &right) const {
+ if (highbits == right.highbits) {
+ return lowbits <= right.lowbits;
+ } else {
+ return highbits <= right.highbits;
+ }
+ }
+
+ bool operator>(const Int128 &right) const {
+ if (highbits == right.highbits) {
+ return lowbits > right.lowbits;
+ } else {
+ return highbits > right.highbits;
+ }
+ }
+
+ bool operator>=(const Int128 &right) const {
+ if (highbits == right.highbits) {
+ return lowbits >= right.lowbits;
+ } else {
+ return highbits >= right.highbits;
+ }
+ }
+
+ uint32_t hash() const {
+ return static_cast<uint32_t>(highbits >> 32) ^
+ static_cast<uint32_t>(highbits) ^
+ static_cast<uint32_t>(lowbits >> 32) ^
+ static_cast<uint32_t>(lowbits);
+ }
+
+ /**
+ * Does this value fit into a long?
+ */
+ bool fitsInLong() const {
+ switch (highbits) {
+ case 0:
+ return !(lowbits & LONG_SIGN_BIT);
+ case -1:
+ return lowbits & LONG_SIGN_BIT;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Convert the value to a long and
+ */
+ int64_t toLong() const {
+ if (fitsInLong()) {
+ return static_cast<int64_t>(lowbits);
+ }
+ throw std::range_error("Int128 too large to convert to long");
+ }
+
+ /**
+ * Return the base 10 string representation of the integer.
+ */
+ std::string toString() const;
+
+ /**
+ * Return the base 10 string representation with a decimal point,
+ * the given number of places after the decimal.
+ */
+ std::string toDecimalString(int32_t scale=0) const;
+
+ /**
+ * Return the base 16 string representation of the two's complement with
+ * a prefix of "0x".
+ * Int128(-1).toHexString() = "0xffffffffffffffffffffffffffffffff".
+ */
+ std::string toHexString() const;
+
+ /**
+ * Get the high bits of the twos complement representation of the number.
+ */
+ int64_t getHighBits() {
+ return highbits;
+ }
+
+ /**
+ * Get the low bits of the twos complement representation of the number.
+ */
+ uint64_t getLowBits() {
+ return lowbits;
+ }
+
+ /**
+ * Represent the absolute number as a list of uint32.
+ * Visible for testing only.
+ * @param array the array that is set to the value of the number
+ * @param wasNegative set to true if the original number was negative
+ * @return the number of elements that were set in the array (1 to 4)
+ */
+ int64_t fillInArray(uint32_t* array, bool &wasNegative) const;
+
+ private:
+ static const uint64_t LONG_SIGN_BIT = 0x8000000000000000u;
+ int64_t highbits;
+ uint64_t lowbits;
+ };
+}
+#endif
http://git-wip-us.apache.org/repos/asf/orc/blob/7de5d89d/c++/include/orc/MemoryPool.hh
----------------------------------------------------------------------
diff --git a/c++/include/orc/MemoryPool.hh b/c++/include/orc/MemoryPool.hh
new file mode 100644
index 0000000..4673f69
--- /dev/null
+++ b/c++/include/orc/MemoryPool.hh
@@ -0,0 +1,82 @@
+/**
+ * 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.
+ */
+
+#ifndef MEMORYPOOL_HH_
+#define MEMORYPOOL_HH_
+
+#include "orc/orc-config.hh"
+
+#include <memory>
+
+namespace orc {
+
+ class MemoryPool {
+ public:
+ virtual ~MemoryPool();
+
+ virtual char* malloc(uint64_t size) = 0;
+ virtual void free(char* p) = 0;
+ };
+ MemoryPool* getDefaultPool();
+
+ template <class T>
+ class DataBuffer {
+ private:
+ MemoryPool& memoryPool;
+ T* buf;
+ // current size
+ uint64_t currentSize;
+ // maximal capacity (actual allocated memory)
+ uint64_t currentCapacity;
+
+ // not implemented
+ DataBuffer(DataBuffer& buffer);
+ DataBuffer& operator=(DataBuffer& buffer);
+
+ public:
+ DataBuffer(MemoryPool& pool, uint64_t _size = 0);
+ virtual ~DataBuffer();
+
+ T* data() {
+ return buf;
+ }
+
+ const T* data() const {
+ return buf;
+ }
+
+ uint64_t size() {
+ return currentSize;
+ }
+
+ uint64_t capacity() {
+ return currentCapacity;
+ }
+
+ T& operator[](uint64_t i) {
+ return buf[i];
+ }
+
+ void reserve(uint64_t _size);
+ void resize(uint64_t _size);
+ };
+
+} // namespace orc
+
+
+#endif /* MEMORYPOOL_HH_ */
http://git-wip-us.apache.org/repos/asf/orc/blob/7de5d89d/c++/include/orc/OrcFile.hh
----------------------------------------------------------------------
diff --git a/c++/include/orc/OrcFile.hh b/c++/include/orc/OrcFile.hh
new file mode 100644
index 0000000..0a4f4ca
--- /dev/null
+++ b/c++/include/orc/OrcFile.hh
@@ -0,0 +1,97 @@
+/**
+ * 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.
+ */
+
+#ifndef ORC_FILE_HH
+#define ORC_FILE_HH
+
+#include <string>
+
+#include "orc/orc-config.hh"
+#include "orc/Reader.hh"
+
+/** /file orc/OrcFile.hh
+ @brief The top level interface to ORC.
+*/
+
+namespace orc {
+
+ /**
+ * An abstract interface for a buffer provided by the input stream.
+ */
+ class Buffer {
+ public:
+ virtual ~Buffer();
+
+ /**
+ * Get the start of the buffer.
+ */
+ virtual char *getStart() const = 0;
+
+ /**
+ * Get the length of the buffer in bytes.
+ */
+ virtual uint64_t getLength() const = 0;
+ };
+
+ /**
+ * An abstract interface for providing ORC readers a stream of bytes.
+ */
+ class InputStream {
+ public:
+ virtual ~InputStream();
+
+ /**
+ * Get the total length of the file in bytes.
+ */
+ virtual uint64_t getLength() const = 0;
+
+ /**
+ * Read length bytes from the file starting at offset into
+ * the buffer.
+ * @param offset the position in the file to read from
+ * @param length the number of bytes to read
+ * @param buffer a Buffer to reuse from a previous call to read. Ownership
+ * of this buffer passes to the InputStream object.
+ * @return the buffer with the requested data. The client owns the Buffer.
+ */
+ virtual Buffer* read(uint64_t offset,
+ uint64_t length,
+ Buffer* buffer) = 0;
+
+ /**
+ * Get the name of the stream for error messages.
+ */
+ virtual const std::string& getName() const = 0;
+ };
+
+ /**
+ * Create a stream to a local file.
+ * @param path the name of the file in the local file system
+ */
+ ORC_UNIQUE_PTR<InputStream> readLocalFile(const std::string& path);
+
+ /**
+ * Create a reader to the for the ORC file.
+ * @param stream the stream to read
+ * @param options the options for reading the file
+ */
+ ORC_UNIQUE_PTR<Reader> createReader(ORC_UNIQUE_PTR<InputStream> stream,
+ const ReaderOptions& options);
+}
+
+#endif
http://git-wip-us.apache.org/repos/asf/orc/blob/7de5d89d/c++/include/orc/Reader.hh
----------------------------------------------------------------------
diff --git a/c++/include/orc/Reader.hh b/c++/include/orc/Reader.hh
new file mode 100644
index 0000000..14921b0
--- /dev/null
+++ b/c++/include/orc/Reader.hh
@@ -0,0 +1,715 @@
+/**
+ * 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.
+ */
+
+#ifndef ORC_READER_HH
+#define ORC_READER_HH
+
+#include "orc/orc-config.hh"
+#include "Vector.hh"
+
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace orc {
+
+ // classes that hold data members so we can maintain binary compatibility
+ struct ReaderOptionsPrivate;
+
+ enum CompressionKind {
+ CompressionKind_NONE = 0,
+ CompressionKind_ZLIB = 1,
+ CompressionKind_SNAPPY = 2,
+ CompressionKind_LZO = 3
+ };
+
+ /**
+ * Statistics that are available for all types of columns.
+ */
+ class ColumnStatistics {
+ public:
+ virtual ~ColumnStatistics();
+
+ /**
+ * Get the number of values in this column. It will differ from the number
+ * of rows because of NULL values and repeated values.
+ * @return the number of values
+ */
+ virtual uint64_t getNumberOfValues() const = 0;
+
+ /**
+ * print out statistics of column if any
+ */
+ virtual std::string toString() const = 0;
+ };
+
+ /**
+ * Statistics for binary columns.
+ */
+ class BinaryColumnStatistics: public ColumnStatistics {
+ public:
+ virtual ~BinaryColumnStatistics();
+
+ /**
+ * check whether column has total length
+ * @return true if has total length
+ */
+ virtual bool hasTotalLength() const = 0;
+
+ virtual uint64_t getTotalLength() const = 0;
+ };
+
+ /**
+ * Statistics for boolean columns.
+ */
+ class BooleanColumnStatistics: public ColumnStatistics {
+ public:
+ virtual ~BooleanColumnStatistics();
+
+ /**
+ * check whether column has true/false count
+ * @return true if has true/false count
+ */
+ virtual bool hasCount() const = 0;
+
+ virtual uint64_t getFalseCount() const = 0;
+ virtual uint64_t getTrueCount() const = 0;
+ };
+
+ /**
+ * Statistics for date columns.
+ */
+ class DateColumnStatistics: public ColumnStatistics {
+ public:
+ virtual ~DateColumnStatistics();
+
+ /**
+ * check whether column has minimum
+ * @return true if has minimum
+ */
+ virtual bool hasMinimum() const = 0;
+
+ /**
+ * check whether column has maximum
+ * @return true if has maximum
+ */
+ virtual bool hasMaximum() const = 0;
+
+ /**
+ * Get the minimum value for the column.
+ * @return minimum value
+ */
+ virtual int32_t getMinimum() const = 0;
+
+ /**
+ * Get the maximum value for the column.
+ * @return maximum value
+ */
+ virtual int32_t getMaximum() const = 0;
+ };
+
+ /**
+ * Statistics for decimal columns.
+ */
+ class DecimalColumnStatistics: public ColumnStatistics {
+ public:
+ virtual ~DecimalColumnStatistics();
+
+ /**
+ * check whether column has minimum
+ * @return true if has minimum
+ */
+ virtual bool hasMinimum() const = 0;
+
+ /**
+ * check whether column has maximum
+ * @return true if has maximum
+ */
+ virtual bool hasMaximum() const = 0;
+
+ /**
+ * check whether column has sum
+ * @return true if has sum
+ */
+ virtual bool hasSum() const = 0;
+
+ /**
+ * Get the minimum value for the column.
+ * @return minimum value
+ */
+ virtual Decimal getMinimum() const = 0;
+
+ /**
+ * Get the maximum value for the column.
+ * @return maximum value
+ */
+ virtual Decimal getMaximum() const = 0;
+
+ /**
+ * Get the sum for the column.
+ * @return sum of all the values
+ */
+ virtual Decimal getSum() const = 0;
+ };
+
+ /**
+ * Statistics for float and double columns.
+ */
+ class DoubleColumnStatistics: public ColumnStatistics {
+ public:
+ virtual ~DoubleColumnStatistics();
+
+ /**
+ * check whether column has minimum
+ * @return true if has minimum
+ */
+ virtual bool hasMinimum() const = 0;
+
+ /**
+ * check whether column has maximum
+ * @return true if has maximum
+ */
+ virtual bool hasMaximum() const = 0;
+
+ /**
+ * check whether column has sum
+ * @return true if has sum
+ */
+ virtual bool hasSum() const = 0;
+
+ /**
+ * Get the smallest value in the column. Only defined if getNumberOfValues
+ * is non-zero.
+ * @return the minimum
+ */
+ virtual double getMinimum() const = 0;
+
+ /**
+ * Get the largest value in the column. Only defined if getNumberOfValues
+ * is non-zero.
+ * @return the maximum
+ */
+ virtual double getMaximum() const = 0;
+
+ /**
+ * Get the sum of the values in the column.
+ * @return the sum
+ */
+ virtual double getSum() const = 0;
+ };
+
+ /**
+ * Statistics for all of the integer columns, such as byte, short, int, and
+ * long.
+ */
+ class IntegerColumnStatistics: public ColumnStatistics {
+ public:
+ virtual ~IntegerColumnStatistics();
+
+ /**
+ * check whether column has minimum
+ * @return true if has minimum
+ */
+ virtual bool hasMinimum() const = 0;
+
+ /**
+ * check whether column has maximum
+ * @return true if has maximum
+ */
+ virtual bool hasMaximum() const = 0;
+
+ /**
+ * check whether column has sum
+ * @return true if has sum
+ */
+ virtual bool hasSum() const = 0;
+
+ /**
+ * Get the smallest value in the column. Only defined if getNumberOfValues
+ * is non-zero.
+ * @return the minimum
+ */
+ virtual int64_t getMinimum() const = 0;
+
+ /**
+ * Get the largest value in the column. Only defined if getNumberOfValues
+ * is non-zero.
+ * @return the maximum
+ */
+ virtual int64_t getMaximum() const = 0;
+
+ /**
+ * Get the sum of the column. Only valid if isSumDefined returns true.
+ * @return the sum of the column
+ */
+ virtual int64_t getSum() const = 0;
+ };
+
+ /**
+ * Statistics for string columns.
+ */
+ class StringColumnStatistics: public ColumnStatistics {
+ public:
+ virtual ~StringColumnStatistics();
+
+ /**
+ * check whether column has minimum
+ * @return true if has minimum
+ */
+ virtual bool hasMinimum() const = 0;
+
+ /**
+ * check whether column has maximum
+ * @return true if has maximum
+ */
+ virtual bool hasMaximum() const = 0;
+
+ /**
+ * check whether column
+ * @return true if has maximum
+ */
+ virtual bool hasTotalLength() const = 0;
+
+ /**
+ * Get the minimum value for the column.
+ * @return minimum value
+ */
+ virtual std::string getMinimum() const = 0;
+
+ /**
+ * Get the maximum value for the column.
+ * @return maximum value
+ */
+ virtual std::string getMaximum() const = 0;
+
+ /**
+ * Get the total length of all values.
+ * @return total length of all the values
+ */
+ virtual uint64_t getTotalLength() const = 0;
+ };
+
+ /**
+ * Statistics for timestamp columns.
+ */
+ class TimestampColumnStatistics: public ColumnStatistics {
+ public:
+ virtual ~TimestampColumnStatistics();
+
+ /**
+ * check whether column minimum
+ * @return true if has minimum
+ */
+ virtual bool hasMinimum() const = 0;
+
+ /**
+ * check whether column maximum
+ * @return true if has maximum
+ */
+ virtual bool hasMaximum() const = 0;
+
+ /**
+ * Get the minimum value for the column.
+ * @return minimum value
+ */
+ virtual int64_t getMinimum() const = 0;
+
+ /**
+ * Get the maximum value for the column.
+ * @return maximum value
+ */
+ virtual int64_t getMaximum() const = 0;
+ };
+
+ class StripeInformation {
+ public:
+ virtual ~StripeInformation();
+
+ /**
+ * Get the byte offset of the start of the stripe.
+ * @return the bytes from the start of the file
+ */
+ virtual uint64_t getOffset() const = 0;
+
+ /**
+ * Get the total length of the stripe in bytes.
+ * @return the number of bytes in the stripe
+ */
+ virtual uint64_t getLength() const = 0;
+
+ /**
+ * Get the length of the stripe's indexes.
+ * @return the number of bytes in the index
+ */
+ virtual uint64_t getIndexLength() const = 0;
+
+ /**
+ * Get the length of the stripe's data.
+ * @return the number of bytes in the stripe
+ */
+ virtual uint64_t getDataLength()const = 0;
+
+ /**
+ * Get the length of the stripe's tail section, which contains its index.
+ * @return the number of bytes in the tail
+ */
+ virtual uint64_t getFooterLength() const = 0;
+
+ /**
+ * Get the number of rows in the stripe.
+ * @return a count of the number of rows
+ */
+ virtual uint64_t getNumberOfRows() const = 0;
+ };
+
+ class Statistics {
+ public:
+ virtual ~Statistics();
+
+ /**
+ * Get the statistics of colId column.
+ * @return one column's statistics
+ */
+ virtual const ColumnStatistics* getColumnStatistics(uint32_t colId
+ ) const = 0;
+
+ /**
+ * Get the number of columns
+ * @return the number of columns
+ */
+ virtual uint32_t getNumberOfColumns() const = 0;
+ };
+
+
+ /**
+ * Options for creating a Reader.
+ */
+ class ReaderOptions {
+ private:
+ ORC_UNIQUE_PTR<ReaderOptionsPrivate> privateBits;
+
+ public:
+ ReaderOptions();
+ ReaderOptions(const ReaderOptions&);
+ ReaderOptions(ReaderOptions&);
+ ReaderOptions& operator=(const ReaderOptions&);
+ virtual ~ReaderOptions();
+
+ /**
+ * Set the list of columns to read. All columns that are children of
+ * selected columns are automatically selected. The default value is
+ * {0}.
+ * @param include a list of columns to read
+ * @return this
+ */
+ ReaderOptions& include(const std::list<int64_t>& include);
+
+ /**
+ * Set the list of columns to read. All columns that are children of
+ * selected columns are automatically selected. The default value is
+ * {0}.
+ * @param include a list of columns to read
+ * @return this
+ */
+ ReaderOptions& include(std::vector<int64_t> include);
+
+ /**
+ * Set the section of the file to process.
+ * @param offset the starting byte offset
+ * @param length the number of bytes to read
+ * @return this
+ */
+ ReaderOptions& range(uint64_t offset, uint64_t length);
+
+ /**
+ * For Hive 0.11 (and 0.12) decimals, the precision was unlimited
+ * and thus may overflow the 38 digits that is supported. If one
+ * of the Hive 0.11 decimals is too large, the reader may either convert
+ * the value to NULL or throw an exception. That choice is controlled
+ * by this setting.
+ *
+ * Defaults to true.
+ *
+ * @param shouldThrow should the reader throw a ParseError?
+ * @return returns *this
+ */
+ ReaderOptions& throwOnHive11DecimalOverflow(bool shouldThrow);
+
+ /**
+ * For Hive 0.11 (and 0.12) written decimals, which have unlimited
+ * scale and precision, the reader forces the scale to a consistent
+ * number that is configured. This setting changes the scale that is
+ * forced upon these old decimals. See also throwOnHive11DecimalOverflow.
+ *
+ * Defaults to 6.
+ *
+ * @param forcedScale the scale that will be forced on Hive 0.11 decimals
+ * @return returns *this
+ */
+ ReaderOptions& forcedScaleOnHive11Decimal(int32_t forcedScale);
+
+ /**
+ * Set the location of the tail as defined by the logical length of the
+ * file.
+ */
+ ReaderOptions& setTailLocation(uint64_t offset);
+
+ /**
+ * Set the stream to use for printing warning or error messages.
+ */
+ ReaderOptions& setErrorStream(std::ostream& stream);
+
+ /**
+ * Open the file used a serialized copy of the file tail.
+ *
+ * When one process opens the file and other processes need to read
+ * the rows, we want to enable clients to just read the tail once.
+ * By passing the string returned by Reader.getSerializedFileTail(), to
+ * this function, the second reader will not need to read the file tail
+ * from disk.
+ *
+ * @param serialization the bytes of the serialized tail to use
+ */
+ ReaderOptions& setSerializedFileTail(const std::string& serialization);
+
+ /**
+ * Set the memory allocator.
+ */
+ ReaderOptions& setMemoryPool(MemoryPool& pool);
+
+ /**
+ * Get the list of selected columns to read. All children of the selected
+ * columns are also selected.
+ */
+ const std::list<int64_t>& getInclude() const;
+
+ /**
+ * Get the start of the range for the data being processed.
+ * @return if not set, return 0
+ */
+ uint64_t getOffset() const;
+
+ /**
+ * Get the end of the range for the data being processed.
+ * @return if not set, return the maximum long
+ */
+ uint64_t getLength() const;
+
+ /**
+ * Get the desired tail location.
+ * @return if not set, return the maximum long.
+ */
+ uint64_t getTailLocation() const;
+
+ /**
+ * Should the reader throw a ParseError when a Hive 0.11 decimal is
+ * larger than the supported 38 digits of precision? Otherwise, the
+ * data item is replaced by a NULL.
+ */
+ bool getThrowOnHive11DecimalOverflow() const;
+
+ /**
+ * What scale should all Hive 0.11 decimals be normalized to?
+ */
+ int32_t getForcedScaleOnHive11Decimal() const;
+
+ /**
+ * Get the stream to write warnings or errors to.
+ */
+ std::ostream* getErrorStream() const;
+
+ /**
+ * Get the memory allocator.
+ */
+ MemoryPool* getMemoryPool() const;
+
+ /**
+ * Get the serialized file tail that the user passed in.
+ */
+ std::string getSerializedFileTail() const;
+ };
+
+ /**
+ * The interface for reading ORC files.
+ * This is an an abstract class that will subclassed as necessary.
+ */
+ class Reader {
+ public:
+ virtual ~Reader();
+
+ /**
+ * Get the format version of the file. Currently known values are:
+ * "0.11" and "0.12"
+ * @return the version string
+ */
+ virtual std::string getFormatVersion() const = 0;
+
+ /**
+ * Get the number of rows in the file.
+ * @return the number of rows
+ */
+ virtual uint64_t getNumberOfRows() const = 0;
+
+ /**
+ * Get the user metadata keys.
+ * @return the set of metadata keys
+ */
+ virtual std::list<std::string> getMetadataKeys() const = 0;
+
+ /**
+ * Get a user metadata value.
+ * @param key a key given by the user
+ * @return the bytes associated with the given key
+ */
+ virtual std::string getMetadataValue(const std::string& key) const = 0;
+
+ /**
+ * Did the user set the given metadata value.
+ * @param key the key to check
+ * @return true if the metadata value was set
+ */
+ virtual bool hasMetadataValue(const std::string& key) const = 0;
+
+ /**
+ * Get the compression kind.
+ * @return the kind of compression in the file
+ */
+ virtual CompressionKind getCompression() const = 0;
+
+ /**
+ * Get the buffer size for the compression.
+ * @return number of bytes to buffer for the compression codec.
+ */
+ virtual uint64_t getCompressionSize() const = 0;
+
+ /**
+ * Get the number of rows per a entry in the row index.
+ * @return the number of rows per an entry in the row index or 0 if there
+ * is no row index.
+ */
+ virtual uint64_t getRowIndexStride() const = 0;
+
+ /**
+ * Get the number of stripes in the file.
+ * @return the number of stripes
+ */
+ virtual uint64_t getNumberOfStripes() const = 0;
+
+ /**
+ * Get the information about a stripe.
+ * @param stripeIndex the stripe 0 to N-1 to get information about
+ * @return the information about that stripe
+ */
+ virtual ORC_UNIQUE_PTR<StripeInformation>
+ getStripe(uint64_t stripeIndex) const = 0;
+
+ /**
+ * Get the number of stripe statistics in the file.
+ * @return the number of stripe statistics
+ */
+ virtual uint64_t getNumberOfStripeStatistics() const = 0;
+
+ /**
+ * Get the statistics about a stripe.
+ * @param stripeIndex the stripe 0 to N-1 to get statistics about
+ * @return the statistics about that stripe
+ */
+ virtual ORC_UNIQUE_PTR<Statistics>
+ getStripeStatistics(uint64_t stripeIndex) const = 0;
+
+ /**
+ * Get the length of the file.
+ * @return the number of bytes in the file
+ */
+ virtual uint64_t getContentLength() const = 0;
+
+ /**
+ * Get the statistics about the columns in the file.
+ * @return the information about the column
+ */
+ virtual ORC_UNIQUE_PTR<Statistics> getStatistics() const = 0;
+
+ /**
+ * Get the statistics about a single column in the file.
+ * @return the information about the column
+ */
+ virtual ORC_UNIQUE_PTR<ColumnStatistics>
+ getColumnStatistics(uint32_t columnId) const = 0;
+
+ /**
+ * Get the type of the rows in the file. The top level is always a struct.
+ * @return the root type
+ */
+ virtual const Type& getType() const = 0;
+
+ /**
+ * Get the selected columns of the file.
+ */
+ virtual const std::vector<bool> getSelectedColumns() const = 0;
+
+ /**
+ * Create a row batch for reading the selected columns of this file.
+ * @param size the number of rows to read
+ * @return a new ColumnVectorBatch to read into
+ */
+ virtual ORC_UNIQUE_PTR<ColumnVectorBatch> createRowBatch
+ (uint64_t size) const = 0;
+
+ /**
+ * Read the next row batch from the current position.
+ * Caller must look at numElements in the row batch to determine how
+ * many rows were read.
+ * @param data the row batch to read into.
+ * @return true if a non-zero number of rows were read or false if the
+ * end of the file was reached.
+ */
+ virtual bool next(ColumnVectorBatch& data) = 0;
+
+ /**
+ * Get the row number of the first row in the previously read batch.
+ * @return the row number of the previous batch.
+ */
+ virtual uint64_t getRowNumber() const = 0;
+
+ /**
+ * Seek to a given row.
+ * @param rowNumber the next row the reader should return
+ */
+ virtual void seekToRow(uint64_t rowNumber) = 0;
+
+ /**
+ * Get the name of the input stream.
+ */
+ virtual const std::string& getStreamName() const = 0;
+
+ /**
+ * check file has correct column statistics
+ */
+ virtual bool hasCorrectStatistics() const = 0;
+
+ /**
+ * Get the serialized file tail.
+ * Usefull if another reader of the same file wants to avoid re-reading
+ * the file tail. See ReaderOptions.setSerializedFileTail().
+ * @return a string of bytes with the file tail
+ */
+ virtual std::string getSerializedFileTail() const = 0;
+ };
+}
+
+#endif
http://git-wip-us.apache.org/repos/asf/orc/blob/7de5d89d/c++/include/orc/Vector.hh
----------------------------------------------------------------------
diff --git a/c++/include/orc/Vector.hh b/c++/include/orc/Vector.hh
new file mode 100644
index 0000000..e97c51e
--- /dev/null
+++ b/c++/include/orc/Vector.hh
@@ -0,0 +1,299 @@
+/**
+ * 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.
+ */
+
+#ifndef ORC_VECTOR_HH
+#define ORC_VECTOR_HH
+
+#include "orc/orc-config.hh"
+#include "MemoryPool.hh"
+#include "Int128.hh"
+
+#include <list>
+#include <memory>
+#include <cstring>
+#include <vector>
+#include <stdexcept>
+#include <cstdlib>
+#include <iostream>
+
+namespace orc {
+
+ enum TypeKind {
+ BOOLEAN = 0,
+ BYTE = 1,
+ SHORT = 2,
+ INT = 3,
+ LONG = 4,
+ FLOAT = 5,
+ DOUBLE = 6,
+ STRING = 7,
+ BINARY = 8,
+ TIMESTAMP = 9,
+ LIST = 10,
+ MAP = 11,
+ STRUCT = 12,
+ UNION = 13,
+ DECIMAL = 14,
+ DATE = 15,
+ VARCHAR = 16,
+ CHAR = 17
+ };
+
+ std::string kind2String(TypeKind t);
+
+ class Type {
+ public:
+ virtual ~Type();
+ virtual int64_t assignIds(int64_t root) = 0;
+ virtual int64_t getColumnId() const = 0;
+ virtual TypeKind getKind() const = 0;
+ virtual uint64_t getSubtypeCount() const = 0;
+ virtual const Type& getSubtype(uint64_t typeId) const = 0;
+ virtual const std::string& getFieldName(uint64_t fieldId) const = 0;
+ virtual uint64_t getMaximumLength() const = 0;
+ virtual uint64_t getPrecision() const = 0;
+ virtual uint64_t getScale() const = 0;
+ virtual std::string toString() const = 0;
+
+ /**
+ * Add a new field to a struct type.
+ * @param fieldType the type of the new field
+ * @param fieldName the name of the new field
+ * @return a reference to the field's type
+ */
+ virtual Type& addStructField(ORC_UNIQUE_PTR<Type> fieldType,
+ const std::string& fieldName) = 0;
+ };
+
+ const int64_t DEFAULT_DECIMAL_SCALE = 18;
+ const int64_t DEFAULT_DECIMAL_PRECISION = 38;
+
+ ORC_UNIQUE_PTR<Type> createPrimitiveType(TypeKind kind);
+ ORC_UNIQUE_PTR<Type> createCharType(TypeKind kind,
+ uint64_t maxLength);
+ ORC_UNIQUE_PTR<Type>
+ createDecimalType(uint64_t precision=
+ DEFAULT_DECIMAL_PRECISION,
+ uint64_t scale=DEFAULT_DECIMAL_SCALE);
+
+ ORC_UNIQUE_PTR<Type> createStructType();
+ ORC_UNIQUE_PTR<Type>
+ createStructType(std::vector<Type*> types,
+ std::vector<std::string> fieldNames);
+
+#ifdef ORC_CXX_HAS_INITIALIZER_LIST
+ std::unique_ptr<Type> createStructType(
+ std::initializer_list<std::unique_ptr<Type> > types,
+ std::initializer_list<std::string> fieldNames);
+#endif
+
+ ORC_UNIQUE_PTR<Type> createListType(ORC_UNIQUE_PTR<Type> elements);
+ ORC_UNIQUE_PTR<Type> createMapType(ORC_UNIQUE_PTR<Type> key,
+ ORC_UNIQUE_PTR<Type> value);
+ ORC_UNIQUE_PTR<Type>
+ createUnionType(std::vector<Type*> types);
+
+ /**
+ * The base class for each of the column vectors. This class handles
+ * the generic attributes such as number of elements, capacity, and
+ * notNull vector.
+ */
+ struct ColumnVectorBatch {
+ ColumnVectorBatch(uint64_t capacity, MemoryPool& pool);
+ virtual ~ColumnVectorBatch();
+
+ // the number of slots available
+ uint64_t capacity;
+ // the number of current occupied slots
+ uint64_t numElements;
+ // an array of capacity length marking non-null values
+ DataBuffer<char> notNull;
+ // whether there are any null values
+ bool hasNulls;
+
+ // custom memory pool
+ MemoryPool& memoryPool;
+
+ /**
+ * Generate a description of this vector as a string.
+ */
+ virtual std::string toString() const = 0;
+
+ /**
+ * Change the number of slots to at least the given capacity.
+ * This function is not recursive into subtypes.
+ */
+ virtual void resize(uint64_t capacity);
+
+ private:
+ ColumnVectorBatch(const ColumnVectorBatch&);
+ ColumnVectorBatch& operator=(const ColumnVectorBatch&);
+ };
+
+ struct LongVectorBatch: public ColumnVectorBatch {
+ LongVectorBatch(uint64_t capacity, MemoryPool& pool);
+ virtual ~LongVectorBatch();
+
+ DataBuffer<int64_t> data;
+ std::string toString() const;
+ void resize(uint64_t capacity);
+ };
+
+ struct DoubleVectorBatch: public ColumnVectorBatch {
+ DoubleVectorBatch(uint64_t capacity, MemoryPool& pool);
+ virtual ~DoubleVectorBatch();
+ std::string toString() const;
+ void resize(uint64_t capacity);
+
+ DataBuffer<double> data;
+ };
+
+ struct StringVectorBatch: public ColumnVectorBatch {
+ StringVectorBatch(uint64_t capacity, MemoryPool& pool);
+ virtual ~StringVectorBatch();
+ std::string toString() const;
+ void resize(uint64_t capacity);
+
+ // pointers to the start of each string
+ DataBuffer<char*> data;
+ // the length of each string
+ DataBuffer<int64_t> length;
+ };
+
+ struct StructVectorBatch: public ColumnVectorBatch {
+ StructVectorBatch(uint64_t capacity, MemoryPool& pool);
+ virtual ~StructVectorBatch();
+ std::string toString() const;
+ void resize(uint64_t capacity);
+
+ std::vector<ColumnVectorBatch*> fields;
+ };
+
+ struct ListVectorBatch: public ColumnVectorBatch {
+ ListVectorBatch(uint64_t capacity, MemoryPool& pool);
+ virtual ~ListVectorBatch();
+ std::string toString() const;
+ void resize(uint64_t capacity);
+
+ /**
+ * The offset of the first element of each list.
+ * The length of list i is startOffset[i+1] - startOffset[i].
+ */
+ DataBuffer<int64_t> offsets;
+
+ // the concatenated elements
+ ORC_UNIQUE_PTR<ColumnVectorBatch> elements;
+ };
+
+ struct MapVectorBatch: public ColumnVectorBatch {
+ MapVectorBatch(uint64_t capacity, MemoryPool& pool);
+ virtual ~MapVectorBatch();
+ std::string toString() const;
+ void resize(uint64_t capacity);
+
+ /**
+ * The offset of the first element of each list.
+ * The length of list i is startOffset[i+1] - startOffset[i].
+ */
+ DataBuffer<int64_t> offsets;
+
+ // the concatenated keys
+ ORC_UNIQUE_PTR<ColumnVectorBatch> keys;
+ // the concatenated elements
+ ORC_UNIQUE_PTR<ColumnVectorBatch> elements;
+ };
+
+ struct UnionVectorBatch: public ColumnVectorBatch {
+ UnionVectorBatch(uint64_t capacity, MemoryPool& pool);
+ virtual ~UnionVectorBatch();
+ std::string toString() const;
+ void resize(uint64_t capacity);
+
+ /**
+ * For each value, which element of children has the value.
+ */
+ DataBuffer<unsigned char> tags;
+
+ /**
+ * For each value, the index inside of the child ColumnVectorBatch.
+ */
+ DataBuffer<uint64_t> offsets;
+
+ // the sub-columns
+ std::vector<ColumnVectorBatch*> children;
+ };
+
+ struct Decimal {
+ Decimal(const Int128& value, int32_t scale);
+ explicit Decimal(const std::string& value);
+
+ std::string toString() const;
+ Int128 value;
+ int32_t scale;
+ };
+
+ struct Decimal64VectorBatch: public ColumnVectorBatch {
+ Decimal64VectorBatch(uint64_t capacity, MemoryPool& pool);
+ virtual ~Decimal64VectorBatch();
+ std::string toString() const;
+ void resize(uint64_t capacity);
+
+ // total number of digits
+ int32_t precision;
+ // the number of places after the decimal
+ int32_t scale;
+
+ // the numeric values
+ DataBuffer<int64_t> values;
+
+ protected:
+ /**
+ * Contains the scales that were read from the file. Should NOT be
+ * used.
+ */
+ DataBuffer<int64_t> readScales;
+ friend class Decimal64ColumnReader;
+ };
+
+ struct Decimal128VectorBatch: public ColumnVectorBatch {
+ Decimal128VectorBatch(uint64_t capacity, MemoryPool& pool);
+ virtual ~Decimal128VectorBatch();
+ std::string toString() const;
+ void resize(uint64_t capacity);
+
+ // total number of digits
+ int32_t precision;
+ // the number of places after the decimal
+ int32_t scale;
+
+ // the numeric values
+ DataBuffer<Int128> values;
+
+ protected:
+ /**
+ * Contains the scales that were read from the file. Should NOT be
+ * used.
+ */
+ DataBuffer<int64_t> readScales;
+ friend class Decimal128ColumnReader;
+ friend class DecimalHive11ColumnReader;
+ };
+
+}
+
+#endif
http://git-wip-us.apache.org/repos/asf/orc/blob/7de5d89d/c++/include/orc/orc-config.hh.in
----------------------------------------------------------------------
diff --git a/c++/include/orc/orc-config.hh.in b/c++/include/orc/orc-config.hh.in
new file mode 100644
index 0000000..56db946
--- /dev/null
+++ b/c++/include/orc/orc-config.hh.in
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+
+#ifndef ORC_CONFIG_HH
+#define ORC_CONFIG_HH
+
+#define ORC_VERSION "@ORC_VERSION@"
+
+#cmakedefine ORC_CXX_HAS_CSTDINT
+#cmakedefine ORC_CXX_HAS_INITIALIZER_LIST
+#cmakedefine ORC_CXX_HAS_NOEXCEPT
+#cmakedefine ORC_CXX_HAS_NULLPTR
+#cmakedefine ORC_CXX_HAS_OVERRIDE
+#cmakedefine ORC_CXX_HAS_UNIQUE_PTR
+
+#ifdef ORC_CXX_HAS_CSTDINT
+ #include <cstdint>
+#else
+ #include <stdint.h>
+#endif
+
+#ifdef ORC_CXX_HAS_NOEXCEPT
+ #define ORC_NOEXCEPT noexcept
+#else
+ #define ORC_NOEXCEPT throw ()
+#endif
+
+#ifdef ORC_CXX_HAS_NULLPTR
+ #define ORC_NULLPTR nullptr
+#else
+ namespace orc {
+ class nullptr_t {
+ public:
+ template<class T>
+ operator T*() const {
+ return 0;
+ }
+
+ template<class C, class T>
+ operator T C::*() const {
+ return 0;
+ }
+ private:
+ void operator&() const; // whose address can't be taken
+ };
+ const nullptr_t nullptr = {};
+ }
+ #define ORC_NULLPTR orc::nullptr
+#endif
+
+#ifdef ORC_CXX_HAS_OVERRIDE
+ #define ORC_OVERRIDE override
+#else
+ #define ORC_OVERRIDE
+#endif
+
+#ifdef ORC_CXX_HAS_UNIQUE_PTR
+ #define ORC_UNIQUE_PTR std::unique_ptr
+#else
+ #define ORC_UNIQUE_PTR std::auto_ptr
+ namespace std {
+ template<typename T>
+ inline T move(T& x) { return x; }
+ }
+#endif
+
+#endif
http://git-wip-us.apache.org/repos/asf/orc/blob/7de5d89d/c++/libs/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/c++/libs/CMakeLists.txt b/c++/libs/CMakeLists.txt
new file mode 100644
index 0000000..7d8fa22
--- /dev/null
+++ b/c++/libs/CMakeLists.txt
@@ -0,0 +1,16 @@
+# 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.
+
+add_subdirectory(gmock-${GMOCK_VERSION})
+add_subdirectory(zlib-${ZLIB_VERSION})
+add_subdirectory(protobuf-${PROTOBUF_VERSION})
+add_subdirectory(snappy-${SNAPPY_VERSION})
http://git-wip-us.apache.org/repos/asf/orc/blob/7de5d89d/c++/libs/gmock-1.7.0/CHANGES
----------------------------------------------------------------------
diff --git a/c++/libs/gmock-1.7.0/CHANGES b/c++/libs/gmock-1.7.0/CHANGES
new file mode 100644
index 0000000..d6f2f76
--- /dev/null
+++ b/c++/libs/gmock-1.7.0/CHANGES
@@ -0,0 +1,126 @@
+Changes for 1.7.0:
+
+* All new improvements in Google Test 1.7.0.
+* New feature: matchers DoubleNear(), FloatNear(),
+ NanSensitiveDoubleNear(), NanSensitiveFloatNear(),
+ UnorderedElementsAre(), UnorderedElementsAreArray(), WhenSorted(),
+ WhenSortedBy(), IsEmpty(), and SizeIs().
+* Improvement: Google Mock can now be built as a DLL.
+* Improvement: when compiled by a C++11 compiler, matchers AllOf()
+ and AnyOf() can accept an arbitrary number of matchers.
+* Improvement: when compiled by a C++11 compiler, matchers
+ ElementsAreArray() can accept an initializer list.
+* Improvement: when exceptions are enabled, a mock method with no
+ default action now throws instead crashing the test.
+* Improvement: added class testing::StringMatchResultListener to aid
+ definition of composite matchers.
+* Improvement: function return types used in MOCK_METHOD*() macros can
+ now contain unprotected commas.
+* Improvement (potentially breaking): EXPECT_THAT() and ASSERT_THAT()
+ are now more strict in ensuring that the value type and the matcher
+ type are compatible, catching potential bugs in tests.
+* Improvement: Pointee() now works on an optional<T>.
+* Improvement: the ElementsAreArray() matcher can now take a vector or
+ iterator range as input, and makes a copy of its input elements
+ before the conversion to a Matcher.
+* Improvement: the Google Mock Generator can now generate mocks for
+ some class templates.
+* Bug fix: mock object destruction triggerred by another mock object's
+ destruction no longer hangs.
+* Improvement: Google Mock Doctor works better with newer Clang and
+ GCC now.
+* Compatibility fixes.
+* Bug/warning fixes.
+
+Changes for 1.6.0:
+
+* Compilation is much faster and uses much less memory, especially
+ when the constructor and destructor of a mock class are moved out of
+ the class body.
+* New matchers: Pointwise(), Each().
+* New actions: ReturnPointee() and ReturnRefOfCopy().
+* CMake support.
+* Project files for Visual Studio 2010.
+* AllOf() and AnyOf() can handle up-to 10 arguments now.
+* Google Mock doctor understands Clang error messages now.
+* SetArgPointee<> now accepts string literals.
+* gmock_gen.py handles storage specifier macros and template return
+ types now.
+* Compatibility fixes.
+* Bug fixes and implementation clean-ups.
+* Potentially incompatible changes: disables the harmful 'make install'
+ command in autotools.
+
+Potentially breaking changes:
+
+* The description string for MATCHER*() changes from Python-style
+ interpolation to an ordinary C++ string expression.
+* SetArgumentPointee is deprecated in favor of SetArgPointee.
+* Some non-essential project files for Visual Studio 2005 are removed.
+
+Changes for 1.5.0:
+
+ * New feature: Google Mock can be safely used in multi-threaded tests
+ on platforms having pthreads.
+ * New feature: function for printing a value of arbitrary type.
+ * New feature: function ExplainMatchResult() for easy definition of
+ composite matchers.
+ * The new matcher API lets user-defined matchers generate custom
+ explanations more directly and efficiently.
+ * Better failure messages all around.
+ * NotNull() and IsNull() now work with smart pointers.
+ * Field() and Property() now work when the matcher argument is a pointer
+ passed by reference.
+ * Regular expression matchers on all platforms.
+ * Added GCC 4.0 support for Google Mock Doctor.
+ * Added gmock_all_test.cc for compiling most Google Mock tests
+ in a single file.
+ * Significantly cleaned up compiler warnings.
+ * Bug fixes, better test coverage, and implementation clean-ups.
+
+ Potentially breaking changes:
+
+ * Custom matchers defined using MatcherInterface or MakePolymorphicMatcher()
+ need to be updated after upgrading to Google Mock 1.5.0; matchers defined
+ using MATCHER or MATCHER_P* aren't affected.
+ * Dropped support for 'make install'.
+
+Changes for 1.4.0 (we skipped 1.2.* and 1.3.* to match the version of
+Google Test):
+
+ * Works in more environments: Symbian and minGW, Visual C++ 7.1.
+ * Lighter weight: comes with our own implementation of TR1 tuple (no
+ more dependency on Boost!).
+ * New feature: --gmock_catch_leaked_mocks for detecting leaked mocks.
+ * New feature: ACTION_TEMPLATE for defining templatized actions.
+ * New feature: the .After() clause for specifying expectation order.
+ * New feature: the .With() clause for for specifying inter-argument
+ constraints.
+ * New feature: actions ReturnArg<k>(), ReturnNew<T>(...), and
+ DeleteArg<k>().
+ * New feature: matchers Key(), Pair(), Args<...>(), AllArgs(), IsNull(),
+ and Contains().
+ * New feature: utility class MockFunction<F>, useful for checkpoints, etc.
+ * New feature: functions Value(x, m) and SafeMatcherCast<T>(m).
+ * New feature: copying a mock object is rejected at compile time.
+ * New feature: a script for fusing all Google Mock and Google Test
+ source files for easy deployment.
+ * Improved the Google Mock doctor to diagnose more diseases.
+ * Improved the Google Mock generator script.
+ * Compatibility fixes for Mac OS X and gcc.
+ * Bug fixes and implementation clean-ups.
+
+Changes for 1.1.0:
+
+ * New feature: ability to use Google Mock with any testing framework.
+ * New feature: macros for easily defining new matchers
+ * New feature: macros for easily defining new actions.
+ * New feature: more container matchers.
+ * New feature: actions for accessing function arguments and throwing
+ exceptions.
+ * Improved the Google Mock doctor script for diagnosing compiler errors.
+ * Bug fixes and implementation clean-ups.
+
+Changes for 1.0.0:
+
+ * Initial Open Source release of Google Mock
http://git-wip-us.apache.org/repos/asf/orc/blob/7de5d89d/c++/libs/gmock-1.7.0/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/c++/libs/gmock-1.7.0/CMakeLists.txt b/c++/libs/gmock-1.7.0/CMakeLists.txt
new file mode 100644
index 0000000..9453dff
--- /dev/null
+++ b/c++/libs/gmock-1.7.0/CMakeLists.txt
@@ -0,0 +1,165 @@
+########################################################################
+# CMake build script for Google Mock.
+#
+# To run the tests for Google Mock itself on Linux, use 'make test' or
+# ctest. You can select which tests to run using 'ctest -R regex'.
+# For more options, run 'ctest --help'.
+
+# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to
+# make it prominent in the GUI.
+option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)
+
+option(gmock_build_tests "Build all of Google Mock's own tests." OFF)
+
+# A directory to find Google Test sources.
+if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/gtest/CMakeLists.txt")
+ set(gtest_dir gtest)
+else()
+ set(gtest_dir ../gtest)
+endif()
+
+# Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build().
+include("${gtest_dir}/cmake/hermetic_build.cmake" OPTIONAL)
+
+if (COMMAND pre_project_set_up_hermetic_build)
+ # Google Test also calls hermetic setup functions from add_subdirectory,
+ # although its changes will not affect things at the current scope.
+ pre_project_set_up_hermetic_build()
+endif()
+
+########################################################################
+#
+# Project-wide settings
+
+# Name of the project.
+#
+# CMake files in this project can refer to the root source directory
+# as ${gmock_SOURCE_DIR} and to the root binary directory as
+# ${gmock_BINARY_DIR}.
+# Language "C" is required for find_package(Threads).
+project(gmock CXX C)
+cmake_minimum_required(VERSION 2.6.2)
+
+if (COMMAND set_up_hermetic_build)
+ set_up_hermetic_build()
+endif()
+
+# Instructs CMake to process Google Test's CMakeLists.txt and add its
+# targets to the current scope. We are placing Google Test's binary
+# directory in a subdirectory of our own as VC compilation may break
+# if they are the same (the default).
+add_subdirectory("${gtest_dir}" "${gmock_BINARY_DIR}/gtest")
+
+# Although Google Test's CMakeLists.txt calls this function, the
+# changes there don't affect the current scope. Therefore we have to
+# call it again here.
+config_compiler_and_linker() # from ${gtest_dir}/cmake/internal_utils.cmake
+
+# Adds Google Mock's and Google Test's header directories to the search path.
+include_directories("${gmock_SOURCE_DIR}/include"
+ "${gmock_SOURCE_DIR}"
+ "${gtest_SOURCE_DIR}/include"
+ # This directory is needed to build directly from Google
+ # Test sources.
+ "${gtest_SOURCE_DIR}")
+
+########################################################################
+#
+# Defines the gmock & gmock_main libraries. User tests should link
+# with one of them.
+
+# Google Mock libraries. We build them using more strict warnings than what
+# are used for other targets, to ensure that Google Mock can be compiled by
+# a user aggressive about warnings.
+cxx_library(gmock
+ "${cxx_strict}"
+ "${gtest_dir}/src/gtest-all.cc"
+ src/gmock-all.cc)
+
+########################################################################
+#
+# Google Mock's own tests.
+#
+# You can skip this section if you aren't interested in testing
+# Google Mock itself.
+#
+# The tests are not built by default. To build them, set the
+# gmock_build_tests option to ON. You can do it by running ccmake
+# or specifying the -Dgmock_build_tests=ON flag when running cmake.
+
+if (gmock_build_tests)
+ # This must be set in the root directory for the tests to be run by
+ # 'make test' or ctest.
+ enable_testing()
+
+ ############################################################
+ # C++ tests built with standard compiler flags.
+
+ cxx_test(gmock-actions_test gmock_main)
+ cxx_test(gmock-cardinalities_test gmock_main)
+ cxx_test(gmock_ex_test gmock_main)
+ cxx_test(gmock-generated-actions_test gmock_main)
+ cxx_test(gmock-generated-function-mockers_test gmock_main)
+ cxx_test(gmock-generated-internal-utils_test gmock_main)
+ cxx_test(gmock-generated-matchers_test gmock_main)
+ cxx_test(gmock-internal-utils_test gmock_main)
+ cxx_test(gmock-matchers_test gmock_main)
+ cxx_test(gmock-more-actions_test gmock_main)
+ cxx_test(gmock-nice-strict_test gmock_main)
+ cxx_test(gmock-port_test gmock_main)
+ cxx_test(gmock-spec-builders_test gmock_main)
+ cxx_test(gmock_link_test gmock_main test/gmock_link2_test.cc)
+ cxx_test(gmock_test gmock_main)
+
+ if (CMAKE_USE_PTHREADS_INIT)
+ cxx_test(gmock_stress_test gmock)
+ endif()
+
+ # gmock_all_test is commented to save time building and running tests.
+ # Uncomment if necessary.
+ # cxx_test(gmock_all_test gmock_main)
+
+ ############################################################
+ # C++ tests built with non-standard compiler flags.
+
+ cxx_library(gmock_main_no_exception "${cxx_no_exception}"
+ "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc)
+
+ cxx_library(gmock_main_no_rtti "${cxx_no_rtti}"
+ "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc)
+
+ cxx_library(gmock_main_use_own_tuple "${cxx_use_own_tuple}"
+ "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc)
+
+ cxx_test_with_flags(gmock-more-actions_no_exception_test "${cxx_no_exception}"
+ gmock_main_no_exception test/gmock-more-actions_test.cc)
+
+ cxx_test_with_flags(gmock_no_rtti_test "${cxx_no_rtti}"
+ gmock_main_no_rtti test/gmock-spec-builders_test.cc)
+
+ cxx_test_with_flags(gmock_use_own_tuple_test "${cxx_use_own_tuple}"
+ gmock_main_use_own_tuple test/gmock-spec-builders_test.cc)
+
+ cxx_shared_library(shared_gmock_main "${cxx_default}"
+ "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc)
+
+ # Tests that a binary can be built with Google Mock as a shared library. On
+ # some system configurations, it may not possible to run the binary without
+ # knowing more details about the system configurations. We do not try to run
+ # this binary. To get a more robust shared library coverage, configure with
+ # -DBUILD_SHARED_LIBS=ON.
+ cxx_executable_with_flags(shared_gmock_test_ "${cxx_default}"
+ shared_gmock_main test/gmock-spec-builders_test.cc)
+ set_target_properties(shared_gmock_test_
+ PROPERTIES
+ COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1")
+
+ ############################################################
+ # Python tests.
+
+ cxx_executable(gmock_leak_test_ test gmock_main)
+ py_test(gmock_leak_test)
+
+ cxx_executable(gmock_output_test_ test gmock)
+ py_test(gmock_output_test)
+endif()
http://git-wip-us.apache.org/repos/asf/orc/blob/7de5d89d/c++/libs/gmock-1.7.0/CONTRIBUTORS
----------------------------------------------------------------------
diff --git a/c++/libs/gmock-1.7.0/CONTRIBUTORS b/c++/libs/gmock-1.7.0/CONTRIBUTORS
new file mode 100644
index 0000000..6e9ae36
--- /dev/null
+++ b/c++/libs/gmock-1.7.0/CONTRIBUTORS
@@ -0,0 +1,40 @@
+# This file contains a list of people who've made non-trivial
+# contribution to the Google C++ Mocking Framework project. People
+# who commit code to the project are encouraged to add their names
+# here. Please keep the list sorted by first names.
+
+Benoit Sigoure <ts...@google.com>
+Bogdan Piloca <bo...@google.com>
+Chandler Carruth <ch...@google.com>
+Dave MacLachlan <dm...@gmail.com>
+David Anderson <da...@google.com>
+Dean Sturtevant
+Gene Volovich <gv...@cite.com>
+Hal Burch <gm...@hburch.com>
+Jeffrey Yasskin <jy...@google.com>
+Jim Keller <ji...@google.com>
+Joe Walnes <jo...@truemesh.com>
+Jon Wray <jw...@google.com>
+Keir Mierle <mi...@gmail.com>
+Keith Ray <ke...@gmail.com>
+Kostya Serebryany <kc...@google.com>
+Lev Makhlis
+Manuel Klimek <kl...@google.com>
+Mario Tanev <ra...@google.com>
+Mark Paskin
+Markus Heule <ma...@gmail.com>
+Matthew Simmons <si...@acm.org>
+Mike Bland <mb...@google.com>
+Neal Norwitz <nn...@gmail.com>
+Nermin Ozkiranartli <ne...@google.com>
+Owen Carlsen <oc...@google.com>
+Paneendra Ba <pa...@google.com>
+Paul Menage <me...@google.com>
+Piotr Kaminski <pi...@google.com>
+Russ Rufer <ru...@pentad.com>
+Sverre Sundsdal <su...@gmail.com>
+Takeshi Yoshino <ty...@google.com>
+Vadim Berman <va...@google.com>
+Vlad Losev <vl...@google.com>
+Wolfgang Klier <wk...@google.com>
+Zhanyong Wan <wa...@google.com>
http://git-wip-us.apache.org/repos/asf/orc/blob/7de5d89d/c++/libs/gmock-1.7.0/LICENSE
----------------------------------------------------------------------
diff --git a/c++/libs/gmock-1.7.0/LICENSE b/c++/libs/gmock-1.7.0/LICENSE
new file mode 100644
index 0000000..1941a11
--- /dev/null
+++ b/c++/libs/gmock-1.7.0/LICENSE
@@ -0,0 +1,28 @@
+Copyright 2008, Google 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:
+
+ * 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 Google Inc. 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.
http://git-wip-us.apache.org/repos/asf/orc/blob/7de5d89d/c++/libs/gmock-1.7.0/Makefile.am
----------------------------------------------------------------------
diff --git a/c++/libs/gmock-1.7.0/Makefile.am b/c++/libs/gmock-1.7.0/Makefile.am
new file mode 100644
index 0000000..0eb7bd8
--- /dev/null
+++ b/c++/libs/gmock-1.7.0/Makefile.am
@@ -0,0 +1,216 @@
+# Automake file
+
+# Nonstandard package files for distribution.
+EXTRA_DIST = LICENSE
+
+# We may need to build our internally packaged gtest. If so, it will be
+# included in the 'subdirs' variable.
+SUBDIRS = $(subdirs)
+
+# This is generated by the configure script, so clean it for distribution.
+DISTCLEANFILES = scripts/gmock-config
+
+# We define the global AM_CPPFLAGS as everything we compile includes from these
+# directories.
+AM_CPPFLAGS = $(GTEST_CPPFLAGS) -I$(srcdir)/include
+
+# Modifies compiler and linker flags for pthreads compatibility.
+if HAVE_PTHREADS
+ AM_CXXFLAGS = @PTHREAD_CFLAGS@ -DGTEST_HAS_PTHREAD=1
+ AM_LIBS = @PTHREAD_LIBS@
+endif
+
+# Build rules for libraries.
+lib_LTLIBRARIES = lib/libgmock.la lib/libgmock_main.la
+
+lib_libgmock_la_SOURCES = src/gmock-all.cc
+
+pkginclude_HEADERS = \
+ include/gmock/gmock-actions.h \
+ include/gmock/gmock-cardinalities.h \
+ include/gmock/gmock-generated-actions.h \
+ include/gmock/gmock-generated-function-mockers.h \
+ include/gmock/gmock-generated-matchers.h \
+ include/gmock/gmock-generated-nice-strict.h \
+ include/gmock/gmock-matchers.h \
+ include/gmock/gmock-more-actions.h \
+ include/gmock/gmock-more-matchers.h \
+ include/gmock/gmock-spec-builders.h \
+ include/gmock/gmock.h
+
+pkginclude_internaldir = $(pkgincludedir)/internal
+pkginclude_internal_HEADERS = \
+ include/gmock/internal/gmock-generated-internal-utils.h \
+ include/gmock/internal/gmock-internal-utils.h \
+ include/gmock/internal/gmock-port.h
+
+lib_libgmock_main_la_SOURCES = src/gmock_main.cc
+lib_libgmock_main_la_LIBADD = lib/libgmock.la
+
+# Build rules for tests. Automake's naming for some of these variables isn't
+# terribly obvious, so this is a brief reference:
+#
+# TESTS -- Programs run automatically by "make check"
+# check_PROGRAMS -- Programs built by "make check" but not necessarily run
+
+TESTS=
+check_PROGRAMS=
+AM_LDFLAGS = $(GTEST_LDFLAGS)
+
+# This exercises all major components of Google Mock. It also
+# verifies that libgmock works.
+TESTS += test/gmock-spec-builders_test
+check_PROGRAMS += test/gmock-spec-builders_test
+test_gmock_spec_builders_test_SOURCES = test/gmock-spec-builders_test.cc
+test_gmock_spec_builders_test_LDADD = $(GTEST_LIBS) lib/libgmock.la
+
+# This tests using Google Mock in multiple translation units. It also
+# verifies that libgmock_main and libgmock work.
+TESTS += test/gmock_link_test
+check_PROGRAMS += test/gmock_link_test
+test_gmock_link_test_SOURCES = \
+ test/gmock_link2_test.cc \
+ test/gmock_link_test.cc \
+ test/gmock_link_test.h
+test_gmock_link_test_LDADD = $(GTEST_LIBS) lib/libgmock_main.la lib/libgmock.la
+
+if HAVE_PYTHON
+ # Tests that fused gmock files compile and work.
+ TESTS += test/gmock_fused_test
+ check_PROGRAMS += test/gmock_fused_test
+ test_gmock_fused_test_SOURCES = \
+ fused-src/gmock-gtest-all.cc \
+ fused-src/gmock/gmock.h \
+ fused-src/gmock_main.cc \
+ fused-src/gtest/gtest.h \
+ test/gmock_test.cc
+ test_gmock_fused_test_CPPFLAGS = -I"$(srcdir)/fused-src"
+endif
+
+# Google Mock source files that we don't compile directly.
+GMOCK_SOURCE_INGLUDES = \
+ src/gmock-cardinalities.cc \
+ src/gmock-internal-utils.cc \
+ src/gmock-matchers.cc \
+ src/gmock-spec-builders.cc \
+ src/gmock.cc
+
+EXTRA_DIST += $(GMOCK_SOURCE_INGLUDES)
+
+# C++ tests that we don't compile using autotools.
+EXTRA_DIST += \
+ test/gmock-actions_test.cc \
+ test/gmock_all_test.cc \
+ test/gmock-cardinalities_test.cc \
+ test/gmock_ex_test.cc \
+ test/gmock-generated-actions_test.cc \
+ test/gmock-generated-function-mockers_test.cc \
+ test/gmock-generated-internal-utils_test.cc \
+ test/gmock-generated-matchers_test.cc \
+ test/gmock-internal-utils_test.cc \
+ test/gmock-matchers_test.cc \
+ test/gmock-more-actions_test.cc \
+ test/gmock-nice-strict_test.cc \
+ test/gmock-port_test.cc \
+ test/gmock_stress_test.cc
+
+# Python tests, which we don't run using autotools.
+EXTRA_DIST += \
+ test/gmock_leak_test.py \
+ test/gmock_leak_test_.cc \
+ test/gmock_output_test.py \
+ test/gmock_output_test_.cc \
+ test/gmock_output_test_golden.txt \
+ test/gmock_test_utils.py
+
+# Nonstandard package files for distribution.
+EXTRA_DIST += \
+ CHANGES \
+ CONTRIBUTORS \
+ make/Makefile
+
+# Pump scripts for generating Google Mock headers.
+# TODO(chandlerc@google.com): automate the generation of *.h from *.h.pump.
+EXTRA_DIST += \
+ include/gmock/gmock-generated-actions.h.pump \
+ include/gmock/gmock-generated-function-mockers.h.pump \
+ include/gmock/gmock-generated-matchers.h.pump \
+ include/gmock/gmock-generated-nice-strict.h.pump \
+ include/gmock/internal/gmock-generated-internal-utils.h.pump
+
+# Script for fusing Google Mock and Google Test source files.
+EXTRA_DIST += scripts/fuse_gmock_files.py
+
+# The Google Mock Generator tool from the cppclean project.
+EXTRA_DIST += \
+ scripts/generator/LICENSE \
+ scripts/generator/README \
+ scripts/generator/README.cppclean \
+ scripts/generator/cpp/__init__.py \
+ scripts/generator/cpp/ast.py \
+ scripts/generator/cpp/gmock_class.py \
+ scripts/generator/cpp/keywords.py \
+ scripts/generator/cpp/tokenize.py \
+ scripts/generator/cpp/utils.py \
+ scripts/generator/gmock_gen.py
+
+# CMake scripts.
+EXTRA_DIST += \
+ CMakeLists.txt
+
+# Microsoft Visual Studio 2005 projects.
+EXTRA_DIST += \
+ msvc/2005/gmock.sln \
+ msvc/2005/gmock.vcproj \
+ msvc/2005/gmock_config.vsprops \
+ msvc/2005/gmock_main.vcproj \
+ msvc/2005/gmock_test.vcproj
+
+# Microsoft Visual Studio 2010 projects.
+EXTRA_DIST += \
+ msvc/2010/gmock.sln \
+ msvc/2010/gmock.vcxproj \
+ msvc/2010/gmock_config.props \
+ msvc/2010/gmock_main.vcxproj \
+ msvc/2010/gmock_test.vcxproj
+
+if HAVE_PYTHON
+# gmock_test.cc does not really depend on files generated by the
+# fused-gmock-internal rule. However, gmock_test.o does, and it is
+# important to include test/gmock_test.cc as part of this rule in order to
+# prevent compiling gmock_test.o until all dependent files have been
+# generated.
+$(test_gmock_fused_test_SOURCES): fused-gmock-internal
+
+# TODO(vladl@google.com): Find a way to add Google Tests's sources here.
+fused-gmock-internal: $(pkginclude_HEADERS) $(pkginclude_internal_HEADERS) \
+ $(lib_libgmock_la_SOURCES) $(GMOCK_SOURCE_INGLUDES) \
+ $(lib_libgmock_main_la_SOURCES) \
+ scripts/fuse_gmock_files.py
+ mkdir -p "$(srcdir)/fused-src"
+ chmod -R u+w "$(srcdir)/fused-src"
+ rm -f "$(srcdir)/fused-src/gtest/gtest.h"
+ rm -f "$(srcdir)/fused-src/gmock/gmock.h"
+ rm -f "$(srcdir)/fused-src/gmock-gtest-all.cc"
+ "$(srcdir)/scripts/fuse_gmock_files.py" "$(srcdir)/fused-src"
+ cp -f "$(srcdir)/src/gmock_main.cc" "$(srcdir)/fused-src"
+
+maintainer-clean-local:
+ rm -rf "$(srcdir)/fused-src"
+endif
+
+# Death tests may produce core dumps in the build directory. In case
+# this happens, clean them to keep distcleancheck happy.
+CLEANFILES = core
+
+# Disables 'make install' as installing a compiled version of Google
+# Mock can lead to undefined behavior due to violation of the
+# One-Definition Rule.
+
+install-exec-local:
+ echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Mock into your build system."
+ false
+
+install-data-local:
+ echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Mock into your build system."
+ false