MFClient  1.3.0
 All Classes Functions Variables Enumerations
MFUtil.h
1 /*
2  * Copyright (C) 2015 MarketFactory, Inc. All rights reserved.
3  * Use in source and binary forms, with or without modification, is permitted
4  * provided that the following conditions are met:
5  * 1. You may only use this software for internal evaluation and testing
6  * purposes and may not use the software for engaging
7  * in live trades, unless and until you have entered into a separate agreement
8  * with MarketFactory governing the use of
9  * MarketFactory software in a production environment.
10  * 2. You may not distribute the software (in either source or binary forms) to
11  * third parties.
12  * 3. All copies of source code must retain the above copyright notice, this
13  * list of conditions and the following disclaimer.
14  * THIS SOFTWARE IS PROVIDED BY MARKETFACTORY AND ITS LICENSORS "AS IS" AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
16  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
17  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18  * NO EVENT SHALL MARKETFACTORY OR ITS LICENSORS BE LIABLE FOR ANY DIRECT,
19  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
22  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23  * LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 #ifndef _MF_UTIL_H_
29 #define _MF_UTIL_H_
30 
31 //-----------------------------------------------------
32 namespace MFUtil {
33 
34 enum {
35  QTY_EXPONENT = 100000L,
36  PRICE_EXPONENT = 1000000000L
37 };
38 
39 inline int64_t convertQuantityToMantissa(int64_t quantity) {
40  return quantity * QTY_EXPONENT;
41 }
42 
43 inline int64_t convertPriceToMantissa(int64_t price) {
44  return price * PRICE_EXPONENT;
45 }
46 }
47 #endif