text
stringlengths 4
6.14k
|
|---|
/** @file LCG.h
@author Jukka Jylänki
This work is copyrighted material and may NOT be used for any kind of commercial or
personal advantage and may NOT be copied or redistributed without prior consent
of the author(s).
@brief A linear congruential random number generator.
*/
#pragma once
#include "CoreTypes.h"
/** @brief A linear congruential random number generator.
Uses D.H. Lehmer's Linear Congruential Method (1949) for generating random numbers.
Supports both Multiplicative Congruential Method (increment==0) and
Mixed Congruential Method (increment!=0)
It is perhaps the simplest and fastest method to generate pseudo-random numbers on
a computer. Per default uses the values for Minimal Standard LCG.
http://en.wikipedia.org/wiki/Linear_congruential_generator
http://www.math.rutgers.edu/~greenfie/currentcourses/sem090/pdfstuff/jp.pdf
Pros: * Easy to implement.
* Fast.
Cons: * NOT safe for cryptography because of the easily calculatable sequential
correlation between successive calls. A case study:
http://www.cigital.com/papers/download/developer_gambling.php
* Tends to have less random low-order bits (compared to the high-order bits)
Thus, NEVER do something like this:
u32 numBetween1And10 = 1 + LCGRand.Int() % 10;
Instead, take into account EVERY bit of the generated number, like this:
u32 numBetween1And10 = 1 + (int)(10.0 * (double)LCGRand.Int()
/(LCGRand.Max()+1.0));
or simply
u32 numBetween1And10 = LCGRand.Float(1.f, 10.f); */
class LCG
{
public:
/// Initializes the generator from the current system clock.
LCG();
/// Initializes the generator using a custom seed.
LCG(u32 seed, u32 multiplier = 69621,
u32 increment = 0, u32 modulus = 0x7FFFFFFF /* 2^31 - 1 */)
{
Seed(seed, multiplier, increment, modulus);
}
/// Reinitializes the generator to the new settings.
void Seed(u32 seed, u32 multiplier = 69621, u32 increment = 0, u32 modulus = 0x7FFFFFFF);
/// Returns an integer in the range [0, MaxInt()]
u32 Int();
/// Returns the biggest number the generator can yield. (Which is always modulus-1)
u32 MaxInt() const { return modulus - 1; }
u32 IntFast();
/// Returns an integer in the range [a, b]
/** @param a Lower bound, inclusive.
@param b Upper bound, inclusive.
@return An integer in the range [a, b] */
int Int(int a, int b);
/// Returns a float in the range [0, 1[.
float Float();
/// Returns a float in the range [a, b[.
/** @param a Lower bound, inclusive.
@param b Upper bound, exclusive.
@return A float in the range [a, b[ */
float Float(float a, float b);
private:
u32 multiplier;
u32 increment;
u32 modulus;
u32 lastNumber;
};
#ifdef QT_INTEROP
Q_DECLARE_METATYPE(LCG)
Q_DECLARE_METATYPE(LCG*)
#endif
|
#include <stdio.h>
#include <stdlib.h>
int main(){
double x = 1;
double num = 121;
double y = 1.0 / 2 * (x + num/x);
while(fabs(y-x) > 1e-5){
x = y;
y = 1.0 / 2 * (x + num/x);
}
printf("%.3lf\n",y);
}
|
//
// FZSportsViewController.h
// Map
//
// Created by zhoufei on 16/6/12.
// Copyright © 2016年 zhoufei. All rights reserved.
//
#import "BaseViewController.h"
@interface FZSportsViewController : BaseViewController
@end
|
/**
* xrdp: A Remote Desktop Protocol server.
*
* Copyright (C) Jay Sorg 2004-2012
*
* 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.
*/
/**
*
* @file sesman.h
* @brief Main include file
* @author Jay Sorg
*
*/
#ifndef SESMAN_H
#define SESMAN_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "d3des.h"
#include "arch.h"
#include "parse.h"
#include "os_calls.h"
#include "log.h"
#include "env.h"
#include "auth.h"
#include "cfg.h"
#include "sig.h"
#include "session.h"
#include "access.h"
#include "scp.h"
#include "thread.h"
#include "lock.h"
#include "thread_calls.h"
#include "libscp.h"
#endif
|
//
// CircleShapeLayer.h
// buxinteng
//
// Created by Anyson Chan on 15/11/17.
// Copyright © 2015年 Anyson Chan. All rights reserved.
//
#import <QuartzCore/QuartzCore.h>
@interface CircleShapeLayer : CAShapeLayer
@property (nonatomic) NSTimeInterval elapsedTime;
@property (nonatomic) NSTimeInterval timeLimit;
@property (assign, nonatomic, readonly) double percent;
@property (nonatomic) UIColor *progressColor;
@end
|
//
// HWShareViewController.h
// 00-ItcastLottery
//
// Created by apple on 14-4-19.
// Copyright (c) 2014年 itcast. All rights reserved.
//
#import "HWBaseSettingViewController.h"
@interface HWShareViewController : HWBaseSettingViewController
@end
|
/*
* Device.h
*
* Created on: Mar 28, 2016
* Author: James Hong
*/
#ifndef INCLUDE_DEVICE_H_
#define INCLUDE_DEVICE_H_
#include <atomic>
#include <cstdint>
#include <exception>
#include <functional>
#include <map>
#include <memory>
#include <mutex>
#include <string>
#include <set>
#include "BeetleTypes.h"
/* Forward declarations */
class HandleAllocationTable;
class DeviceException : public std::exception {
public:
DeviceException(std::string msg) : msg(msg) {};
DeviceException(const char *msg) : msg(msg) {};
~DeviceException() throw() {};
const char *what() const throw() { return this->msg.c_str(); };
private:
std::string msg;
};
class Device {
public:
enum DeviceType {
UNKNOWN = -1,
BEETLE_INTERNAL = 0,
LE_PERIPHERAL = 1,
LE_CENTRAL = 2,
TCP_CLIENT = 3,
IPC_APPLICATION = 4,
TCP_CLIENT_PROXY = 5,
TCP_SERVER_PROXY = 6,
};
virtual ~Device();
/*
* Get the device's unique identifier for this connection
* instance.
*/
device_t getId();
/*
* Returns the device name if it has been set.
*/
std::string getName();
/*
* Returns a enum device type.
*/
DeviceType getType();
/*
* Returns a enum device type.
*/
std::string getTypeStr();
/*
* Return largest, untranslated handle.
*/
int getHighestHandle();
/*
* Handles that this device exposes to other devices as a server.
*/
std::map<uint16_t, std::shared_ptr<Handle>> handles;
std::recursive_mutex handlesMutex;
/*
* Handle address offsets that this device is a client to.
*/
std::unique_ptr<HandleAllocationTable> hat;
std::mutex hatMutex;
/*
* Devices that have this device in their client handle space.
*/
std::set<device_t> mappedTo;
std::mutex mappedToMutex;
/*
* Unsubscribe from all of this device's handles.
*/
void unsubscribeAll(device_t d);
/*
* Enqueues a response. Returns whether the response was enqueued. Buf is owned by the caller and should not be
* freed.
*/
virtual void writeResponse(uint8_t *buf, int len) = 0;
/*
* Enqueues a command. Returns whether the command was enqueued. Buf is owned by the caller and should not be
* freed.
*/
virtual void writeCommand(uint8_t *buf, int len) = 0;
/*
* Enqueues a transaction. The callback is called when the response is received.
* The pointers passed to cb do not persist after cb is done. Returns whether
* the transaction was enqueued. On error the first argument to cb is NULL.
*
* Buf is owned by the caller and should not be freed.
*/
virtual void writeTransaction(uint8_t *buf, int len, std::function<void(uint8_t*, int)> cb) = 0;
/*
* Blocks until the transaction finishes. Resp is set and must be freed by the caller.
* Returns the length of resp. On error, resp is NULL.
*
* Buf is owned by the caller and should not be freed. Response is written by reference to resp, and length is
* returned.
*/
virtual int writeTransactionBlocking(uint8_t *buf, int len, uint8_t *&resp) = 0;
/*
* The largest packet this device can receive. Beetle will
* only ever advertise the default ATT_MTU, but larger MTU
* can allow faster handle discovery.
*/
virtual int getMTU() = 0;
protected:
/*
* Cannot instantiate a device directly.
*/
Device(Beetle &beetle, HandleAllocationTable *hat = NULL);
Device(Beetle &beetle, device_t id, HandleAllocationTable *hat = NULL);
Beetle &beetle;
std::string name;
DeviceType type;
private:
device_t id;
static std::atomic_int idCounter;
static const std::string deviceType2Str[];
};
#endif /* INCLUDE_DEVICE_H_ */
|
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// TSValidatedTextField
#define COCOAPODS_POD_AVAILABLE_TSValidatedTextField
#define COCOAPODS_VERSION_MAJOR_TSValidatedTextField 0
#define COCOAPODS_VERSION_MINOR_TSValidatedTextField 1
#define COCOAPODS_VERSION_PATCH_TSValidatedTextField 0
|
//
// SinaWeiboPackage.h
// MobiSageSDK
//
// Created by Ryou Zhang on 10/23/11.
// Copyright (c) 2011 mobiSage. All rights reserved.
//
#import "MobiSageSNSPackage.h"
@interface MSSinaWeiboPackage : MobiSageSNSPackage
{
@protected
NSString* m_AppKey;
NSString* m_AccessToken;
NSString* m_UrlPath;
NSString* m_HttpMethod;
NSMutableDictionary* m_ParamDic;
}
-(id)initWithAppKey:(NSString*)appKey;
-(id)initWithAppKey:(NSString *)appKey AccessToken:(NSString*)accessToken;
-(void)generateHTTPBody:(NSMutableURLRequest*)request;
-(void)addParameter:(NSString*)name Value:(NSString*)value;
@end
|
//
// AppDelegate.h
// RoleModule
//
// Created by zhoufei on 2019/1/20.
// Copyright © 2019年 zhoufei. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
//
// KGMClassAlbumController.h
// MDKinderGarten
//
// Created by 周永超 on 16/10/20.
// Copyright © 2016年 zhouyongchao. All rights reserved.
//
#import "BaseViewController.h"
@interface KGMClassAlbumController : BaseViewController
@end
|
// http://www.cnblogs.com/lidan/archive/2012/05/04/2482877.html
// 根据这篇博文 ,为什么
// udp也要调用connect函数呢,为什么udp的connect是两次握手呢?
// 抓包发现, udp connect 并不会导致握手, 不过可以给udp的
// fd 设置默认的发送地址,从而提高发送性能。可以用write read来操作udp的fd
#include <arpa/inet.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#define MAXLINE 1080
#define SERV_PORT 8888
struct user_admin {
long long type;
char username[64];
char password[64];
char address[64];
};
void do_cli(FILE* fp, int sockfd, struct sockaddr* pservaddr, socklen_t servlen)
{
int n;
char sendline[MAXLINE], recvline[MAXLINE + 1];
if (connect(sockfd, (struct sockaddr*)pservaddr, servlen) == -1) {
perror("connect error");
exit(1);
}
while (fgets(sendline, MAXLINE, fp) != NULL) {
struct user_admin query = { 0, "", "", "" };
write(sockfd, &query, sizeof(query));
n = read(sockfd, &query, sizeof(query));
if (n == -1) {
perror("read error");
exit(1);
}
printf("mesg=%s, %s, %s\n", query.address, query.username, query.password);
recvline[n] = 0;
//fputs(recvline, stdout);
}
}
int main(int argc, char** argv)
{
int sockfd;
struct sockaddr_in servaddr;
if (argc != 2) {
printf("usage: udpclient <IPaddress>\n");
exit(1);
}
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(SERV_PORT);
if (inet_pton(AF_INET, argv[1], &servaddr.sin_addr) <= 0) {
printf("[%s] is not a valid IPaddress\n", argv[1]);
exit(1);
}
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
do_cli(stdin, sockfd, (struct sockaddr*)&servaddr, sizeof(servaddr));
return 0;
}
|
/*!The Treasure Box Library
*
* 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 (C) 2009-present, TBOOX Open Source Group.
*
* @author ruki
* @file prefix.h
*
*/
#ifndef TB_UTILS_IMPL_PREFIX_H
#define TB_UTILS_IMPL_PREFIX_H
/* //////////////////////////////////////////////////////////////////////////////////////
* includes
*/
#include "../prefix.h"
#endif
|
/*
* Copyright (C) 2015 University of Oregon
*
* You may distribute under the terms of either the GNU General Public
* License or the Apache License, as specified in the LICENSE file.
*
* For more information, see the LICENSE file.
*/
#ifndef BGVARS_H
#define BGVARS_H
extern void setupBlocking();
extern int P_sendTPVars(int tree, int fd);
extern void P_endPipe(int fd);
extern int P_sendGPVars(int tree, int group, int fd);
extern int P_sendVPVars(int tree, char *name, int fd);
extern int J_sendTPVars(int tree, int fd);
extern int J_sendGPVars(int tree, int group, int fd);
extern int J_sendVPVars(int tree, char *name, int fd);
#endif
|
#pragma once
#ifndef MRL_STATIC_LINK
#ifdef MRL_EXPORTS
#define MRL_EXPORT __declspec(dllexport)
#else
#define MRL_EXPORT __declspec(dllimport)
#endif
#else
#define MRL_EXPORT
#endif
|
/**
* Copyright (c) 2009 Alex Fajkowski, Apparent Logic LLC
*
* 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.
*/
#if defined(USE_TI_UIIOSCOVERFLOWVIEW) || defined(USE_TI_UICOVERFLOWVIEW)
#import <UIKit/UIKit.h>
// paoapp2 modification note:
// using categories with static libraries don't seem to work
// right on device with iphone - probably a symbol issue
// turn this into a static function (from what was a category to UIImage
// originally)
UIImage* AddImageReflection(UIImage *src, CGFloat reflectionFraction);
#endif
|
// 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
//
// 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 GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_GRPC_UTILS_GRPC_ERROR_DELEGATE_H
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_GRPC_UTILS_GRPC_ERROR_DELEGATE_H
#include "google/cloud/grpc_error_delegate.h"
#include "google/cloud/version.h"
namespace google {
namespace cloud {
namespace grpc_utils {
inline namespace GOOGLE_CLOUD_CPP_NS {
using ::google::cloud::MakeStatusFromRpcError;
} // namespace GOOGLE_CLOUD_CPP_NS
} // namespace grpc_utils
} // namespace cloud
} // namespace google
#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_GRPC_UTILS_GRPC_ERROR_DELEGATE_H
|
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#include "tool_bname.h"
#include "memdebug.h" /* keep this as LAST include */
#ifndef HAVE_BASENAME
char *tool_basename(char *path)
{
char *s1;
char *s2;
s1 = strrchr(path, '/');
s2 = strrchr(path, '\\');
if(s1 && s2) {
path = (s1 > s2) ? s1 + 1 : s2 + 1;
}
else if(s1)
path = s1 + 1;
else if(s2)
path = s2 + 1;
return path;
}
#endif /* HAVE_BASENAME */
|
//
// Created by zhangrongxiang on 2018/1/11 16:59
// File server
//
#include <sys/types.h>
#include <sys/socket.h>
#include<pthread.h>
#include <netinet/in.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#define PORT 6668
int main(int argc, char **argv) {
// if (argc != 2) {
// printf("Usage: %s port\n", argv[0]);
// exit(1);
// }
printf("Welcome! This is a UDP server, I can only received message from client and reply with same message\n");
struct sockaddr_in addr;
addr.sin_family = AF_INET;
addr.sin_port = htons(PORT);
addr.sin_addr.s_addr = htonl(INADDR_ANY);
int sock;
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
perror("socket");
exit(1);
}
if (bind(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
perror("bind");
exit(1);
}
char buff[512];
struct sockaddr_in clientAddr;
int n;
int len = sizeof(clientAddr);
while (1) {
n = recvfrom(sock, buff, 511, 0, (struct sockaddr *) &clientAddr, &len);
if (n > 0) {
buff[n] = 0;
printf("%s %u says: %s\n", inet_ntoa(clientAddr.sin_addr), ntohs(clientAddr.sin_port), buff);
n = sendto(sock, buff, n, 0, (struct sockaddr *) &clientAddr, sizeof(clientAddr));
if (n < 0) {
perror("sendto");
break;
}
} else {
perror("recv");
break;
}
}
return 0;
}
|
/*
Copyright (c) 2011, Siemens Corporate Research a Division of Siemens Corporation
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.
*/
#ifndef SO_ITK_IMAGE_FUNCTION_H_
# define SO_ITK_IMAGE_FUNCTION_H_
# include "SoItkFunctionBase.h"
class SoItkImageFunction : public SoItkFunctionBase
{
SO_ENGINE_ABSTRACT_HEADER( SoItkImageFunction );
public:
SoItkImageFunction();
static void initClass();
protected:
~SoItkImageFunction();
virtual void evaluate() = 0;
};
#endif // SO_ITK_IMAGE_FUNCTION_H_
|
//
// NSAppleEventDescriptor+ObjectTest.h
//
// Created by dmaclach on 6/7/07.
// Copyright 2007 Google Inc. All rights reserved.
//
#import <SenTestingKit/SenTestingKit.h>
@interface NSAppleEventDescriptor_ObjectTest : SenTestCase
- (void)testRegisterSelectorForTypesCount;
- (void)testObjectValue;
- (void)testAppleEventDescriptor;
@end
|
/*
* chatSimple.h
*
* Created on: 2015/10/30/
* Author: Jason
*/
#ifndef CHATSIMPLE_H_
#define CHATSIMPLE_H_
#define _BSD_SOURCE
#define _POSIX_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <signal.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
#include <errno.h>
#include <pwd.h>
#include <grp.h>
#include <sys/socket.h>
#include <assert.h>
#include <string.h>
#include <stddef.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netinet/tcp.h>
#include <event2/event.h>
#include <event2/buffer.h>
#include <event2/bufferevent.h>
/*#define NULL ((void *)0L)*/
#define TRUE (1==1)
#define FASLE (0==1)
#define USERNAME_LEN 64
#define SAME 0 /* For strcmp() and memcmp()*/
extern int g_dbg;
#define trace if (g_dbg)
#define USER_DIR "./user/"
#define PATH_LEN 64
/**
* type of message.
*/
typedef enum MSG_TYPE_tag {
MSG_T_LOGIN = 0, /* user login*/
MSG_T_TEXT = 1, /* send text from a user to another user*/
MSG_T_FILE = 2, /* send a file */
MSG_T_RESP = 3, /* server responses a simple message to client*/
MSG_T_MAX /*Keep at the end*/
}MSG_TYPE;
/**
* user information. a
*/
typedef struct user_info_tag {
struct user_info_tag *next;
char name[USERNAME_LEN];
int fd;
struct bufferevent *bev;
struct evbuffer *intput;
struct evbuffer *output;
int online; /* if online or not*/
} USER;
/**
* The format of massage "on the air". It can be nested.
* using msg_get_*() to read the value from a tlv.
*
*Note: all t/l/ value are in network order.
*/
typedef struct tlv_tag {
int _t; /*should not be used directly. use macro tlv_type*/
int _l; /*should not be used directly. use macro tlv_len*/
char v[1]; /* A pointer to data in msg*/
} TLV;
#define tlv_type(tlv) ntohl((tlv)->_t)
#define tlv_len(tlv) ntohl((tlv)->_l)
/**
* basic message between client and server.
* type-length-value structure massage.
* Usage:
* Use the msg_create and msg_free in msg.c
*
*Note: any value from msg.p is in network order. other fields is host order.
*/
typedef struct msg_tag {
int t; /*type*/
int l; /*length*/
int f; /*flag*/
int pos; /*current read offset of the value*/
char *p; /*pointer of value*/
} MSG;
#define MSG_MAX_LEN (2<<16) /*16K*/
#define MSG_HEAD_LEN (4+4) /*type + len*/
#define BUFF_MIN_LEN MSG_HEAD_LEN
#define BUFF_MAX_LEN (MSG_MAX_LEN + MSG_HEAD_LEN)
/*flag of message*/
#define MSG_F_PTR_NEW (1<<0) /* msg->p will be freed by msg_free() */
#define MSG_F_PTR_OLD (1<<1) /* msg->p will not be freed by msg_free() */
#define MSG_F_PART (1<<2) /* the msg is incomplete, because it is too large*/
extern USER *g_users;
extern MSG* msg_create(int type, int len, char* v, int flag) ;
extern void msg_response(struct evbuffer *output, char *str);
extern USER* user_get(char *name, int fd);
extern USER* user_add(char *name);
extern void procmsg_main(MSG *msg, struct bufferevent *bev, void *ctx);
extern void msg_free (MSG **msg) ;
extern void user_load(char *dir);
extern int isPathExist (char *path, int isDirOrFile);
extern int get_filesize(char *filename) ;
extern void user_sendOffline(char *name, USER* user);
extern char *strtrim(char *line);
#endif /* CHATSIMPLE_H_ */
|
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* 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.txt
*
* 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 __itkCheckerBoardImageFilter_h
#define __itkCheckerBoardImageFilter_h
#include "itkImageToImageFilter.h"
namespace itk
{
/** \class CheckerBoardImageFilter
* \brief Combines two images in a checkerboard pattern.
*
* CheckerBoardImageFilter takes two input images that must have the same
* dimension, size, origin and spacing and produces an output image of the same
* size by combinining the pixels from the two input images in a checkerboard
* pattern. This filter is commonly used for visually comparing two images, in
* particular for evaluating the results of an image registration process.
*
* This filter is implemented as a multithreaded filter. It provides a
* ThreadedGenerateData() method for its implementation.
*
* \ingroup IntensityImageFilters MultiThreaded
* \ingroup ITKImageCompare
*
* \wiki
* \wikiexample{Inspection/CheckerBoardImageFilter,Combine two images by alternating blocks of a checkerboard pattern}
* \endwiki
*/
template< typename TImage >
class CheckerBoardImageFilter:
public ImageToImageFilter< TImage, TImage >
{
public:
/** Standard class typedefs. */
typedef CheckerBoardImageFilter Self;
typedef ImageToImageFilter< TImage, TImage > Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
typedef TImage InputImageType;
typedef TImage OutputImageType;
typedef typename InputImageType::ConstPointer InputImageConstPointer;
typedef typename OutputImageType::Pointer OutputImagePointer;
typedef typename OutputImageType::RegionType ImageRegionType;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(CheckerBoardImageFilter, ImageToImageFilter);
/** Number of dimensions. */
itkStaticConstMacro(ImageDimension, unsigned int,
TImage::ImageDimension);
/** Type to hold the number of checker boxes per dimension */
typedef FixedArray< unsigned int,
TImage ::ImageDimension > PatternArrayType;
/** Connect one of the operands for checker board */
void SetInput1(const TImage *image1);
/** Connect one of the operands for checker board */
void SetInput2(const TImage *image2);
/** Set array with number of checks to make per image dimension */
itkSetMacro(CheckerPattern, PatternArrayType);
itkGetConstReferenceMacro(CheckerPattern, PatternArrayType);
protected:
CheckerBoardImageFilter();
~CheckerBoardImageFilter() {}
void PrintSelf(std::ostream & os, Indent indent) const;
/** CheckerBoardImageFilter can be implemented as a multithreaded filter. Therefore,
* this implementation provides a ThreadedGenerateData() routine which
* is called for each processing thread. The output image data is allocated
* automatically by the superclass prior to calling ThreadedGenerateData().
* ThreadedGenerateData can only write to the portion of the output image
* specified by the parameter "outputRegionForThread"
* \sa ImageToImageFilter::ThreadedGenerateData(),
* ImageToImageFilter::GenerateData() */
void ThreadedGenerateData(const ImageRegionType & outputRegionForThread,
ThreadIdType threadId);
private:
CheckerBoardImageFilter(const Self &); //purposely not implemented
void operator=(const Self &); //purposely not implemented
PatternArrayType m_CheckerPattern;
};
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkCheckerBoardImageFilter.hxx"
#endif
#endif
|
#ifndef VAIVEN_VISITOR_HEADER_SSA_TYPE_ANALYSIS
#define VAIVEN_VISITOR_HEADER_SSA_TYPE_ANALYSIS
#include "forward_visitor.h"
namespace vaiven { namespace ssa {
class TypeAnalysis : public ForwardVisitor {
public:
void visitPhiInstr(PhiInstr& instr);
void visitArgInstr(ArgInstr& instr);
void visitConstantInstr(ConstantInstr& instr);
void visitCallInstr(CallInstr& instr);
void visitTypecheckInstr(TypecheckInstr& instr);
void visitBoxInstr(BoxInstr& instr);
void visitUnboxInstr(UnboxInstr& instr);
void visitToDoubleInstr(ToDoubleInstr& instr);
void visitIntToDoubleInstr(IntToDoubleInstr& instr);
void visitAddInstr(AddInstr& instr);
void visitIntAddInstr(IntAddInstr& instr);
void visitDoubleAddInstr(DoubleAddInstr& instr);
void visitStrAddInstr(StrAddInstr& instr);
void visitSubInstr(SubInstr& instr);
void visitIntSubInstr(IntSubInstr& instr);
void visitDoubleSubInstr(DoubleSubInstr& instr);
void visitMulInstr(MulInstr& instr);
void visitIntMulInstr(IntMulInstr& instr);
void visitDoubleMulInstr(DoubleMulInstr& instr);
void visitDivInstr(DivInstr& instr);
void visitNotInstr(NotInstr& instr);
void visitCmpEqInstr(CmpEqInstr& instr);
void visitIntCmpEqInstr(IntCmpEqInstr& instr);
void visitDoubleCmpEqInstr(DoubleCmpEqInstr& instr);
void visitCmpIneqInstr(CmpIneqInstr& instr);
void visitIntCmpIneqInstr(IntCmpIneqInstr& instr);
void visitDoubleCmpIneqInstr(DoubleCmpIneqInstr& instr);
void visitCmpGtInstr(CmpGtInstr& instr);
void visitIntCmpGtInstr(IntCmpGtInstr& instr);
void visitDoubleCmpGtInstr(DoubleCmpGtInstr& instr);
void visitCmpGteInstr(CmpGteInstr& instr);
void visitIntCmpGteInstr(IntCmpGteInstr& instr);
void visitDoubleCmpGteInstr(DoubleCmpGteInstr& instr);
void visitCmpLtInstr(CmpLtInstr& instr);
void visitIntCmpLtInstr(IntCmpLtInstr& instr);
void visitDoubleCmpLtInstr(DoubleCmpLtInstr& instr);
void visitCmpLteInstr(CmpLteInstr& instr);
void visitIntCmpLteInstr(IntCmpLteInstr& instr);
void visitDoubleCmpLteInstr(DoubleCmpLteInstr& instr);
void visitDynamicAccessInstr(DynamicAccessInstr& instr);
void visitDynamicStoreInstr(DynamicStoreInstr& instr);
void visitListAccessInstr(ListAccessInstr& instr);
void visitListStoreInstr(ListStoreInstr& instr);
void visitListInitInstr(ListInitInstr& instr);
void visitDynamicObjectAccessInstr(DynamicObjectAccessInstr& instr);
void visitDynamicObjectStoreInstr(DynamicObjectStoreInstr& instr);
void visitObjectAccessInstr(ObjectAccessInstr& instr);
void visitObjectStoreInstr(ObjectStoreInstr& instr);
void visitErrInstr(ErrInstr& instr);
void visitRetInstr(RetInstr& instr);
void visitJmpCcInstr(JmpCcInstr& instr);
void typecheckInput(Instruction& instr, VaivenStaticType expectedType, int input);
void visitBinIntInstruction(Instruction& instr);
void visitBinDoubleInstruction(Instruction& instr);
void emit(Instruction* instr);
void box(Instruction** input, Instruction* instr);
};
}}
#endif
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/iam/IAM_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/iam/model/AccessKeyLastUsed.h>
#include <aws/iam/model/ResponseMetadata.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Xml
{
class XmlDocument;
} // namespace Xml
} // namespace Utils
namespace IAM
{
namespace Model
{
/**
* <p>Contains the response to a successful <a>GetAccessKeyLastUsed</a> request. It
* is also returned as a member of the <a>AccessKeyMetaData</a> structure returned
* by the <a>ListAccessKeys</a> action.</p><p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetAccessKeyLastUsedResponse">AWS
* API Reference</a></p>
*/
class AWS_IAM_API GetAccessKeyLastUsedResult
{
public:
GetAccessKeyLastUsedResult();
GetAccessKeyLastUsedResult(const Aws::AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result);
GetAccessKeyLastUsedResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result);
/**
* <p>The name of the AWS IAM user that owns this access key.</p> <p/>
*/
inline const Aws::String& GetUserName() const{ return m_userName; }
/**
* <p>The name of the AWS IAM user that owns this access key.</p> <p/>
*/
inline void SetUserName(const Aws::String& value) { m_userName = value; }
/**
* <p>The name of the AWS IAM user that owns this access key.</p> <p/>
*/
inline void SetUserName(Aws::String&& value) { m_userName = std::move(value); }
/**
* <p>The name of the AWS IAM user that owns this access key.</p> <p/>
*/
inline void SetUserName(const char* value) { m_userName.assign(value); }
/**
* <p>The name of the AWS IAM user that owns this access key.</p> <p/>
*/
inline GetAccessKeyLastUsedResult& WithUserName(const Aws::String& value) { SetUserName(value); return *this;}
/**
* <p>The name of the AWS IAM user that owns this access key.</p> <p/>
*/
inline GetAccessKeyLastUsedResult& WithUserName(Aws::String&& value) { SetUserName(std::move(value)); return *this;}
/**
* <p>The name of the AWS IAM user that owns this access key.</p> <p/>
*/
inline GetAccessKeyLastUsedResult& WithUserName(const char* value) { SetUserName(value); return *this;}
/**
* <p>Contains information about the last time the access key was used.</p>
*/
inline const AccessKeyLastUsed& GetAccessKeyLastUsed() const{ return m_accessKeyLastUsed; }
/**
* <p>Contains information about the last time the access key was used.</p>
*/
inline void SetAccessKeyLastUsed(const AccessKeyLastUsed& value) { m_accessKeyLastUsed = value; }
/**
* <p>Contains information about the last time the access key was used.</p>
*/
inline void SetAccessKeyLastUsed(AccessKeyLastUsed&& value) { m_accessKeyLastUsed = std::move(value); }
/**
* <p>Contains information about the last time the access key was used.</p>
*/
inline GetAccessKeyLastUsedResult& WithAccessKeyLastUsed(const AccessKeyLastUsed& value) { SetAccessKeyLastUsed(value); return *this;}
/**
* <p>Contains information about the last time the access key was used.</p>
*/
inline GetAccessKeyLastUsedResult& WithAccessKeyLastUsed(AccessKeyLastUsed&& value) { SetAccessKeyLastUsed(std::move(value)); return *this;}
inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; }
inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; }
inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); }
inline GetAccessKeyLastUsedResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;}
inline GetAccessKeyLastUsedResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;}
private:
Aws::String m_userName;
AccessKeyLastUsed m_accessKeyLastUsed;
ResponseMetadata m_responseMetadata;
};
} // namespace Model
} // namespace IAM
} // namespace Aws
|
//
// AppDelegate.h
// TV_Program
//
// Created by BigKing on 2017/6/6.
// Copyright © 2017年 BigKing. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "map_listener.h"
#include "map_source.h"
#include "mapping_monitor.h"
#include "named_service.h"
#include "proxy_map_source.h"
#include "request_completion_handler.h"
#include "service_map_history.h"
#include "service_mapping.h"
#include <vespa/fnet/task.h>
#include <vector>
#include <memory>
#include <map>
namespace slobrok {
/**
* @class LocalRpcMonitorMap
* @brief A collection of ManagedRpcServer objects
*
* Tracks up/down status for name->spec combinations
* that are considered for publication locally.
**/
class LocalRpcMonitorMap : public MapListener,
public MappingMonitorOwner
{
private:
enum class EventType { ADD, REMOVE };
struct Event {
EventType type;
ServiceMapping mapping;
static Event add(const ServiceMapping &value) {
return Event{EventType::ADD, value};
}
static Event remove(const ServiceMapping &value) {
return Event{EventType::REMOVE, value};
}
};
class DelayedTasks : public FNET_Task {
std::vector<Event> _queue;
LocalRpcMonitorMap &_target;
public:
void handleLater(Event event) {
_queue.emplace_back(std::move(event));
ScheduleNow();
}
void PerformTask() override;
DelayedTasks(FNET_Scheduler *scheduler, LocalRpcMonitorMap &target)
: FNET_Task(scheduler),
_queue(),
_target(target)
{}
~DelayedTasks() { Kill(); }
};
DelayedTasks _delayedTasks;
struct PerService {
bool up;
bool localOnly;
std::unique_ptr<CompletionHandler> inflight;
vespalib::string spec;
};
PerService localService(const ServiceMapping &mapping,
std::unique_ptr<CompletionHandler> inflight)
{
return PerService{
.up = false,
.localOnly = true,
.inflight = std::move(inflight),
.spec = mapping.spec
};
}
PerService globalService(const ServiceMapping &mapping) {
return PerService{
.up = false,
.localOnly = false,
.inflight = {},
.spec = mapping.spec
};
}
using Map = std::map<vespalib::string, PerService>;
Map _map;
ProxyMapSource _dispatcher;
ServiceMapHistory _history;
MappingMonitor::UP _mappingMonitor;
std::unique_ptr<MapSubscription> _subscription;
void doAdd(const ServiceMapping &mapping);
void doRemove(const ServiceMapping &mapping);
PerService & lookup(const ServiceMapping &mapping);
void addToMap(const ServiceMapping &mapping, PerService psd, bool hurry);
struct RemovedData {
ServiceMapping mapping;
bool up;
bool localOnly;
std::unique_ptr<CompletionHandler> inflight;
};
RemovedData removeFromMap(Map::iterator iter);
public:
LocalRpcMonitorMap(FNET_Scheduler *scheduler,
MappingMonitorFactory mappingMonitorFactory);
~LocalRpcMonitorMap();
MapSource &dispatcher() { return _dispatcher; }
ServiceMapHistory & history();
bool wouldConflict(const ServiceMapping &mapping) const;
/** for use by register API, will call doneHandler() on inflight script */
void addLocal(const ServiceMapping &mapping,
std::unique_ptr<CompletionHandler> inflight);
/** for use by unregister API */
void removeLocal(const ServiceMapping &mapping);
void add(const ServiceMapping &mapping) override;
void remove(const ServiceMapping &mapping) override;
void up(const ServiceMapping& mapping) override;
void down(const ServiceMapping& mapping) override;
};
//-----------------------------------------------------------------------------
} // namespace slobrok
|
/*
* Copyright (c) 2022 OpenLuat & AirM2M
*
* 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.
*/
#include "user.h"
#define __IRQ_IN_RAM__
#ifdef __IRQ_IN_RAM__
#else
#define __FUNC_IN_RAM__
#endif
typedef struct {
void (*Irq_Handler)(int32_t IrqLine, void *pData);
void *pData;
}Irq_Handler_t;
static Irq_Handler_t Irq_Table[IRQ_LINE_MAX + 16 - IRQ_LINE_OFFSET];
static void ISR_DummyHandler(int32_t IrqLine, void *pData)
{
}
void __FUNC_IN_RAM__ ISR_GlobalHandler(void)
{
int IrqLine = ((SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) >> SCB_ICSR_VECTACTIVE_Pos) - IRQ_LINE_OFFSET;
if (IrqLine < 0 || IrqLine >= IRQ_LINE_MAX)
{
return;
}
rt_interrupt_enter();
if (Irq_Table[IrqLine].Irq_Handler)
{
Irq_Table[IrqLine].Irq_Handler(IrqLine + IRQ_LINE_OFFSET - 16, Irq_Table[IrqLine].pData);
}
rt_interrupt_leave();
}
void ISR_SetHandler(int32_t Irq, void *Handler, void *pData)
{
Irq_Table[Irq + 16 - IRQ_LINE_OFFSET].Irq_Handler = Handler;
Irq_Table[Irq + 16 - IRQ_LINE_OFFSET].pData = pData;
}
void ISR_SetPriority(int32_t Irq, uint32_t PriorityLevel)
{
NVIC_SetPriority(Irq, PriorityLevel);
}
void __FUNC_IN_RAM__ ISR_OnOff(int32_t Irq, uint32_t OnOff)
{
if (OnOff)
{
if (!Irq_Table[Irq + 16 - IRQ_LINE_OFFSET].Irq_Handler)
{
Irq_Table[Irq + 16 - IRQ_LINE_OFFSET].Irq_Handler = ISR_DummyHandler;
}
NVIC_EnableIRQ(Irq);
}
else
{
NVIC_DisableIRQ(Irq);
}
}
void __FUNC_IN_RAM__ ISR_Clear(int32_t Irq)
{
NVIC_ClearPendingIRQ(Irq);
}
uint32_t __FUNC_IN_RAM__ ISR_CheckIn(void)
{
return __get_IPSR();
}
|
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM ../../../dist/idl\nsIPermission.idl
*/
#ifndef __gen_nsIPermission_h__
#define __gen_nsIPermission_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIPermission */
#define NS_IPERMISSION_IID_STR "cfb08e46-193c-4be7-a467-d7775fb2a31e"
#define NS_IPERMISSION_IID \
{0xcfb08e46, 0x193c, 0x4be7, \
{ 0xa4, 0x67, 0xd7, 0x77, 0x5f, 0xb2, 0xa3, 0x1e }}
class NS_NO_VTABLE nsIPermission : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPERMISSION_IID)
/* readonly attribute AUTF8String host; */
NS_IMETHOD GetHost(nsACString & aHost) = 0;
/* readonly attribute unsigned long appId; */
NS_IMETHOD GetAppId(uint32_t *aAppId) = 0;
/* readonly attribute boolean isInBrowserElement; */
NS_IMETHOD GetIsInBrowserElement(bool *aIsInBrowserElement) = 0;
/* readonly attribute ACString type; */
NS_IMETHOD GetType(nsACString & aType) = 0;
/* readonly attribute uint32_t capability; */
NS_IMETHOD GetCapability(uint32_t *aCapability) = 0;
/* readonly attribute uint32_t expireType; */
NS_IMETHOD GetExpireType(uint32_t *aExpireType) = 0;
/* readonly attribute int64_t expireTime; */
NS_IMETHOD GetExpireTime(int64_t *aExpireTime) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIPermission, NS_IPERMISSION_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIPERMISSION \
NS_IMETHOD GetHost(nsACString & aHost) override; \
NS_IMETHOD GetAppId(uint32_t *aAppId) override; \
NS_IMETHOD GetIsInBrowserElement(bool *aIsInBrowserElement) override; \
NS_IMETHOD GetType(nsACString & aType) override; \
NS_IMETHOD GetCapability(uint32_t *aCapability) override; \
NS_IMETHOD GetExpireType(uint32_t *aExpireType) override; \
NS_IMETHOD GetExpireTime(int64_t *aExpireTime) override;
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIPERMISSION(_to) \
NS_IMETHOD GetHost(nsACString & aHost) override { return _to GetHost(aHost); } \
NS_IMETHOD GetAppId(uint32_t *aAppId) override { return _to GetAppId(aAppId); } \
NS_IMETHOD GetIsInBrowserElement(bool *aIsInBrowserElement) override { return _to GetIsInBrowserElement(aIsInBrowserElement); } \
NS_IMETHOD GetType(nsACString & aType) override { return _to GetType(aType); } \
NS_IMETHOD GetCapability(uint32_t *aCapability) override { return _to GetCapability(aCapability); } \
NS_IMETHOD GetExpireType(uint32_t *aExpireType) override { return _to GetExpireType(aExpireType); } \
NS_IMETHOD GetExpireTime(int64_t *aExpireTime) override { return _to GetExpireTime(aExpireTime); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIPERMISSION(_to) \
NS_IMETHOD GetHost(nsACString & aHost) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetHost(aHost); } \
NS_IMETHOD GetAppId(uint32_t *aAppId) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetAppId(aAppId); } \
NS_IMETHOD GetIsInBrowserElement(bool *aIsInBrowserElement) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetIsInBrowserElement(aIsInBrowserElement); } \
NS_IMETHOD GetType(nsACString & aType) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetType(aType); } \
NS_IMETHOD GetCapability(uint32_t *aCapability) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCapability(aCapability); } \
NS_IMETHOD GetExpireType(uint32_t *aExpireType) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetExpireType(aExpireType); } \
NS_IMETHOD GetExpireTime(int64_t *aExpireTime) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetExpireTime(aExpireTime); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsPermission : public nsIPermission
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIPERMISSION
nsPermission();
private:
~nsPermission();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS(nsPermission, nsIPermission)
nsPermission::nsPermission()
{
/* member initializers and constructor code */
}
nsPermission::~nsPermission()
{
/* destructor code */
}
/* readonly attribute AUTF8String host; */
NS_IMETHODIMP nsPermission::GetHost(nsACString & aHost)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute unsigned long appId; */
NS_IMETHODIMP nsPermission::GetAppId(uint32_t *aAppId)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute boolean isInBrowserElement; */
NS_IMETHODIMP nsPermission::GetIsInBrowserElement(bool *aIsInBrowserElement)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute ACString type; */
NS_IMETHODIMP nsPermission::GetType(nsACString & aType)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute uint32_t capability; */
NS_IMETHODIMP nsPermission::GetCapability(uint32_t *aCapability)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute uint32_t expireType; */
NS_IMETHODIMP nsPermission::GetExpireType(uint32_t *aExpireType)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute int64_t expireTime; */
NS_IMETHODIMP nsPermission::GetExpireTime(int64_t *aExpireTime)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIPermission_h__ */
|
// This header file is deprecated in 3ds Max 2011.
// Please use header file listed below.
#include "..\maxscript\macros\define_abstract_functions.h"
|
#include <fstream>
#include "envoy/api/v2/eds.pb.h"
#include "common/config/filesystem_subscription_impl.h"
#include "common/config/utility.h"
#include "common/event/dispatcher_impl.h"
#include "test/common/config/subscription_test_harness.h"
#include "test/mocks/config/mocks.h"
#include "test/test_common/environment.h"
#include "test/test_common/utility.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
using testing::NiceMock;
using testing::Return;
using testing::_;
namespace Envoy {
namespace Config {
typedef FilesystemSubscriptionImpl<envoy::api::v2::ClusterLoadAssignment>
FilesystemEdsSubscriptionImpl;
class FilesystemSubscriptionTestHarness : public SubscriptionTestHarness {
public:
FilesystemSubscriptionTestHarness()
: path_(TestEnvironment::temporaryPath("eds.json")),
subscription_(dispatcher_, path_, stats_) {}
~FilesystemSubscriptionTestHarness() { EXPECT_EQ(0, ::unlink(path_.c_str())); }
void startSubscription(const std::vector<std::string>& cluster_names) override {
std::ifstream config_file(path_);
file_at_start_ = config_file.good();
subscription_.start(cluster_names, callbacks_);
}
void updateResources(const std::vector<std::string>& cluster_names) override {
subscription_.updateResources(cluster_names);
}
void updateFile(const std::string json, bool run_dispatcher = true) {
// Write JSON contents to file, rename to path_ and run dispatcher to catch
// inotify.
const std::string temp_path = TestEnvironment::writeStringToFileForTest("eds.json.tmp", json);
EXPECT_EQ(0, ::rename(temp_path.c_str(), path_.c_str()));
if (run_dispatcher) {
dispatcher_.run(Event::Dispatcher::RunType::NonBlock);
}
}
void expectSendMessage(const std::vector<std::string>& cluster_names,
const std::string& version) override {
UNREFERENCED_PARAMETER(cluster_names);
UNREFERENCED_PARAMETER(version);
}
void deliverConfigUpdate(const std::vector<std::string>& cluster_names,
const std::string& version, bool accept) override {
std::string file_json = "{\"versionInfo\":\"" + version + "\",\"resources\":[";
for (const auto& cluster : cluster_names) {
file_json += "{\"@type\":\"type.googleapis.com/"
"envoy.api.v2.ClusterLoadAssignment\",\"clusterName\":\"" +
cluster + "\"},";
}
file_json.pop_back();
file_json += "]}";
envoy::api::v2::DiscoveryResponse response_pb;
EXPECT_TRUE(Protobuf::util::JsonStringToMessage(file_json, &response_pb).ok());
EXPECT_CALL(callbacks_,
onConfigUpdate(
RepeatedProtoEq(
Config::Utility::getTypedResources<envoy::api::v2::ClusterLoadAssignment>(
response_pb)),
version))
.WillOnce(ThrowOnRejectedConfig(accept));
if (accept) {
version_ = version;
} else {
EXPECT_CALL(callbacks_, onConfigUpdateFailed(_));
}
updateFile(file_json);
}
void verifyStats(uint32_t attempt, uint32_t success, uint32_t rejected, uint32_t failure,
uint64_t version) override {
// The first attempt always fail unless there was a file there to begin with.
SubscriptionTestHarness::verifyStats(attempt, success, rejected,
failure + (file_at_start_ ? 0 : 1), version);
}
const std::string path_;
std::string version_;
Event::DispatcherImpl dispatcher_;
NiceMock<Config::MockSubscriptionCallbacks<envoy::api::v2::ClusterLoadAssignment>> callbacks_;
FilesystemEdsSubscriptionImpl subscription_;
bool file_at_start_{false};
};
} // namespace Config
} // namespace Envoy
|
/* binner.h
Reads and bins data from OSKAR vis file.
Copyright (C) 2015 Braam Research, LLC.
*/
#include "o2a.h"
enum rerrors {
ro_ok = 0
, ro_cant_open_vis_file = -1
, ro_invalid_data = -2
, ro_cant_allocate_amp_mem = -3
, ro_cant_allocate_uvw_mem = -4
};
|
/*
* Copyright (c) 2015 Cisco and/or its affiliates.
* 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.
*/
#define DPDK_NB_RX_DESC_DEFAULT 1024
#define DPDK_NB_TX_DESC_DEFAULT 1024
#define DPDK_NB_RX_DESC_VIRTIO 256
#define DPDK_NB_TX_DESC_VIRTIO 256
#define I40E_DEV_ID_SFP_XL710 0x1572
#define I40E_DEV_ID_QSFP_A 0x1583
#define I40E_DEV_ID_QSFP_B 0x1584
#define I40E_DEV_ID_QSFP_C 0x1585
#define I40E_DEV_ID_10G_BASE_T 0x1586
#define I40E_DEV_ID_VF 0x154C
/* These args appear by themselves */
#define foreach_eal_double_hyphen_predicate_arg \
_(no-shconf) \
_(no-hpet) \
_(no-huge) \
_(vmware-tsc-map)
#define foreach_eal_single_hyphen_mandatory_arg \
_(coremask, c) \
_(nchannels, n) \
#define foreach_eal_single_hyphen_arg \
_(blacklist, b) \
_(mem-alloc-request, m) \
_(force-ranks, r)
/* These args are preceded by "--" and followed by a single string */
#define foreach_eal_double_hyphen_arg \
_(huge-dir) \
_(proc-type) \
_(file-prefix) \
_(vdev) \
_(log-level)
static inline void
dpdk_get_xstats (dpdk_device_t * xd)
{
int len, ret;
if (!(xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP))
return;
len = rte_eth_xstats_get (xd->port_id, NULL, 0);
if (len < 0)
return;
vec_validate (xd->xstats, len - 1);
ret = rte_eth_xstats_get (xd->port_id, xd->xstats, len);
if (ret < 0 || ret > len)
{
_vec_len (xd->xstats) = 0;
return;
}
_vec_len (xd->xstats) = len;
}
static inline void
dpdk_update_counters (dpdk_device_t * xd, f64 now)
{
vlib_simple_counter_main_t *cm;
vnet_main_t *vnm = vnet_get_main ();
u32 thread_index = vlib_get_thread_index ();
u64 rxerrors, last_rxerrors;
/* only update counters for PMD interfaces */
if ((xd->flags & DPDK_DEVICE_FLAG_PMD) == 0)
return;
xd->time_last_stats_update = now ? now : xd->time_last_stats_update;
clib_memcpy_fast (&xd->last_stats, &xd->stats, sizeof (xd->last_stats));
rte_eth_stats_get (xd->port_id, &xd->stats);
/* maybe bump interface rx no buffer counter */
if (PREDICT_FALSE (xd->stats.rx_nombuf != xd->last_stats.rx_nombuf))
{
cm = vec_elt_at_index (vnm->interface_main.sw_if_counters,
VNET_INTERFACE_COUNTER_RX_NO_BUF);
vlib_increment_simple_counter (cm, thread_index, xd->sw_if_index,
xd->stats.rx_nombuf -
xd->last_stats.rx_nombuf);
}
/* missed pkt counter */
if (PREDICT_FALSE (xd->stats.imissed != xd->last_stats.imissed))
{
cm = vec_elt_at_index (vnm->interface_main.sw_if_counters,
VNET_INTERFACE_COUNTER_RX_MISS);
vlib_increment_simple_counter (cm, thread_index, xd->sw_if_index,
xd->stats.imissed -
xd->last_stats.imissed);
}
rxerrors = xd->stats.ierrors;
last_rxerrors = xd->last_stats.ierrors;
if (PREDICT_FALSE (rxerrors != last_rxerrors))
{
cm = vec_elt_at_index (vnm->interface_main.sw_if_counters,
VNET_INTERFACE_COUNTER_RX_ERROR);
vlib_increment_simple_counter (cm, thread_index, xd->sw_if_index,
rxerrors - last_rxerrors);
}
dpdk_get_xstats (xd);
}
/*
* fd.io coding-style-patch-verification: ON
*
* Local Variables:
* eval: (c-set-style "gnu")
* End:
*/
|
/*
////////////////////////////////////////////////////////////////////////////////////
//
// Prototypes and definitions for the Levenberg - Marquardt minimization algorithm
// Copyright (C) 2004 Manolis Lourakis (lourakis at ics forth gr)
// Institute of Computer Science, Foundation for Research & Technology - Hellas
// Heraklion, Crete, Greece.
//
// Modifications Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at the Lawrence Livermore National Laboratory. Written by Ted Laurence (laurence2@llnl.gov)
// LLNL-CODE-424602 All rights reserved.
// This file is part of dlevmar_mle_der
//
// Please also read Our Notice and GNU General Public License.
//
// 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.
//
////////////////////////////////////////////////////////////////////////////////////
*/
#include <float.h>
#ifndef _LEVMAR_H_
#define _LEVMAR_H_
#ifdef __cplusplus
extern "C" {
#endif
#define FABS(x) (((x)>=0.0)? (x) : -(x))
/* work arrays size for ?levmar_der and ?levmar_dif functions.
* should be multiplied by sizeof(double) or sizeof(float) to be converted to bytes
*/
#define LM_MLE_WORKSZ(npar, nmeas) (3*(nmeas) + 4*(npar) + (nmeas)*(npar) + 2*(npar)*(npar))
#define LM_OPTS_SZ 5
#define LM_INFO_SZ 10
#define LM_ERROR -1
#define LM_INIT_MU 1E-03
#define LM_STOP_THRESH 1E-20
#define LM_DIFF_DELTA 1E-20
#define LM_VERSION "2.5 (December 2009)"
#define LM_CHISQ_MLE 0
#define LM_CHISQ_NEYMAN 1
#define LM_CHISQ_EQUAL_WT 2
/* double precision LM, with Jacobian */
/* unconstrained minimization */
extern int dlevmar_mle_der(
void (*func)(double *p, double *hx, int m, int n, void *adata),
void (*jacf)(double *p, double *j, int m, int n, void *adata),
double *p, double *x, int m, int n, int itmax, double *opts,
double *info, double *work, double *covar, void *adata, int fitType);
extern double compute_chisq_measure(double *e, double *x, double *hx, int n, int fitType);
#ifdef __cplusplus
}
#endif
#endif /* _LEVMAR_H_ */
|
/**
*
* Copyright 2015 Rishat Shamsutdinov
*
* 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.
*
*/
#import <Foundation/Foundation.h>
@interface NSMutableArray (FoundationUtils)
- (void)rs_removeObjectsPassingTest:(BOOL (^)(id obj, NSUInteger idx, BOOL *stop))predicate;
- (void)rs_insertObjects:(NSArray *)objects atIndex:(NSUInteger)index;
@end
|
//
// OYFollowItem.h
// BaiSiBuDeJie
//
// Created by 江南布衣 on 16/6/23.
// Copyright © 2016年 江南布衣. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface OYFollowItem : NSObject
@property (nonatomic, copy) NSString *theme_name;
@property (nonatomic, copy) NSString *image_list;
@property (nonatomic, copy) NSString *sub_number;
@end
|
/*
Copyright 2015 Google Inc. 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.
*/
#include "libcm/cm.h"
#include <stdlib.h>
#include <string.h>
static void *cm_c_realloc_loc(cm_handle *cm, void *ptr, size_t size,
char const *file, int line) {
if (size > 0)
return ptr ? realloc(ptr, size) : malloc(size);
else if (ptr)
free(ptr);
return NULL;
}
#if __APPLE__
#include <malloc/malloc.h>
#define CM_PEEK_MEM_SIZE(ptr) malloc_size(ptr)
#elif __linux__
#include <malloc.h>
#define CM_PEEK_MEM_SIZE(ptr) malloc_usable_size(ptr)
#else
#define CM_PEEK_MEM_SIZE(ptr) (0)
#endif
static size_t cm_c_fragment_size(cm_handle *cm, void *ptr) {
return CM_PEEK_MEM_SIZE(ptr);
}
static void cm_c_runtime_statistics_get(cm_handle *cm,
cm_runtime_statistics *cmrts) {
/* this allocator couldn't care less about stats */
memset(cmrts, 0, sizeof(*cmrts));
}
static const cm_handle mem_c = {cm_c_realloc_loc, cm_c_fragment_size,
cm_c_runtime_statistics_get};
cm_handle *cm_c(void) { return (cm_handle *)&mem_c; }
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/opensearch/OpenSearchService_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace OpenSearchService
{
namespace Model
{
enum class UpgradeStatus
{
NOT_SET,
IN_PROGRESS,
SUCCEEDED,
SUCCEEDED_WITH_ISSUES,
FAILED
};
namespace UpgradeStatusMapper
{
AWS_OPENSEARCHSERVICE_API UpgradeStatus GetUpgradeStatusForName(const Aws::String& name);
AWS_OPENSEARCHSERVICE_API Aws::String GetNameForUpgradeStatus(UpgradeStatus value);
} // namespace UpgradeStatusMapper
} // namespace Model
} // namespace OpenSearchService
} // namespace Aws
|
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* 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.txt
*
* 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 itkWatershedEquivalenceRelabeler_h
#define itkWatershedEquivalenceRelabeler_h
#include "itkWatershedSegmenter.h"
namespace itk
{
namespace watershed
{
/** \class EquivalenceRelabeler
*
* This class is part of the set of watershed segmentation component objects.
* It is an image-to-image filter that relabels its input according to a set of
* equivalencies defined in a table. The filter is used in
* itk::WatershedImageFilter, for example, to relabel a segmented image
* at different hierarchies in the merge tree (see itk::WatershedImageFilter
* for documentation on terminology). It simply takes its input and changes
* any values found in the equivalency table.
*
* \par Inputs
* There are two inputs to this filter, an IdentifierType itk::Image of
* arbitrary dimension, and an itk::EquivalencyTable. The input
* image is the image to be relabeled and copied to the output, and the
* EquivalencyTable identifies how to relabel the values.
*
* \par Output
* The output of this filter is the relabeled IdentifierType itk::Image of same
* dimension and size as the input.
*
* \ingroup WatershedSegmentation
* \sa itk::WatershedImageFilter
* \sa EquivalencyTable
* \ingroup ITKWatersheds
*/
template< typename TScalar, unsigned int TImageDimension >
class ITK_TEMPLATE_EXPORT EquivalenceRelabeler:
public ProcessObject
{
public:
/** Expose templated image dimension parameter at run time */
itkStaticConstMacro(ImageDimension, unsigned int, TImageDimension);
/** Some convenient typedefs. */
typedef Image< IdentifierType, TImageDimension > ImageType;
typedef EquivalenceRelabeler Self;
typedef ProcessObject Superclass;
typedef TScalar ScalarType;
typedef EquivalencyTable EquivalencyTableType;
typedef Segmenter< Image< ScalarType, TImageDimension > > SegmenterType;
typedef DataObject::Pointer DataObjectPointer;
/** Define smart pointers for this object. */
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
itkNewMacro(Self);
itkTypeMacro(WatershedEquivalenceRelabeler, ProcessObject);
/** Set/Get the image to relabel. */
void SetInputImage(ImageType *img)
{ this->ProcessObject::SetNthInput(0, img); }
const ImageType * GetInputImage(void)
{
return static_cast< ImageType * >
( this->ProcessObject::GetInput(0) );
}
/** Set/Get the output image */
void SetOutputImage(ImageType *img)
{
this->ProcessObject::SetNthOutput(0, img);
}
typename ImageType::Pointer GetOutputImage()
{
return static_cast< ImageType * >
( this->ProcessObject::GetOutput(0) );
}
/** Set/Get the table to use in relabeling the input image. */
void SetEquivalencyTable(EquivalencyTableType *et)
{
this->ProcessObject::SetNthInput(1, et);
}
EquivalencyTableType::Pointer GetEquivalencyTable()
{
return static_cast< EquivalencyTableType * >
( this->ProcessObject::GetInput(1) );
}
/** Standard non-threaded pipeline method */
virtual void GenerateData() ITK_OVERRIDE;
/** Standard itk::ProcessObject subclass method. */
typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
using Superclass::MakeOutput;
virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE;
protected:
EquivalenceRelabeler()
{
typename ImageType::Pointer img =
static_cast< ImageType * >( this->MakeOutput(0).GetPointer() );
this->SetNumberOfRequiredOutputs(1);
this->ProcessObject::SetNthOutput( 0, img.GetPointer() );
}
virtual ~EquivalenceRelabeler() {}
EquivalenceRelabeler(const Self &) {}
void operator=(const Self &) {}
virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
virtual void GenerateOutputRequestedRegion(DataObject *output) ITK_OVERRIDE;
virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
};
} // end namespace watershed
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkWatershedEquivalenceRelabeler.hxx"
#endif
#endif
|
/*
* MUSCLE SmartCard Development ( https://pcsclite.apdu.fr/ )
*
* Copyright (C) 2001
* David Corcoran <corcoran@musclecard.com>
* Copyright (C) 2002-2010
* Ludovic Rousseau <ludovic.rousseau@free.fr>
*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
*/
/*
* @file
* @brief This abstracts dynamic library loading functions and timing.
*/
#include "config.h"
#include <string.h>
#ifdef HAVE_DL_H
#include <dl.h>
#include <errno.h>
#include "pcsclite.h"
#include "debuglog.h"
#include "dyn_generic.h"
LONG DYN_LoadLibrary(void **pvLHandle, char *pcLibrary)
{
shl_t myHandle;
*pvLHandle = 0;
myHandle =
shl_load(pcLibrary, BIND_IMMEDIATE | BIND_VERBOSE | BIND_NOSTART,
0L);
if (myHandle == 0)
{
Log3(PCSC_LOG_ERROR, "%s: %s", pcLibrary, strerror(errno));
return SCARD_F_UNKNOWN_ERROR;
}
*pvLHandle = (void *) myHandle;
return SCARD_S_SUCCESS;
}
LONG DYN_CloseLibrary(void **pvLHandle)
{
int rv;
rv = shl_unload((shl_t) * pvLHandle);
*pvLHandle = 0;
if (rv == -1)
{
Log2(PCSC_LOG_ERROR, "%s", strerror(errno));
return SCARD_F_UNKNOWN_ERROR;
}
return SCARD_S_SUCCESS;
}
LONG DYN_GetAddress(void *pvLHandle, void **pvFHandle, const char *pcFunction,
int mayfail)
{
int rv;
*pvFHandle = 0;
rv = shl_findsym((shl_t *) & pvLHandle, pcFunction, TYPE_PROCEDURE,
pvFHandle);
if (rv == -1)
{
Log3(mayfail ? PCSC_LOG_INFO : PCSC_LOG_ERROR, "%s: %s",
pcFunction, strerror(errno));
rv = SCARD_F_UNKNOWN_ERROR;
}
else
rv = SCARD_S_SUCCESS;
return rv;
}
#endif /* HAVE_DL_H */
|
#pragma once
#include <Windows.h>
#include <string>
#include <vector>
#include <iostream>
#include <locale>
#include <sstream>
std::string int_to_str(int num, bool is_hex = false);
std::string uint_to_str(unsigned int num, bool is_hex = false);
std::string char_to_str(char c);
int str_to_int(std::string str);
unsigned int str_to_uint(std::string str);
std::wstring str_to_wstr(std::string s);
std::string wstr_to_str(std::wstring ws);
BSTR wstr_to_bstr(std::wstring ws);
BSTR str_to_bstr(std::string s);
std::wstring bstr_to_wstr(BSTR bs);
std::string bstr_to_str(BSTR bs);
std::string LPVOID_to_str(LPVOID data, int len);
LPWSTR str_to_LPWSTR(std::string s);
std::string LPWSTR_to_str(LPWSTR wc, UINT size);
std::string wastr_to_str(wchar_t *wc, UINT size);
std::string FormatWithCommas(unsigned int num);
std::vector<std::vector<std::string>> split_vec(const std::vector<std::string>& vec, const std::string& delimiter);
std::vector<std::string> split_str(std::string str, const std::string& delimiter, int minlen = -1);
std::string error_code_to_text(DWORD error_code);
void SHOW_CONSOLE(bool show = true, bool noclose = false);
std::string getwindowclassname(HWND hwnd);
std::string getwindowtext(HWND wnd);
RECT getwindowrect(HWND wnd);
RECT getclientrect(HWND wnd);
RECT getmappedclientrect(HWND wndFrom, HWND wndTo = NULL);
void displayrect(RECT& rc);
POINT getclientcursorpos(HWND hwnd_parent);
POINT getcursorpos();
bool is_cursor_in_region(RECT region, POINT cursor_pos);
void GetFilesInDirectory(const std::string &directory, const std::string &filetype, std::vector<std::string> *out);
std::string getexepath();
std::string getexepath(HWND hwnd);
std::string getexedir();
DWORD createfolder(std::string path);
std::string browseforfile(HWND parent, bool open = true, LPCWSTR title = L"Browse for file", LPCWSTR filter = L"All\0*.*\0");
std::string milliseconds_to_hms(int milliseconds);
void ssystem(std::string command, bool pause = true);
|
// Copyright 2017 Benjamin Glatzel
//
// 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.
#pragma once
class IntrinsicEdNotificationBase : public QWidget
{
Q_OBJECT
public:
IntrinsicEdNotificationBase(QWidget* p_Parent, float p_TimeToLive);
~IntrinsicEdNotificationBase();
protected slots:
void onTick();
protected:
void positionOnScreen();
QTimer* _timer;
float _timeAliveInSeconds;
float _timeToLive;
};
|
/*******************************************ÉêÃ÷***************************************
±¾Ç¶Èëʽ²Ù×÷ϵͳδ¾ÊÚȨ£¬½ûÖ¹Ó¦ÓÃÓÚÈκÎÉÌÒµÓÃ;
°æÈ¨ËùÓУ¬ÇÖȨ±Ø¾¿
http://www.trtos.com/
**************************************************************************************/
#include <..\USER\Prj_TP502T\DS18B20_Driver.h>
uint16 DS1_PIN=GPIO_Pin_9;
GPIO_TypeDef *DS1_GROUP=GPIOB;
void DS_SetPort(GPIO_TypeDef *DS1_Group,uint16 DS1_Port)
{
DS1_GROUP=DS1_Group;
DS1_PIN=DS1_Port
}
void DS_DelayUs(uint16 D)
{
uint16 i=0;
while(D--)
{
i=7;//5~8¶¼¿ÉÒÔ
while(i--);
}
}
void DS_DelayMs(uint16 n)
{
uint16 i=0;
while(n--)
{
i=12000;
while(i--);
}
}
void DS_PortIN(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = DS1_PIN ;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; //¸¡¶¯ÊäÈë
GPIO_Init(DS1_GROUP,&GPIO_InitStructure);
}
void DS_PortOUT(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = DS1_PIN ;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //ÍÆÍìÊä³ö
GPIO_Init(DS1_GROUP,&GPIO_InitStructure);
}
void DS_Rst(void)
{
DS_PortOUT(); //SET PA0 OUTPUT
GPIO_ResetBits(DS1_GROUP,DS1_PIN);
DS_DelayUs(750); //ÀµÍ750us
GPIO_SetBits(DS1_GROUP,DS1_PIN);
DS_DelayUs(15); //15US
}
u8 DS_Check(void)
{
u8 retry=0;
DS_PortIN();//SET PA0 INPUT
while (GPIO_ReadInputDataBit(DS1_GROUP,DS1_PIN)&&retry</*200*/200)
{
retry++;
DS_DelayUs(1);
};
if(retry>=200)return 1;
else retry=0;
while (!GPIO_ReadInputDataBit(DS1_GROUP,DS1_PIN)&&retry<240)
{
retry++;
DS_DelayUs(1);
};
if(retry>=240)return 1;
return 0;
}
u8 DS_Read_Bit(void) // read one bit
{
u8 data;
DS_PortOUT();
GPIO_ResetBits(DS1_GROUP,DS1_PIN);
DS_DelayUs(2);
GPIO_SetBits(DS1_GROUP,DS1_PIN);
DS_PortIN();
DS_DelayUs(12);
if(GPIO_ReadInputDataBit(DS1_GROUP,DS1_PIN))data=1;
else data=0;
DS_DelayUs(50);
return data;
}
u8 DS_Read_Byte(void) // read one byte
{
u8 i,j,dat;
dat=0;
DIS_INT//Âé±Ô¡£¹ØÎÒÖжϲſÉÒÔ£¬ÒÔºó²»»áÓÃÄãÁË
for (i=1;i<=8;i++)
{
j=DS_Read_Bit();
dat=(j<<7)|(dat>>1);
}
EN_INT
return dat;
}
void DS_Write_Byte(u8 dat)
{
u8 j;
u8 testb;
DS_PortOUT();//SET PA0 OUTPUT;
for (j=1;j<=8;j++)
{
testb=dat&0x01;
dat=dat>>1;
if (testb)
{
GPIO_ResetBits(DS1_GROUP,DS1_PIN);
DS_DelayUs(2);
GPIO_SetBits(DS1_GROUP,DS1_PIN);
DS_DelayUs(60);
}
else
{
GPIO_ResetBits(DS1_GROUP,DS1_PIN);
DS_DelayUs(60);
GPIO_SetBits(DS1_GROUP,DS1_PIN);
DS_DelayUs(2);
}
}
}
//¿ªÊ¼Î¶Èת»»
void DS_Start(void)// ds1820 start convert
{
DS_Rst();
DS_Check();
DS_Write_Byte(0xcc);// skip rom
DS_Write_Byte(0x44);// convert
}
u8 DS18B20_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); //ʹÄÜPORTG¿ÚʱÖÓ
GPIO_InitStructure.GPIO_Pin = DS1_PIN; //PORTG.11 ÍÆÍìÊä³ö
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(DS1_GROUP, &GPIO_InitStructure);
GPIO_SetBits(DS1_GROUP,DS1_PIN); //Êä³ö1
DS_Rst();
return DS_Check();
}
uint8 DS_Get_Temp(float *TP)
{
uint8 c,Buf[9];
float T;
uint16 Temp;
DS_Start (); // ds1820 start convert
DS_Rst();
c=DS_Check();
if(c)return 1;
DS_Write_Byte(0xcc);// skip rom
DS_Write_Byte(0xbe);// convert
for(c=0;c<9;c++)
{
Buf[c]=DS_Read_Byte();
}
c=Tools_GetCRC8(&Buf[0],8);
if(c!=Buf[8])return 1;//УÑ鲻ͨ¹ý
if(Buf[1]>7)
{
Buf[1]=~Buf[1];
Buf[0]=~Buf[0];
Temp=Buf[1];Temp<<=8;Temp|=Buf[0];
T=0-(float)Temp;
}else
{
Temp=Buf[1];Temp<<=8;Temp|=Buf[0];
T=(float)Temp;
}
T*=0.625;
*TP=T/10;
return 0;
}
u8 Sensor_Init(void)
{
uint8 Ds18B20CHOK=0x00;
if(UIShowValue.SaveValue.WorkBit&WCB_DTH11)
{
DS1_PIN=GPIO_Pin_9;
DS1_GROUP=GPIOB;
if(!DHT11_Read(Null,Null))Ds18B20CHOK+=2;
}else
{
DS1_PIN=GPIO_Pin_9;
DS1_GROUP=GPIOB;
if(!DS18B20_Init())Ds18B20CHOK++;
DS1_PIN=GPIO_Pin_8;
DS1_GROUP=GPIOB;
if(!DS18B20_Init())Ds18B20CHOK++;
}
return Ds18B20CHOK;
}
//Æäʵ¿ÉÒÔʵÏÖµ¥Ïß»ìºÏ¶ÁÈ¡£¬µ«ÊÇ¿¼Âǵ½±È½ÏÀË·ÑCPU»¹ÊÇËãÁË
void DS_Read_Value(float *Ch1,float *Ch2)
{
uint8 u=0;
static uint8 Buf[2];
UIShowValue.RunFlag&=~(WRF_SensorCH1Connected|WRF_SensorCH2Connected);
if(UIShowValue.SaveValue.WorkBit&WCB_DTH11)
{
DHT11_PIN=GPIO_Pin_9;
DHT11_GROUP=GPIOB;
if(DHT11_Read(Ch1,Ch2))
{
Buf[0]++;
if(Buf[0]>5)UIShowValue.RunFlag&=~(WRF_SensorCH1Connected|WRF_SensorCH2Connected);
}else {Buf[0]=0;UIShowValue.RunFlag|=(WRF_SensorCH1Connected|WRF_SensorCH2Connected);}
}
else
{
DS_SetPort(GPIOB,GPIO_Pin_9);
u=DS_Get_Temp(Ch1);
if(u)
{
Buf[0]++;
if(Buf[0]>5)
{
DS18B20_Init();
UIShowValue.RunFlag&=~WRF_SensorCH1Connected;
}
}else {Buf[0]=0;UIShowValue.RunFlag|=WRF_SensorCH1Connected;}
DS_SetPort(GPIOB,GPIO_Pin_8);
u=DS_Get_Temp(Ch2);
if(u)
{
Buf[1]++;
if(Buf[1]>5)
{
DS18B20_Init();
UIShowValue.RunFlag&=~WRF_SensorCH2Connected;
}
}else {Buf[1]=0;UIShowValue.RunFlag|=WRF_SensorCH2Connected;}
}
}
|
// logging.h
// Author: Allen Porter <allen@thebends.org>
//
// A library for Atmel AVR microcontrollers that logs arbitary data to a serial
// port. This can be useful for error logging or debugging. This library
// uses async writes with a small circular buffer, but may block momentarily
// if the buffer is small. The techniques used here are similar to most
// async USART examples, but packaged in a library. This library expects to
// be the only code using the serial port.
//
// Example usage:
//
// logging_init();
// lput_str("Starting...");
// ...
// lput_str("Value is: ");
// lputc_hex(value);
// lprint_str("\r\n");
#include <inttypes.h>
// Must be called to initialize the logging library prior to making any calls
// in this library. The serial port runs at the baud rate defined in BAUD (see // Makefile) using 8N1.
void logging_init();
// Outputs the specified byte value as a two ASCII hex characters.
void lputc_hex(uint8_t value);
// Outputs the specified two byte value as four ASCII hex characeters.
void lput16_hex(uint16_t val);
// Outputs the specified NULL terminated string.
void lput_str(const char *str);
// Outputs the specified buffer of data as ASCII hex characters.
void lput_buffer(const char *buf, int len);
|
/*
* Copyright 2010-2017 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.
*/
#pragma once
#include <aws/greengrass/Greengrass_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/greengrass/model/VersionInformation.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace Greengrass
{
namespace Model
{
class AWS_GREENGRASS_API ListCoreDefinitionVersionsResult
{
public:
ListCoreDefinitionVersionsResult();
ListCoreDefinitionVersionsResult(const AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
ListCoreDefinitionVersionsResult& operator=(const AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* The token for the next set of results, or ''null'' if there are no additional
* results.
*/
inline const Aws::String& GetNextToken() const{ return m_nextToken; }
/**
* The token for the next set of results, or ''null'' if there are no additional
* results.
*/
inline void SetNextToken(const Aws::String& value) { m_nextToken = value; }
/**
* The token for the next set of results, or ''null'' if there are no additional
* results.
*/
inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); }
/**
* The token for the next set of results, or ''null'' if there are no additional
* results.
*/
inline void SetNextToken(const char* value) { m_nextToken.assign(value); }
/**
* The token for the next set of results, or ''null'' if there are no additional
* results.
*/
inline ListCoreDefinitionVersionsResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;}
/**
* The token for the next set of results, or ''null'' if there are no additional
* results.
*/
inline ListCoreDefinitionVersionsResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;}
/**
* The token for the next set of results, or ''null'' if there are no additional
* results.
*/
inline ListCoreDefinitionVersionsResult& WithNextToken(const char* value) { SetNextToken(value); return *this;}
/**
* Versions
*/
inline const Aws::Vector<VersionInformation>& GetVersions() const{ return m_versions; }
/**
* Versions
*/
inline void SetVersions(const Aws::Vector<VersionInformation>& value) { m_versions = value; }
/**
* Versions
*/
inline void SetVersions(Aws::Vector<VersionInformation>&& value) { m_versions = std::move(value); }
/**
* Versions
*/
inline ListCoreDefinitionVersionsResult& WithVersions(const Aws::Vector<VersionInformation>& value) { SetVersions(value); return *this;}
/**
* Versions
*/
inline ListCoreDefinitionVersionsResult& WithVersions(Aws::Vector<VersionInformation>&& value) { SetVersions(std::move(value)); return *this;}
/**
* Versions
*/
inline ListCoreDefinitionVersionsResult& AddVersions(const VersionInformation& value) { m_versions.push_back(value); return *this; }
/**
* Versions
*/
inline ListCoreDefinitionVersionsResult& AddVersions(VersionInformation&& value) { m_versions.push_back(std::move(value)); return *this; }
private:
Aws::String m_nextToken;
Aws::Vector<VersionInformation> m_versions;
};
} // namespace Model
} // namespace Greengrass
} // namespace Aws
|
#include <ns3/random-variable-stream.h>
#include <ns3/average.h>
using namespace ns3;
////////////////////////////////////////////////////////////////////////////////////////
//
// Modelo a simular: patrón de llegadas según Poisson de tasa determinada
//
class Llegadas
{
public:
// Constructor: el parámetro es la tasa de llegadas por unidad de tiempo
Llegadas(double tasa);
// Media del proceso
double Media ();
private:
// Método que registra una nueva llegada y planifica la siguiente
void NuevaLlegada (double tiempo);
// Variable aleatoria para generar los intervalos entre llegadas
Ptr<ExponentialRandomVariable> tEntreLlegadas;
// Acumulador de los diferentes tiempos de llegada
Average<double> acumulador;
};
|
#include "test.h"
static enum TestResult test_available(void)
{
if (linux_creat(0, 0, 0) == linux_ENOSYS)
return TEST_NOT_SUPPORTED;
return TEST_SUCCESS;
}
BEGIN_TEST()
DO_TEST(test_available, "Syscall is available");
END_TEST()
|
/* Copyright 2017 CyberTech Labs Ltd.
*
* 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. */
#pragma once
#include <QtCore/QObject>
#include "deviceInterface.h"
#include "declSpec.h"
namespace trikControl {
/// Controls marker.
/// It is used only for 2d model in TS.
class TRIKCONTROL_EXPORT MarkerInterface : public QObject, public DeviceInterface
{
Q_OBJECT
public slots:
/// Moves the marker down to the floor.
virtual void down(const QString &color) = 0;
/// Lifts the robots marker up.
/// The robot stops drawing its trace on the floor after that.
virtual void up() = 0;
/// Returns true if marker is currently active or false if not.
virtual bool isDown() const = 0;
/// Calls down() with black color if \a isDown is true or up() otherwise.
virtual void setDown(bool isDown) = 0;
};
}
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/mgn/Mgn_EXPORTS.h>
#include <aws/mgn/MgnRequest.h>
#include <aws/mgn/model/DescribeJobsRequestFilters.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace mgn
{
namespace Model
{
/**
*/
class AWS_MGN_API DescribeJobsRequest : public MgnRequest
{
public:
DescribeJobsRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "DescribeJobs"; }
Aws::String SerializePayload() const override;
/**
* <p>Request to describe Job log filters.</p>
*/
inline const DescribeJobsRequestFilters& GetFilters() const{ return m_filters; }
/**
* <p>Request to describe Job log filters.</p>
*/
inline bool FiltersHasBeenSet() const { return m_filtersHasBeenSet; }
/**
* <p>Request to describe Job log filters.</p>
*/
inline void SetFilters(const DescribeJobsRequestFilters& value) { m_filtersHasBeenSet = true; m_filters = value; }
/**
* <p>Request to describe Job log filters.</p>
*/
inline void SetFilters(DescribeJobsRequestFilters&& value) { m_filtersHasBeenSet = true; m_filters = std::move(value); }
/**
* <p>Request to describe Job log filters.</p>
*/
inline DescribeJobsRequest& WithFilters(const DescribeJobsRequestFilters& value) { SetFilters(value); return *this;}
/**
* <p>Request to describe Job log filters.</p>
*/
inline DescribeJobsRequest& WithFilters(DescribeJobsRequestFilters&& value) { SetFilters(std::move(value)); return *this;}
/**
* <p>Request to describe Job log by max results.</p>
*/
inline int GetMaxResults() const{ return m_maxResults; }
/**
* <p>Request to describe Job log by max results.</p>
*/
inline bool MaxResultsHasBeenSet() const { return m_maxResultsHasBeenSet; }
/**
* <p>Request to describe Job log by max results.</p>
*/
inline void SetMaxResults(int value) { m_maxResultsHasBeenSet = true; m_maxResults = value; }
/**
* <p>Request to describe Job log by max results.</p>
*/
inline DescribeJobsRequest& WithMaxResults(int value) { SetMaxResults(value); return *this;}
/**
* <p>Request to describe Job logby next token.</p>
*/
inline const Aws::String& GetNextToken() const{ return m_nextToken; }
/**
* <p>Request to describe Job logby next token.</p>
*/
inline bool NextTokenHasBeenSet() const { return m_nextTokenHasBeenSet; }
/**
* <p>Request to describe Job logby next token.</p>
*/
inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; }
/**
* <p>Request to describe Job logby next token.</p>
*/
inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); }
/**
* <p>Request to describe Job logby next token.</p>
*/
inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); }
/**
* <p>Request to describe Job logby next token.</p>
*/
inline DescribeJobsRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;}
/**
* <p>Request to describe Job logby next token.</p>
*/
inline DescribeJobsRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;}
/**
* <p>Request to describe Job logby next token.</p>
*/
inline DescribeJobsRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;}
private:
DescribeJobsRequestFilters m_filters;
bool m_filtersHasBeenSet;
int m_maxResults;
bool m_maxResultsHasBeenSet;
Aws::String m_nextToken;
bool m_nextTokenHasBeenSet;
};
} // namespace Model
} // namespace mgn
} // namespace Aws
|
/* GStreamer
* Copyright (C) 2017 Matthew Waters <matthew@centricular.com>
*
* 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 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_WEBRTC_RTP_RECEIVER_H__
#define __GST_WEBRTC_RTP_RECEIVER_H__
#include <gst/gst.h>
#include <gst/webrtc/webrtc_fwd.h>
#include <gst/webrtc/dtlstransport.h>
G_BEGIN_DECLS
GST_WEBRTC_API
GType gst_webrtc_rtp_receiver_get_type(void);
#define GST_TYPE_WEBRTC_RTP_RECEIVER (gst_webrtc_rtp_receiver_get_type())
#define GST_WEBRTC_RTP_RECEIVER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_WEBRTC_RTP_RECEIVER,GstWebRTCRTPReceiver))
#define GST_IS_WEBRTC_RTP_RECEIVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_WEBRTC_RTP_RECEIVER))
#define GST_WEBRTC_RTP_RECEIVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_WEBRTC_RTP_RECEIVER,GstWebRTCRTPReceiverClass))
#define GST_IS_WEBRTC_RTP_RECEIVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_WEBRTC_RTP_RECEIVER))
#define GST_WEBRTC_RTP_RECEIVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_WEBRTC_RTP_RECEIVER,GstWebRTCRTPReceiverClass))
struct _GstWebRTCRTPReceiver
{
GstObject parent;
/* The MediStreamTrack is represented by the stream and is output into @transport/@rtcp_transport as necessary */
GstWebRTCDTLSTransport *transport;
GstWebRTCDTLSTransport *rtcp_transport;
gpointer _padding[GST_PADDING];
};
struct _GstWebRTCRTPReceiverClass
{
GstObjectClass parent_class;
gpointer _padding[GST_PADDING];
};
GST_WEBRTC_API
GstWebRTCRTPReceiver * gst_webrtc_rtp_receiver_new (void);
GST_WEBRTC_API
void gst_webrtc_rtp_receiver_set_transport (GstWebRTCRTPReceiver * receiver,
GstWebRTCDTLSTransport * transport);
GST_WEBRTC_API
void gst_webrtc_rtp_receiver_set_rtcp_transport (GstWebRTCRTPReceiver * receiver,
GstWebRTCDTLSTransport * transport);
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstWebRTCRTPReceiver, gst_object_unref)
#endif
G_END_DECLS
#endif /* __GST_WEBRTC_RTP_RECEIVER_H__ */
|
int32_t i_w0 ;
int32_t i_w1 ;
int32_t i_shift ;
int32_t i_offset ;
int32_t i_round ;
int32_t b_x_set_done ;
|
/*! \file Query.h
* \author Jared Hoberock
* \brief Defines an interface for abstracting
* OpenGL query objects.
*/
#ifndef QUERY_H
#define QUERY_H
#include <GL/glew.h>
#include "../globject/GLObject.h"
/*! \fn genQueryThunk
* \todo Find a way around this.
*/
inline void genQueryThunk(GLuint num, GLuint *id)
{
glGenQueriesARB(num, id);
} // end genQueryThunk()
/*! \fn deleteQueryThunk
* \todo Find a way around this.
*/
inline void deleteQueryThunk(GLuint num, GLuint *id)
{
glDeleteQueriesARB(num, id);
} // end deleteQueryThunk()
/*! \fn bindQueryThunk()
* \todo XXX Find a way around this.
*/
inline void bindQueryThunk(GLenum target, GLuint id)
{
if(id == 0)
{
// "unbind"
glEndQueryARB(target);
} // end if
else
{
// "bind"
glBeginQueryARB(target, id);
} // end else
} // end bindQueryThunk()
class Query
: public GLObject<genQueryThunk,
deleteQueryThunk,
bindQueryThunk>
{
public:
/*! \typedef Parent
* \brief Shorthand.
*/
typedef GLObject<genQueryThunk,
deleteQueryThunk,
bindQueryThunk> Parent;
/*! \fn Query
* \brief Null constructor sets the target
* to GL_SAMPLES_PASSED_ARB and
* calls the Parent.
*/
inline Query(void);
/*! \fn isAvailable
* \brief This method returns whether or not
* this Query's result is available yet.
* \return As above.
* \note If this method returns true, the result
* is available through a call to getResult().
*/
inline bool isAvailable(void) const;
/*! \fn getResult
* \brief This method returns the result of this
* Query.
* \return mResult.
* \note The value returned by this method is
* undefined if isAvailable() has not yet
* been called and returned true.
*/
inline GLuint getResult(void) const;
/*! \fn spinAndGetResult
* \brief This method spins until the result of this
* Query is available and returns the result.
* \return mResult.
*/
inline GLuint spinAndGetResult(void) const;
protected:
/*! The result of this Query.
*/
mutable GLuint mResult;
}; // end Query
#include "Query.inl"
#endif // QUERY_H
|
/*****************************************************************************
* *
* D2Patches.h *
* Copyright (C) Olivier Verville *
* SlashDiablo-Tools Modifications: Copyright (C) 2017 Mir Drualga *
* *
* 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. *
* *
*---------------------------------------------------------------------------*
* *
* https://github.com/olivier-verville/D2Template *
* *
* This file is where you declare all your patches, in order to inject *
* your own code into the game. Each patch should be declared in the *
* array, in order to be handled by D2Template's patcher *
* *
*****************************************************************************/
#pragma once
#ifndef _D2PATCHES_H
#define _D2PATCHES_H
#include <memory>
#include <vector>
#include "D2Patch.h"
#include "DLLmain.h"
static const std::vector<std::shared_ptr<D2BasePatch>> gptTemplatePatches = {
std::make_shared<D2AnyPatch>(D2Offset(D2TEMPLATE_DLL_FILES::D2DLL_D2CLIENT, {
{GameVersion::VERSION_113c, 0},
}), OpCode::NOP, false, 0),
};
// end of file --------------------------------------------------------------
#endif
|
#include "sfpr_timer.h"
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
sfpr_timer_t* sfpr_timer_create()
{
sfpr_timer_id_t timer_id;
sfpr_timer_t *timer;
int ret;
timer = (sfpr_timer_t*)malloc(sizeof(sfpr_timer_t));
if(!timer)
{
return NULL;
}
memset(timer, 0x0, sizeof(sfpr_timer_t));
return timer;
}
int sfpr_timer_init(sfpr_timer_t* timer, int userid, sfpr_timer_cb_t cb, void *param)
{
int ret=0;
if(!timer)
return -1;
timer->handle = cb;
timer->param = param;
timer->userid = userid;
return ret;
}
int sfpr_timer_destory(sfpr_timer_t **timer)
{
int ret=0;
sfpr_timer_t *_timer = *timer;
if(!_timer)
return -1;
free(_timer);
return ret;
}
int sfpr_timer_start(sfpr_timer_t *timer, int msec, int nloop)
{
int ret ;
if(!timer)
return -1;
return ret;
}
int sfpr_timer_cancel(sfpr_timer_t *timer)
{
int ret =SFPR_ERROR;
if(!timer)
return -1;
return ret;
}
#ifdef __cplusplus
}
#endif
|
/**
* This code is released under the
* Apache License Version 2.0 http://www.apache.org/licenses/.
*
* (c) Daniel Lemire
*/
#ifndef SIMDCompressionAndIntersection_SIMDBITPACKING_H_
#define SIMDCompressionAndIntersection_SIMDBITPACKING_H_
#include "common.h"
namespace SIMDCompressionLib {
void __SIMD_fastunpack1(const __m128i *, uint32_t *);
void __SIMD_fastunpack2(const __m128i *, uint32_t *);
void __SIMD_fastunpack3(const __m128i *, uint32_t *);
void __SIMD_fastunpack4(const __m128i *, uint32_t *);
void __SIMD_fastunpack5(const __m128i *, uint32_t *);
void __SIMD_fastunpack6(const __m128i *, uint32_t *);
void __SIMD_fastunpack7(const __m128i *, uint32_t *);
void __SIMD_fastunpack8(const __m128i *, uint32_t *);
void __SIMD_fastunpack9(const __m128i *, uint32_t *);
void __SIMD_fastunpack10(const __m128i *, uint32_t *);
void __SIMD_fastunpack11(const __m128i *, uint32_t *);
void __SIMD_fastunpack12(const __m128i *, uint32_t *);
void __SIMD_fastunpack13(const __m128i *, uint32_t *);
void __SIMD_fastunpack14(const __m128i *, uint32_t *);
void __SIMD_fastunpack15(const __m128i *, uint32_t *);
void __SIMD_fastunpack16(const __m128i *, uint32_t *);
void __SIMD_fastunpack17(const __m128i *, uint32_t *);
void __SIMD_fastunpack18(const __m128i *, uint32_t *);
void __SIMD_fastunpack19(const __m128i *, uint32_t *);
void __SIMD_fastunpack20(const __m128i *, uint32_t *);
void __SIMD_fastunpack21(const __m128i *, uint32_t *);
void __SIMD_fastunpack22(const __m128i *, uint32_t *);
void __SIMD_fastunpack23(const __m128i *, uint32_t *);
void __SIMD_fastunpack24(const __m128i *, uint32_t *);
void __SIMD_fastunpack25(const __m128i *, uint32_t *);
void __SIMD_fastunpack26(const __m128i *, uint32_t *);
void __SIMD_fastunpack27(const __m128i *, uint32_t *);
void __SIMD_fastunpack28(const __m128i *, uint32_t *);
void __SIMD_fastunpack29(const __m128i *, uint32_t *);
void __SIMD_fastunpack30(const __m128i *, uint32_t *);
void __SIMD_fastunpack31(const __m128i *, uint32_t *);
void __SIMD_fastunpack32(const __m128i *, uint32_t *);
void __SIMD_fastpackwithoutmask0(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask1(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask2(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask3(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask4(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask5(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask6(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask7(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask8(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask9(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask10(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask11(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask12(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask13(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask14(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask15(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask16(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask17(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask18(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask19(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask20(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask21(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask22(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask23(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask24(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask25(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask26(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask27(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask28(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask29(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask30(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask31(const uint32_t *, __m128i *);
void __SIMD_fastpackwithoutmask32(const uint32_t *, __m128i *);
void __SIMD_fastpack0(const uint32_t *, __m128i *);
void __SIMD_fastpack1(const uint32_t *, __m128i *);
void __SIMD_fastpack2(const uint32_t *, __m128i *);
void __SIMD_fastpack3(const uint32_t *, __m128i *);
void __SIMD_fastpack4(const uint32_t *, __m128i *);
void __SIMD_fastpack5(const uint32_t *, __m128i *);
void __SIMD_fastpack6(const uint32_t *, __m128i *);
void __SIMD_fastpack7(const uint32_t *, __m128i *);
void __SIMD_fastpack8(const uint32_t *, __m128i *);
void __SIMD_fastpack9(const uint32_t *, __m128i *);
void __SIMD_fastpack10(const uint32_t *, __m128i *);
void __SIMD_fastpack11(const uint32_t *, __m128i *);
void __SIMD_fastpack12(const uint32_t *, __m128i *);
void __SIMD_fastpack13(const uint32_t *, __m128i *);
void __SIMD_fastpack14(const uint32_t *, __m128i *);
void __SIMD_fastpack15(const uint32_t *, __m128i *);
void __SIMD_fastpack16(const uint32_t *, __m128i *);
void __SIMD_fastpack17(const uint32_t *, __m128i *);
void __SIMD_fastpack18(const uint32_t *, __m128i *);
void __SIMD_fastpack19(const uint32_t *, __m128i *);
void __SIMD_fastpack20(const uint32_t *, __m128i *);
void __SIMD_fastpack21(const uint32_t *, __m128i *);
void __SIMD_fastpack22(const uint32_t *, __m128i *);
void __SIMD_fastpack23(const uint32_t *, __m128i *);
void __SIMD_fastpack24(const uint32_t *, __m128i *);
void __SIMD_fastpack25(const uint32_t *, __m128i *);
void __SIMD_fastpack26(const uint32_t *, __m128i *);
void __SIMD_fastpack27(const uint32_t *, __m128i *);
void __SIMD_fastpack28(const uint32_t *, __m128i *);
void __SIMD_fastpack29(const uint32_t *, __m128i *);
void __SIMD_fastpack30(const uint32_t *, __m128i *);
void __SIMD_fastpack31(const uint32_t *, __m128i *);
void __SIMD_fastpack32(const uint32_t *, __m128i *);
} // namespace SIMDCompressionLib
#endif /* SIMDCompressionAndIntersection_SIMDBITPACKING_H_ */
|
/*
* twemproxy - A fast and lightweight proxy for memcached protocol.
* Copyright (C) 2011 Twitter, 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.
*/
#include <nc_core.h>
#include <nc_server.h>
#include <nc_client.h>
void
client_ref(struct conn *conn, void *owner)
{
ASSERT(conn->client && !conn->proxy);
ASSERT(conn->owner == NULL);
/*
* We use null pointer as the sockaddr argument in the accept() call as
* we are not interested in the address of the peer for the accepted
* connection
*/
conn->family = 0;
conn->addrlen = 0;
conn->addr = NULL;
if (conn->source_type != NC_SOURCE_TYPE_PROXY) {
struct server_pool *pool = owner;
pool->nc_conn_q++;
TAILQ_INSERT_TAIL(&pool->c_conn_q, conn, conn_tqe);
/* owner of the client connection is the server pool */
conn->owner = owner;
log_debug(LOG_VVERB, "ref conn %p owner %p into pool '%.*s'", conn, pool,
pool->name.len, pool->name.data);
} else {
struct manage *manager = owner;
manager->nc_conn_q++;
TAILQ_INSERT_TAIL(&manager->c_conn_q, conn, conn_tqe);
/* owner of the client connection is the manage */
conn->owner = owner;
log_debug(LOG_VVERB, "ref conn %p owner %p for manage", conn, manager);
}
}
void
client_unref(struct conn *conn)
{
ASSERT(conn->client && !conn->proxy);
ASSERT(conn->owner != NULL);
if (conn->source_type != NC_SOURCE_TYPE_PROXY) {
struct server_pool *pool;
pool = conn->owner;
ASSERT(pool->nc_conn_q != 0);
conn->owner = NULL;
pool->nc_conn_q--;
TAILQ_REMOVE(&pool->c_conn_q, conn, conn_tqe);
log_debug(LOG_VVERB, "unref conn %p owner %p from pool '%.*s'", conn,
pool, pool->name.len, pool->name.data);
} else {
struct manage *manager;
manager = conn->owner;
ASSERT(manager->nc_conn_q != 0);
conn->owner = NULL;
manager->nc_conn_q--;
TAILQ_REMOVE(&manager->c_conn_q, conn, conn_tqe);
log_debug(LOG_VVERB, "ref conn %p owner %p for manage", conn, manager);
}
}
bool
client_active(struct conn *conn)
{
ASSERT(conn->client && !conn->proxy);
ASSERT(TAILQ_EMPTY(&conn->imsg_q));
if (!TAILQ_EMPTY(&conn->omsg_q)) {
log_debug(LOG_VVERB, "c %d is active", conn->sd);
return true;
}
if (conn->rmsg != NULL) {
log_debug(LOG_VVERB, "c %d is active", conn->sd);
return true;
}
if (conn->smsg != NULL) {
log_debug(LOG_VVERB, "c %d is active", conn->sd);
return true;
}
log_debug(LOG_VVERB, "c %d is inactive", conn->sd);
return false;
}
static void
client_close_stats(struct context *ctx, struct server_pool *pool, err_t err,
unsigned eof)
{
stats_pool_decr(ctx, pool, client_connections);
if (eof) {
stats_pool_incr(ctx, pool, client_eof);
return;
}
switch (err) {
case EPIPE:
case ETIMEDOUT:
case ECONNRESET:
case ECONNABORTED:
case ENOTCONN:
case ENETDOWN:
case ENETUNREACH:
case EHOSTDOWN:
case EHOSTUNREACH:
default:
stats_pool_incr(ctx, pool, client_err);
break;
}
}
void
client_close(struct context *ctx, struct conn *conn)
{
rstatus_t status;
struct msg *msg, *nmsg; /* current and next message */
ASSERT(conn->client && !conn->proxy);
if (conn->source_type != NC_SOURCE_TYPE_PROXY)
client_close_stats(ctx, conn->owner, conn->err, conn->eof);
if (conn->sd < 0) {
conn->unref(conn);
conn_put(conn);
return;
}
msg = conn->rmsg;
if (msg != NULL) {
conn->rmsg = NULL;
ASSERT(msg->peer == NULL);
ASSERT(msg->request && !msg->done);
log_debug(LOG_INFO, "close c %d discarding pending req %"PRIu64" len "
"%"PRIu32" type %d", conn->sd, msg->id, msg->mlen,
msg->type);
req_put(msg);
}
ASSERT(conn->smsg == NULL);
ASSERT(TAILQ_EMPTY(&conn->imsg_q));
for (msg = TAILQ_FIRST(&conn->omsg_q); msg != NULL; msg = nmsg) {
nmsg = TAILQ_NEXT(msg, c_tqe);
/* dequeue the message (request) from client outq */
conn->dequeue_outq(ctx, conn, msg);
if (msg->done) {
log_debug(LOG_INFO, "close c %d discarding %s req %"PRIu64" len "
"%"PRIu32" type %d", conn->sd,
msg->error ? "error": "completed", msg->id, msg->mlen,
msg->type);
req_put(msg);
} else {
msg->swallow = 1;
ASSERT(msg->request);
ASSERT(msg->peer == NULL);
log_debug(LOG_INFO, "close c %d schedule swallow of req %"PRIu64" "
"len %"PRIu32" type %d", conn->sd, msg->id, msg->mlen,
msg->type);
}
}
ASSERT(TAILQ_EMPTY(&conn->omsg_q));
conn->unref(conn);
status = close(conn->sd);
if (status < 0) {
log_error("close c %d failed, ignored: %s", conn->sd, strerror(errno));
}
conn->sd = -1;
conn_put(conn);
}
|
/**************************************************************************
Copyright (c) 2016 sewenew
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 SW_BASE_STR__STR_UTIL_H
#define SW_BASE_STR__STR_UTIL_H
#include <string>
namespace sw {
namespace str {
// Join strings with 'delimiter'.
template <typename Iter>
std::string join(const std::string &delimiter, Iter first, Iter last);
// Join strings for which 'pred' returns true with 'delimiter'.
template <typename Iter, typename Pred>
std::string join_if(const std::string &delimiter, Iter first, Iter last, Pred pred);
// Split a string with 'delimiter' into pieces.
template <typename Iter>
void split(const std::string &str, const std::string &delimiter, Iter result);
}
}
#endif // end SW_BASE_STR__STR_UTIL_H
|
//
// DidUtils.h
// Indy-demo
//
// Created by Anastasia Tarasova on 02.06.17.
// Copyright © 2017 Kirill Neznamov. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
#import <Indy/Indy.h>
@interface DidUtils : XCTestCase
+ (DidUtils *)sharedInstance;
// MARK: - Instance methods
- (NSError *)createMyDidWithWalletHandle:(IndyHandle)walletHandle
myDidJson:(NSString *)myDidJson
outMyDid:(NSString **)myDid
outMyVerkey:(NSString **)myVerkey;
- (NSError *)createAndStoreMyDidWithWalletHandle:(IndyHandle)walletHandle
seed:(NSString *)seed
outMyDid:(NSString **)myDid
outMyVerkey:(NSString **)myVerkey;
- (NSError *)createAndStoreAndPublishDidWithWalletHandle:(IndyHandle)walletHandle
poolHandle:(IndyHandle)poolHandle
did:(NSString **)did
verkey:(NSString **)verkey;
- (NSError *)storeTheirDidWithWalletHandle:(IndyHandle)walletHandle
identityJson:(NSString *)identityJson;
- (NSError *)storeTheirDidFromPartsWithWalletHandle:(IndyHandle)walletHandle
theirDid:(NSString *)theirDid
theirVerkey:(NSString *)theirVerkey;
- (NSError *)replaceKeysStartForDid:(NSString *)did
identityJson:(NSString *)identityJson
walletHandle:(IndyHandle)walletHandle
outMyVerKey:(NSString **)myVerKey;
- (NSError *)replaceKeysApplyForDid:(NSString *)did
walletHandle:(IndyHandle)walletHandle;
- (NSError *)replaceKeysForDid:(NSString *)did
identityJson:(NSString *)identityJson
walletHandle:(IndyHandle)walletHandle
poolHandle:(IndyHandle)poolHandle
outMyVerKey:(NSString **)myVerKey;
- (NSString *)createStoreAndPublishMyDidWithWalletHandle:(IndyHandle)walletHandle
poolHandle:(IndyHandle)poolHandle;
- (NSError *)keyForDid:(NSString *)did
poolHandle:(IndyHandle)poolHandle
walletHandle:(IndyHandle)walletHandle
key:(NSString **)key;
- (NSError *)keyForLocalDid:(NSString *)did
walletHandle:(IndyHandle)walletHandle
key:(NSString **)key;
- (NSError *)setEndpointAddress:(NSString *)address
transportKey:(NSString *)transportKey
forDid:(NSString *)did
walletHandle:(IndyHandle)walletHandle;
- (NSError *)getEndpointForDid:(NSString *)did
walletHandle:(IndyHandle)walletHandle
poolHandle:(IndyHandle)poolHandle
address:(NSString **)address
transportKey:(NSString **)transportKey;
- (NSError *)setMetadata:(NSString *)metadata
forDid:(NSString *)did
walletHandle:(IndyHandle)walletHandle;
- (NSError *)getMetadataForDid:(NSString *)did
walletHandle:(IndyHandle)walletHandle
metadata:(NSString **)metadata;
- (NSError *)abbreviateVerkey:(NSString *)did
fullVerkey:(NSString *)fullVerkey
verkey:(NSString **)verkey;
- (NSError *)listMyDidsWithMeta:(IndyHandle)walletHandle
metadata:(NSString **)metadata;
- (NSError *)qualifyDid:(NSString *)did
method:(NSString *)method
walletHandle:(IndyHandle)walletHandle
fullQualifiedDid:(NSString **)fullQualifiedDid;
@end
|
#ifndef QUALIFICATIONLIST_H
#define QUALIFICATIONLIST_H
#include <QList>
#include <QJsonArray>
#include <QJsonValue>
#include <QHash>
#include "qualification.h"
/**
* List of all qualifications
* @brief The QualificationList class
* @author Georg Heyne
* @date 06.04.2016
*/
class QualificationList
{
public:
QualificationList(QJsonArray qualificationsArray);
/**
* @brief Return the list of qualifications
* @return List of the qualifications
*/
QHash <QString, QSharedPointer<Qualification> > getHashList();
/**
* @brief qualificationPercentages
* @return
*/
QHash<QString, int >* qualificationPercentages();
private:
/**
* @brief List of all qualifications
*/
QHash <QString, QSharedPointer<Qualification> > m_qualificationHash;
/**
* @brief List of the percentages stored in the
*/
QHash <QString, int> m_qualificationPercentages;
/**
* reads the QString with the dependency short name, writes the dependency pointer to the qualification and writes the qualification pointerto the dependency
*
* @brief sets the Pointer of all dependencies (makes the tree)
*/
void getAndSetDependencies();
};
#endif // QUALIFICATIONLIST_H
|
// -*- C++ -*-
//
// Copyright 2016 WebAssembly Community Group participants
//
// 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.
// Defines a pointer to a byte stream for writing.
#ifndef DECOMPRESSOR_SRC_STREAM_WRITECURSOR_H_
#define DECOMPRESSOR_SRC_STREAM_WRITECURSOR_H_
#include "stream/WriteCursorBase.h"
namespace wasm {
namespace decode {
class WriteCursor : public WriteCursorBase {
public:
// Note: The nullary write cursor should not be used until it has been
// assigned a value.
WriteCursor();
WriteCursor(std::shared_ptr<Queue> Que);
WriteCursor(StreamType Type, std::shared_ptr<Queue> Que);
explicit WriteCursor(const WriteCursor& C);
WriteCursor(const Cursor& C, AddressType StartAddress);
WriteCursor(const WriteCursorBase& C);
~WriteCursor() OVERRIDE;
WriteCursor& operator=(const WriteCursor& C) {
assign(C);
return *this;
}
protected:
void writeFillWriteByte(ByteType Byte) OVERRIDE;
};
} // end of namespace decode
} // end of namespace wasm
#endif // DECOMPRESSOR_SRC_STREAM_WRITECURSOR_H_
|
/*=========================================================================
*
* Copyright UMC Utrecht and contributors
*
* 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.txt
*
* 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 itkGPUInterpolatorBase_h
#define itkGPUInterpolatorBase_h
#include "itkGPUDataManager.h"
namespace itk
{
/** \class GPUInterpolatorBase
* \brief Base class fro all GPU interpolators.
*
* \author Denis P. Shamonin and Marius Staring. Division of Image Processing,
* Department of Radiology, Leiden, The Netherlands
*
* \note This work was funded by the Netherlands Organisation for
* Scientific Research (NWO NRG-2010.02 and NWO 639.021.124).
*
* \ingroup GPUCommon
*/
class ITK_EXPORT GPUInterpolatorBase
{
public:
/** Run-time type information (and related methods). */
virtual const char *
GetNameOfClass() const
{
return "GPUInterpolatorBase";
}
/** Returns OpenCL \a source code for the transform.
* Returns true if source code was combined, false otherwise. */
virtual bool
GetSourceCode(std::string & source) const;
/** Returns data manager that stores all settings for the transform. */
virtual GPUDataManager::Pointer
GetParametersDataManager() const;
protected:
GPUInterpolatorBase();
virtual ~GPUInterpolatorBase() = default;
GPUDataManager::Pointer m_ParametersDataManager;
};
} // end namespace itk
#endif /* itkGPUInterpolatorBase_h */
|
#include <stdio.h>
#include <stdlib.h>
typedef struct Node{
int key;
struct Node *pNext;
}Node;
void reverseList(Node**head);
void AddNode(Node** node,int key);
void printList(Node *node);
|
/****************************************************************************
**
** gsystem: A quick, micro library of C++
**
** @author birderyu
** @contact https://github.com/birderyu
** @file gstringpool.h
** @date 2016-12-03
** @brief ×Ö·û´®³ØÀàÐ͵͍Òå
**
****************************************************************************/
#ifndef _CORE_STRING_POOL_H_
#define _CORE_STRING_POOL_H_
#include "gmemorystore.h"
#include "gvector.h"
#include "gmap.h"
namespace gsystem { // gsystem
/****************************************************************************
**
** gstringpool.h
**
** @class GStringPool
** @module GCore
** @brief ×Ö·û´®³ØÀàÐÍ
**
** ΪÁË´¦Àí×Ö·û´®µÄ±ä³¤ÌØÐÔ£¬²ÉÓöà¿éÁ¬ÐøµÄÄÚ´æ½á¹¹È¥´æ´¢ºÍ´«Êä×Ö·û´®£º
** ÔÚ×Ö·û´®³ØÄÚ²¿£¬°Ñ×Ö·û´®·ÖΪÒÔϼ¸ÖÖÀàÐÍ£¬·Ö±ð²ÉÓÃÒÔϼ¸ÖÖ´æ´¢·½Ê½£º
** 1.STRING_POOL_SMALL_STRING£º¶Ì×Ö·û´®£¬³¤¶ÈΪ1+1+×Ö·û´®µÄʵ¼Ê³¤¶È£¨°üº¬'\0'£©£¬ÓÃÒ»
** ¶ÎÁ¬ÐøµÄÄÚ´æ´æ´¢£¬ÀíÂÛÉÏÖ§³ÖµÄ×Ö·û´®µÄ×î´ó³¤¶ÈΪ255£»
** 2.STRING_POOL_NORMAL_STRING£ºÆÕͨ×Ö·û´®£¬³¤¶ÈΪ1+2+×Ö·û´®µÄʵ¼Ê³¤¶È£¨°üº¬'\0'£©£¬
** ÓÃÒ»¶ÎÁ¬ÐøµÄÄÚ´æ´æ´¢£¬Ö§³ÖµÄ×Ö·û´®µÄ×î´ó³¤¶ÈΪ65535ºÍ£¨nMaxSize-3£©µÄ½ÏСÕߣ»
** 3.STRING_POOL_PART_STRING_START£º²¿·Ö×Ö·û´®µÄ£¬ÇÒλÓÚÊ×룬
** ³¤¶ÈΪ1+4+G_POINTER_ADDRESS_SIZE+µ±Ç°²¿·Ö×Ö·û´®µÄ³¤¶È£¬ÀíÂÛÉÏÖ§³ÖµÄ×Ö·û´®µÄ×î´ó
** ³¤¶ÈΪ4294967295£»
** 4.STRING_POOL_PART_STRING_MIDDLE£º²¿·Ö×Ö·û´®µÄ£¬ÇÒλÓÚÖм䣬
** ³¤¶ÈΪ1+4+G_POINTER_ADDRESS_SIZE+G_POINTER_ADDRESS_SIZE+µ±Ç°²¿·Ö×Ö·û´®µÄ
** ³¤¶È£¬ÀíÂÛÉÏÖ§³ÖµÄ×Ö·û´®µÄ×î´ó³¤¶ÈΪ4294967295£»
** 5.STRING_POOL_PART_STRING_END£º²¿·Ö×Ö·û´®µÄ£¬ÇÒλÓÚ½á⣬
** ³¤¶ÈΪ1+4+G_POINTER_ADDRESS_SIZE+µ±Ç°²¿·Ö×Ö·û´®µÄ³¤¶È£¬ÀíÂÛÉÏÖ§³ÖµÄ×Ö·û´®µÄ×î´ó
** ³¤¶ÈΪ4294967295£»
** 6.STRING_POOL_REFERENCE_STRING£ºÒýÓÃ×Ö·û´®£¬³¤¶ÈΪ1+G_POINTER_ADDRESS_SIZE£¬
** ´æ´¢ÁíÒ»¸ö×Ö·û´®µÄÊ×µØÖ·£¬»ØÊÕʱ»áÖØÐ´´½¨Ò»¸öÈ«¿½±´µÄ¸±±¾¡£
**
****************************************************************************/
class GAPI GStringPool
{
enum TYPE
{
STRING_POOL_SMALL_STRING = 0,
STRING_POOL_NORMAL_STRING,
STRING_POOL_PART_STRING_START,
STRING_POOL_PART_STRING_MIDDLE,
STRING_POOL_PART_STRING_END,
STRING_POOL_REFERENCE_STRING,
};
public:
GStringPool(gsize nInitSzie = 2048, gsize nMaxSize = 10240);
gptr Alloc(gsize);
gvoid Free(gptr);
private:
/// »ØÊÕÕ¾
GMap<gsize, GVector<gaddress>> m_tRecycle;
GMemoryStore m_tStore;
};
} // namespace gsystem
#endif // _CORE_STRING_POOL_H_
|
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2022 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// 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 holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Heiko Kernbach
////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <functional>
#include <string>
#include <unordered_set>
#include <vector>
#include <velocypack/Builder.h>
#include "Aql/types.h"
#include "Aql/AqlFunctionsInternalCache.h"
#include "Aql/AttributeNamePath.h"
#include "Aql/Projections.h"
#include "Containers/FlatHashSet.h"
#include "Indexes/IndexIterator.h"
#include "VocBase/Identifiers/LocalDocumentId.h"
#include "VocBase/voc-types.h"
namespace arangodb {
namespace transaction {
class Methods;
}
namespace velocypack {
class Builder;
class Slice;
} // namespace velocypack
namespace aql {
struct AqlValue;
class DocumentProducingExpressionContext;
class EnumerateCollectionExecutorInfos;
class Expression;
class ExpressionContext;
class IndexExecutorInfos;
class InputAqlItemRow;
class OutputAqlItemRow;
class QueryContext;
struct Variable;
struct DocumentProducingFunctionContext {
public:
// constructor called from EnumerateCollectionExecutor
DocumentProducingFunctionContext(transaction::Methods& trx,
InputAqlItemRow const& inputRow,
EnumerateCollectionExecutorInfos& infos);
// constructor called from IndexExecutor
DocumentProducingFunctionContext(transaction::Methods& trx,
InputAqlItemRow const& inputRow,
IndexExecutorInfos& infos);
~DocumentProducingFunctionContext();
void setOutputRow(OutputAqlItemRow* outputRow);
bool getProduceResult() const noexcept;
arangodb::aql::Projections const& getProjections() const noexcept;
transaction::Methods* getTrxPtr() const noexcept;
bool getAllowCoveringIndexOptimization() const noexcept;
void setAllowCoveringIndexOptimization(
bool allowCoveringIndexOptimization) noexcept;
void incrScanned() noexcept;
void incrFiltered() noexcept;
size_t getAndResetNumScanned() noexcept;
size_t getAndResetNumFiltered() noexcept;
InputAqlItemRow const& getInputRow() const noexcept;
OutputAqlItemRow& getOutputRow() const noexcept;
RegisterId getOutputRegister() const noexcept;
bool checkUniqueness(LocalDocumentId const& token);
// called for documents and indexes
bool checkFilter(velocypack::Slice slice);
// called only for late materialization
bool checkFilter(IndexIteratorCoveringData const* covering);
void reset();
void setIsLastIndex(bool val);
bool hasFilter() const noexcept;
aql::AqlFunctionsInternalCache& aqlFunctionsInternalCache() noexcept {
return _aqlFunctionsInternalCache;
}
arangodb::velocypack::Builder& getBuilder() noexcept;
private:
bool checkFilter(DocumentProducingExpressionContext& ctx);
aql::AqlFunctionsInternalCache _aqlFunctionsInternalCache;
InputAqlItemRow const& _inputRow;
OutputAqlItemRow* _outputRow;
aql::QueryContext& _query;
transaction::Methods& _trx;
Expression* _filter;
arangodb::aql::Projections const& _projections;
size_t _numScanned;
size_t _numFiltered;
std::unique_ptr<DocumentProducingExpressionContext> _expressionContext;
/// @brief Builder that is reused to generate projection results
arangodb::velocypack::Builder _objectBuilder;
/// @brief set of already returned documents. Used to make the result distinct
containers::FlatHashSet<LocalDocumentId> _alreadyReturned;
RegisterId const _outputRegister;
Variable const* _outputVariable;
// note: it is fine if this counter overflows
uint_fast16_t _killCheckCounter = 0;
/// @brief Flag if we need to check for uniqueness
bool const _checkUniqueness;
bool const _produceResult;
bool _allowCoveringIndexOptimization;
/// @brief Flag if the current index pointer is the last of the list.
/// Used in uniqueness checks.
bool _isLastIndex;
};
namespace DocumentProducingCallbackVariant {
struct WithProjectionsCoveredByIndex {};
struct WithProjectionsNotCoveredByIndex {};
struct DocumentCopy {};
} // namespace DocumentProducingCallbackVariant
template<bool checkUniqueness, bool skip>
IndexIterator::CoveringCallback getCallback(
DocumentProducingCallbackVariant::WithProjectionsCoveredByIndex,
DocumentProducingFunctionContext& context);
template<bool checkUniqueness, bool skip>
IndexIterator::DocumentCallback getCallback(
DocumentProducingCallbackVariant::WithProjectionsNotCoveredByIndex,
DocumentProducingFunctionContext& context);
template<bool checkUniqueness, bool skip>
IndexIterator::DocumentCallback getCallback(
DocumentProducingCallbackVariant::DocumentCopy,
DocumentProducingFunctionContext& context);
template<bool checkUniqueness>
IndexIterator::LocalDocumentIdCallback getNullCallback(
DocumentProducingFunctionContext& context);
template<bool checkUniqueness, bool skip>
IndexIterator::DocumentCallback buildDocumentCallback(
DocumentProducingFunctionContext& context);
} // namespace aql
} // namespace arangodb
|
/****************************************************************************
* Copyright(C)2013-2014 by TanekLiang<y574824080@gmail.com> *
* *
* 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 __KEY_H__
#define __KEY_H__
/*============================ INCLUDES ======================================*/
#include ".\app_cfg.h"
#if USE_COMPONENT_KEY == ENABLED
#include ".\key_interface.h"
/*============================ MACROS ========================================*/
/*============================ MACROFIED FUNCTIONS ===========================*/
/*============================ TYPES =========================================*/
/*============================ GLOBAL VARIABLES ==============================*/
/*============================ LOCAL VARIABLES ===============================*/
/*============================ PROTOTYPES ====================================*/
/*! \brief key task initialization
*! \param none
*! \return none
*/
extern void key_init(void);
/*! \brief key task
*! \param none
*! \return none
*/
extern void key_task(void);
/*! \brief get key event
*! \param ptKey Key Event
*! \return true get key succeed
*! \return true get key failed
*/
extern bool get_key(key_event_t* ptKey);
#endif
#endif
/* EOF */
|
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
int main (int argc, char ** argv)
{
if (argc != 2)
{
fprintf (stderr, "usage: %s eta \n", argv[0]);
return 1;
}
double eta = atof(argv[1]);
double val = 2.0 * atan (exp (-1.0e0 * eta));
double cott = cos(val)/sin(val);
fprintf (stdout, "cot(theta): %f \n", cott);
return 0;
}
|
// Copyright 2013 Peter Wallström
//
// 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.
// while it is not required i like to request a few things
// 1. please do share any meaningfull/usefull changes/additions/fixes you make with me so that i could include it in any future version
// 2. likewise do share any ideas for improvements
// 3. If you make something comersiol or at least something you release publicly that relies on this code then i would like to know and maybe use in my CV
// 4. Please do include me in your credits
// glz geometry toolkit - for allmost all your geometry needs
// visit http://www.flashbang.se or contact me at overlord@flashbang.se
// the entire toolkit should exist in it's entirety at github
// https://github.com/zeoverlord/glz.git
using namespace std;
#include "ztool-type.h"
#include "ztool-vectormath.h"
#include <vector>
#ifndef __glz_geo__
#define __glz_geo__
//type signifies the type of data to choose from, if set at GLZ_AUTO it chooses the default settings
//vao always returns the created VAO
//every function that creates a VAO returns the amount of Vertics to output
// every VAO funtion resets the vao to 0 to prevent problems unless otherwise specified
typedef struct{
int active;
glzVAOType type;
}vaostatus;
typedef struct
{
glzIGTType type;
unsigned int width;
unsigned int height;
unsigned int bpp;
float x_offset;
float y_offset;
float z_offset;
float scale;
float tscale;
glzAxis axis;
unsigned char *data;
} image_geo_transform;
typedef struct
{
glzTTType type;
float u_scale;
float v_scale;
float u_offset;
float v_offset;
unsigned int atlas_width;
unsigned int atlas_height;
glzAxis axis;
unsigned int firstatlas;
unsigned int *atlas;
glzOrigin origin;
} texture_transform;
typedef struct
{
glzPrimitive type;
glzMatrix matrix;
texture_transform tt;
float variation_1;
float variation_2;
unsigned int resolution_x;
unsigned int resolution_y;
unsigned int resolution_z;
} primitive_gen;
long glzPrimCubeverts(float *v, float *t, float *n);
void glzPrimCubeVector(vector<poly3> *pdata, int group, unsigned int sides);
image_geo_transform glzMakeIGT(glzIGTType type, unsigned int width, unsigned int height, unsigned int bpp, float x_offset, float y_offset, float z_offset, float scale, float tscale, glzAxis axis, unsigned char *data);
texture_transform glzMakeTT(glzTTType type, float u_scale, float v_scale, float u_offset, float v_offset, unsigned int atlas_width, unsigned int atlas_height, glzAxis axis, unsigned int firstatlas, unsigned int atlas[], glzOrigin origin);
texture_transform glzMakeTTDefault();
texture_transform glzMakeTTAtlas(unsigned int awidth, unsigned int aheight, unsigned int firstatlas, glzOrigin origin);
texture_transform glzMakeTTAtlasArray(unsigned int awidth, unsigned int aheight, unsigned int atlas[], glzOrigin origin);
texture_transform glzMakeTTAtlasCubeTBS(unsigned int awidth, unsigned int aheight, unsigned int firstatlas, glzOrigin origin);
texture_transform glzMakeTTAtlasCubeIndface(unsigned int awidth, unsigned int aheight, unsigned int firstatlas, glzOrigin origin);
texture_transform glzMakeTTAtlasCubeCross(unsigned int awidth, unsigned int aheight, unsigned int firstatlas, glzOrigin origin);
texture_transform glzMakeTTVertexCoordAdopt(float uscale, float vscale, glzAxis axis, glzOrigin origin);
primitive_gen glzMakePG(glzPrimitive type, glzMatrix matrix, texture_transform tt, float variation_1, float variation_2, unsigned int resolution_x, unsigned int resolution_y, unsigned int resolution_z);
primitive_gen glzMakePGDefault(glzPrimitive type);
primitive_gen glzMakePGDefaultMatrix(glzPrimitive type, glzMatrix matrix);
primitive_gen glzMakePGAtlas(glzPrimitive type, unsigned int awidth, unsigned int aheight, unsigned int firstatlas);
primitive_gen glzMakePGAtlasMatrix(glzPrimitive type, glzMatrix matrix, unsigned int awidth, unsigned int aheight, unsigned int firstatlas);
void glzIGT(float *vert, image_geo_transform igt, long num);
void glzIGT(vector<poly3> *pdata, int group, image_geo_transform igt);
void glzVert2TexcoordRescale(float *vert, float *tex, texture_transform tt, long num);
void glzVert2TexcoordRescale(vector<poly3> *pdata, int group, texture_transform tt);
long glzCountFromIndexArrays(long vert_face[], int enteries);
void glzVAOMakeFromArray(float v[], float t[], float n[], long enteties, unsigned int *vao, glzVAOType type);
void glzVAOMakeFromVector(vector<poly3> pdata, unsigned int *vao, glzVAOType type);
long glzConvertVectorToArray(float *v, float *t, float *n, vector<poly3> pdata);
void glzDirectPointArrayRender(float v[], float t[], int E);
void glzDirectCubeRender(float X, float Y, float Z, float W, float H, float D, texture_transform tt, unsigned int atlas); // does exactly you think it does
void glzKillVAO(unsigned int vao);
void glzKillAllVAO(void);
void glzDrawVAO(long enteties, unsigned int vao, unsigned int type);
void glzDrawVAO(long offset, long enteties, unsigned int vao, unsigned int type);
#endif /* __glz_geo__ */
/*
not implemented, is subject to change
// these two will output to a .vao file for later loading with glzVAOMakeFromFile, it will save the buffers and the vertexatrib indices as they are in the VAO, though not the names
glzVAOsave(char filename[255], long enteties, unsigned int vao[], unsigned int type);
glzVAOsaveRange(char filename[255], long offset, long enteties, unsigned int vao[], unsigned int type);
*/
|
/*
* Copyright (c) 2016, https://github.com/nebula-im
* 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.
*/
#ifndef CORE_CORE_API_H_
#define CORE_CORE_API_H_
#include <stdint.h>
#include <string>
#include <vector>
#include <map>
struct CoreXLogConfig {
// XLog
// int xlog_mode;
std::string xlog_dir;
std::string xlog_name_prefix;
// int xlog_enable_console;
};
struct CoreAppConfig {
CoreAppConfig()
: clinet_version(100),
uin(0) {
}
unsigned int clinet_version;
std::string app_filepath;
// AccoutInfo
int64_t uin;
std::string user_name;
// DeviceInfo
std::string device_name;
std::string device_type;
};
struct CoreStnConfig {
std::string longlink_hosts;
std::vector<uint16_t> longlink_ports;
std::string longlink_debugip;
std::vector<uint16_t> lowpriority_longlink_ports;
int shortlink_port;
std::string sg_shortlink_debugip;
std::string backup_host;
std::vector<std::string> backup_host_ips;
std::string backup_debugip;
};
struct CoreSdtConfig {
};
void CoreApi_Initialize(const CoreXLogConfig& xlog_config,
const CoreAppConfig& app_config,
const CoreStnConfig& stn_config,
const CoreSdtConfig& sdt_config);
void CoreApi_Run();
void CoreApi_Destrpy();
#endif
|
/*
* Copyright (C) 2017 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.
*/
#ifndef CORE_FILE_READER_H
#define CORE_FILE_READER_H
#include "stream_reader.h"
#include <stdio.h>
#include <stdint.h>
namespace core {
// FileReader is an implementation of the StreamReader interface that reads
// from binary files.
class FileReader : public StreamReader {
public:
FileReader(const char* path);
~FileReader();
// error returns an error string if the reader has encountered an error.
const char* error() const;
// read attempts to read max_size bytes to the pointer data, blocking until
// the data is available. Returns the number of bytes successfully read,
// which may be less than size if the stream was closed or there was an
// error.
virtual uint64_t read(void* data, uint64_t max_size);
// size returns the number of bytes in the underlying file.
uint64_t size();
private:
FILE* mFile;
};
} // namespace core
#endif // CORE_STREAM_READER_H
|
// Copyright 2021 The IREE Authors
//
// Licensed under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include "iree/hal/vmvx/registration/driver_module_sync.h"
#include <inttypes.h>
#include <stddef.h>
#include "iree/base/api.h"
#include "iree/hal/local/executable_loader.h"
#include "iree/hal/local/loaders/vmvx_module_loader.h"
#include "iree/hal/local/sync_device.h"
#include "iree/hal/local/sync_driver.h"
#include "iree/vm/api.h"
// TODO(#4298): remove this driver registration and wrapper.
// TODO(benvanik): replace with C flags.
#define IREE_HAL_VMVX_WORKER_COUNT 0
#define IREE_HAL_MAX_VMVX_WORKER_COUNT 16
#define IREE_HAL_VMVX_SYNC_DRIVER_ID 0x53564D58u // SVMX
static iree_status_t iree_hal_vmvx_sync_driver_factory_enumerate(
void* self, const iree_hal_driver_info_t** out_driver_infos,
iree_host_size_t* out_driver_info_count) {
static const iree_hal_driver_info_t driver_infos[1] = {
{
.driver_id = IREE_HAL_VMVX_SYNC_DRIVER_ID,
.driver_name = iree_string_view_literal("vmvx-sync"),
.full_name = iree_string_view_literal(
"synchronous VM-based reference backend"),
},
};
*out_driver_info_count = IREE_ARRAYSIZE(driver_infos);
*out_driver_infos = driver_infos;
return iree_ok_status();
}
static iree_status_t iree_hal_vmvx_sync_driver_factory_try_create(
void* self, iree_hal_driver_id_t driver_id, iree_allocator_t host_allocator,
iree_hal_driver_t** out_driver) {
if (driver_id != IREE_HAL_VMVX_SYNC_DRIVER_ID) {
return iree_make_status(IREE_STATUS_UNAVAILABLE,
"no driver with ID %016" PRIu64
" is provided by this factory",
driver_id);
}
iree_vm_instance_t* instance = NULL;
IREE_RETURN_IF_ERROR(iree_vm_instance_create(host_allocator, &instance));
iree_hal_executable_loader_t* vmvx_loader = NULL;
iree_status_t status = iree_hal_vmvx_module_loader_create(
instance, host_allocator, &vmvx_loader);
iree_hal_executable_loader_t* loaders[1] = {vmvx_loader};
iree_hal_allocator_t* device_allocator = NULL;
if (iree_status_is_ok(status)) {
status = iree_hal_allocator_create_heap(iree_make_cstring_view("vmvx"),
host_allocator, host_allocator,
&device_allocator);
}
// Set parameters for the device created in the next step.
iree_hal_sync_device_params_t default_params;
iree_hal_sync_device_params_initialize(&default_params);
if (iree_status_is_ok(status)) {
status = iree_hal_sync_driver_create(
iree_make_cstring_view("vmvx"), &default_params,
IREE_ARRAYSIZE(loaders), loaders, device_allocator, host_allocator,
out_driver);
}
iree_hal_allocator_release(device_allocator);
iree_hal_executable_loader_release(vmvx_loader);
iree_vm_instance_release(instance);
return status;
}
IREE_API_EXPORT iree_status_t iree_hal_vmvx_sync_driver_module_register(
iree_hal_driver_registry_t* registry) {
static const iree_hal_driver_factory_t factory = {
.self = NULL,
.enumerate = iree_hal_vmvx_sync_driver_factory_enumerate,
.try_create = iree_hal_vmvx_sync_driver_factory_try_create,
};
return iree_hal_driver_registry_register_factory(registry, &factory);
}
|
/////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2009-2011 Alan Wright. All rights reserved.
// Distributable under the terms of either the Apache License (Version 2.0)
// or the GNU Lesser General Public License.
/////////////////////////////////////////////////////////////////////////////
#ifndef STOREDFIELDSWRITER_H
#define STOREDFIELDSWRITER_H
#include "DocumentsWriter.h"
namespace Lucene
{
/// This is a DocFieldConsumer that writes stored fields.
class StoredFieldsWriter : public LuceneObject
{
public:
StoredFieldsWriter(DocumentsWriterPtr docWriter, FieldInfosPtr fieldInfos);
virtual ~StoredFieldsWriter();
LUCENE_CLASS(StoredFieldsWriter);
public:
FieldsWriterPtr fieldsWriter;
DocumentsWriterWeakPtr _docWriter;
FieldInfosPtr fieldInfos;
int32_t lastDocID;
Collection<StoredFieldsWriterPerDocPtr> docFreeList;
int32_t freeCount;
int32_t allocCount;
public:
StoredFieldsWriterPerThreadPtr addThread(DocStatePtr docState);
void flush(SegmentWriteStatePtr state);
void closeDocStore(SegmentWriteStatePtr state);
StoredFieldsWriterPerDocPtr getPerDoc();
void abort();
/// Fills in any hole in the docIDs
void fill(int32_t docID);
void finishDocument(StoredFieldsWriterPerDocPtr perDoc);
bool freeRAM();
void free(StoredFieldsWriterPerDocPtr perDoc);
protected:
void initFieldsWriter();
};
class StoredFieldsWriterPerDoc : public DocWriter
{
public:
StoredFieldsWriterPerDoc(StoredFieldsWriterPtr fieldsWriter);
virtual ~StoredFieldsWriterPerDoc();
LUCENE_CLASS(StoredFieldsWriterPerDoc);
protected:
StoredFieldsWriterWeakPtr _fieldsWriter;
public:
PerDocBufferPtr buffer;
RAMOutputStreamPtr fdt;
int32_t numStoredFields;
public:
void reset();
virtual void abort();
virtual int64_t sizeInBytes();
virtual void finish();
};
}
#endif
|
/*
* Copyright 2022 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
*
* 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 FIRESTORE_CORE_TEST_UNIT_LOCAL_DOCUMENT_OVERLAY_CACHE_TEST_H_
#define FIRESTORE_CORE_TEST_UNIT_LOCAL_DOCUMENT_OVERLAY_CACHE_TEST_H_
#include <memory>
#include <string>
#include <vector>
#include "gtest/gtest.h"
namespace firebase {
namespace firestore {
namespace model {
class Mutation;
} // namespace model
namespace local {
class DocumentOverlayCache;
class Persistence;
using FactoryFunc = std::unique_ptr<Persistence> (*)();
/**
* A test fixture for implementing tests of the DocumentOverlayCache interface.
*
* This is separate from DocumentOverlayCacheTest below in order to make
* additional implementation-specific tests.
*/
class DocumentOverlayCacheTestBase : public testing::Test {
public:
explicit DocumentOverlayCacheTestBase(
std::unique_ptr<Persistence> persistence);
protected:
void SaveOverlaysWithMutations(int largest_batch_id,
const std::vector<model::Mutation>& mutations);
void SaveOverlaysWithSetMutations(int largest_batch_id,
const std::vector<std::string>& keys);
void ExpectCacheContainsOverlaysFor(const std::vector<std::string>& keys);
void ExpectCacheDoesNotContainOverlaysFor(
const std::vector<std::string>& keys);
int GetOverlayCount() const;
std::unique_ptr<Persistence> persistence_;
DocumentOverlayCache* cache_ = nullptr;
};
/**
* These are tests for any implementation of the DocumentOverlayCache interface.
*
* To test a specific implementation of DocumentOverlayCache:
*
* + Write a persistence factory function
* + Call INSTANTIATE_TEST_SUITE_P(MyNewDocumentOverlayCacheTest,
* DocumentOverlayCacheTest,
* testing::Values(PersistenceFactory));
*/
class DocumentOverlayCacheTest
: public DocumentOverlayCacheTestBase,
public testing::WithParamInterface<FactoryFunc> {
public:
// `GetParam()` must return a factory function.
DocumentOverlayCacheTest();
};
} // namespace local
} // namespace firestore
} // namespace firebase
#endif // FIRESTORE_CORE_TEST_UNIT_LOCAL_DOCUMENT_OVERLAY_CACHE_TEST_H_
|
//
// MyAddViewController.h
// 18_我的通讯录
//
// Created by wxhl on 16-4-23.
// Copyright (c) 2016年 wxhl. All rights reserved.
//
#import <UIKit/UIKit.h>
@class MyMainModel;
typedef void(^MyAddViewControllerBlock)(MyMainModel *myModel);
@interface MyAddViewController : UIViewController
@property (nonatomic, strong)MyAddViewControllerBlock block;
@end
|
#include <stdlib.h>
#include <list>
#include <string>
#include "gtest/gtest.h"
#include "boost/filesystem.hpp"
#include "common/s3util.h"
#include "rocksdb/db.h"
#include "rocksdb/sst_file_writer.h"
using boost::filesystem::remove_all;
using rocksdb::EnvOptions;
using rocksdb::Logger;
using rocksdb::Options;
using rocksdb::SstFileWriter;
using std::list;
using std::pair;
using std::string;
void createSstWithContent(const string& sst_filename,
list<pair<string, string>>& key_vals) {
EXPECT_NO_THROW(remove_all(sst_filename));
Options options;
SstFileWriter sst_file_writer(EnvOptions(), options, options.comparator);
auto s = sst_file_writer.Open(sst_filename);
EXPECT_TRUE(s.ok());
list<pair<string, string>>::iterator it;
for (it = key_vals.begin(); it != key_vals.end(); ++it) {
s = sst_file_writer.Put(it->first, it->second);
EXPECT_TRUE(s.ok());
}
s = sst_file_writer.Finish();
EXPECT_TRUE(s.ok());
}
void putObjectFromLocalToS3(const string& local_absolute_path,
const string& s3_bucket,
const string& s3_fullpath) {
std::shared_ptr<common::S3Util> s3_util =
common::S3Util::BuildS3Util(50, s3_bucket);
auto copy_resp = s3_util->putObject(s3_fullpath, local_absolute_path);
ASSERT_TRUE(copy_resp.Error().empty())
<< "Error happened when uploading files to S3: " + copy_resp.Error();
}
|
//
// ActionSheetPickerDelegate.h
// ActionSheetPicker
//
// Created by on 13/03/2012.
// Copyright (c) 2012 Club 15CC. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AbstractActionSheetPicker.h"
@protocol ActionSheetCustomPickerDelegate <UIPickerViewDelegate, UIPickerViewDataSource>
@optional
/**
Allow the delegate to override default settings for the picker
Allows for instance, ability to set separate delegates and data sources as well as GUI settings on the UIPickerView
If not defined and explicily overridden then this class will be the delegate and dataSource.
*/
- (void)actionSheetPicker:(AbstractActionSheetPicker *)actionSheetPicker configurePickerView:(UIPickerView *)pickerView;
/**
Success callback
\param actionSheetPicker .pickerView property accesses the picker. Requires a cast to UIView subclass for the picker
\param origin The entity which launched the ActionSheetPicker
*/
- (void)actionSheetPickerDidSucceed:(AbstractActionSheetPicker *)actionSheetPicker origin:(id)origin;
/** Cancel callback. See actionSheetPickerDidSuccess:origin: */
- (void)actionSheetPickerDidCancel:(AbstractActionSheetPicker *)actionSheetPicker origin:(id)origin;
@required
@end
|
#ifndef __ENTITY_H__
#define __ENTITY_H__
#include <map>
#include <sstream>
#include <string>
#include "netlicensing/datatypes.h"
namespace netlicensing {
class BaseEntity {
private:
String_t number_i;
Boolean_t active_i = true;
std::map<std::string, String_t> properties_i;
public:
void setNumber(const String_t& number) {
number_i = number;
}
const String_t& getNumber() const {
return number_i;
}
void setActive(Boolean_t active) {
active_i = active;
}
Boolean_t getActive() const {
return active_i;
}
// Methods for working with custom properties
const std::map<std::string, String_t>& getProperties() const {
return properties_i;
}
void addProperty(const std::string& property, String_t value) {
properties_i[property] = value;
}
void removeProperty(const std::string& property) {
properties_i.erase(property);
}
};
}
#endif //__ENTITY_H__
|
//
// Generated by the J2ObjC translator. DO NOT EDIT!
// source: /Volumes/Personal/Documents/raspi-config/client-framework/build/j2oSources/com/google/common/io/Flushables.java
//
#include "J2ObjC_header.h"
#pragma push_macro("INCLUDE_ALL_ComGoogleCommonIoFlushables")
#ifdef RESTRICT_ComGoogleCommonIoFlushables
#define INCLUDE_ALL_ComGoogleCommonIoFlushables 0
#else
#define INCLUDE_ALL_ComGoogleCommonIoFlushables 1
#endif
#undef RESTRICT_ComGoogleCommonIoFlushables
#if __has_feature(nullability)
#pragma clang diagnostic push
#pragma GCC diagnostic ignored "-Wnullability-completeness"
#endif
#if !defined (ComGoogleCommonIoFlushables_) && (INCLUDE_ALL_ComGoogleCommonIoFlushables || defined(INCLUDE_ComGoogleCommonIoFlushables))
#define ComGoogleCommonIoFlushables_
@protocol JavaIoFlushable;
@interface ComGoogleCommonIoFlushables : NSObject
#pragma mark Public
+ (void)flushWithJavaIoFlushable:(id<JavaIoFlushable>)flushable
withBoolean:(jboolean)swallowIOException;
+ (void)flushQuietlyWithJavaIoFlushable:(id<JavaIoFlushable>)flushable;
@end
J2OBJC_STATIC_INIT(ComGoogleCommonIoFlushables)
FOUNDATION_EXPORT void ComGoogleCommonIoFlushables_flushWithJavaIoFlushable_withBoolean_(id<JavaIoFlushable> flushable, jboolean swallowIOException);
FOUNDATION_EXPORT void ComGoogleCommonIoFlushables_flushQuietlyWithJavaIoFlushable_(id<JavaIoFlushable> flushable);
J2OBJC_TYPE_LITERAL_HEADER(ComGoogleCommonIoFlushables)
#endif
#if __has_feature(nullability)
#pragma clang diagnostic pop
#endif
#pragma pop_macro("INCLUDE_ALL_ComGoogleCommonIoFlushables")
|
#include <stdio.h>
void drop_privs(const char *dir, const char *name)
{
fprintf(stderr, "WARNING: Cannot drop privileges!");
}
|
/**
* @file
* @brief Serial driver for x86 (compatible with 16550)
*
* @date 12.04.10
* @author Nikolay Korotky
*/
#include <stdint.h>
#include <asm/io.h>
#include <drivers/diag.h>
#include <drivers/serial/8250.h>
#include <drivers/uart_device.h>
#include <drivers/serial/diag.h>
#include <embox/unit.h>
EMBOX_UNIT_INIT(uart_init);
/** Default I/O addresses
* NOTE: The actual I/O addresses used are stored
* in a table in the BIOS data area 0000:0400.
*/
#define COM0_PORT_BASE 0x3f8
#define COM0_IRQ_NUM 0x4
static uint8_t calc_line_stat(const struct uart_params *params) {
uint8_t line_stat;
line_stat = 0;
if(0 == params->parity) {
line_stat |= UART_NO_PARITY;
}
if(8 == params->n_bits) {
line_stat |= UART_8BITS_WORD;
}
if(1 == params->n_stop) {
line_stat |= UART_1_STOP_BIT;
}
return line_stat;
}
static int i8250_setup(struct uart *dev, const struct uart_params *params) {
uint8_t line_stat;
line_stat = calc_line_stat(params);
line_stat = UART_NO_PARITY | UART_8BITS_WORD | UART_1_STOP_BIT;
/* Turn off the interrupt */
out8(0x0, dev->base_addr + UART_IER);
/* Set DLAB */
out8(UART_DLAB, dev->base_addr + UART_LCR);
/* Set the baud rate */
out8(DIVISOR(params->baud_rate) & 0xFF, dev->base_addr + UART_DLL);
out8((DIVISOR(params->baud_rate) >> 8) & 0xFF, dev->base_addr + UART_DLH);
/* Set the line status */
out8(line_stat, dev->base_addr + UART_LCR);
/* Uart enable FIFO */
out8(UART_ENABLE_FIFO, dev->base_addr + UART_FCR);
/* Uart enable modem (turn on DTR, RTS, and OUT2) */
out8(UART_ENABLE_MODEM, dev->base_addr + UART_MCR);
/*enable rx interrupt*/
if (params->irq) {
/*enable rx interrupt*/
out8(UART_IER_RX_ENABLE, dev->base_addr + UART_IER);
}
return 0;
}
static int i8250_putc(struct uart *dev, int ch) {
while (!(in8(dev->base_addr + UART_LSR) & UART_EMPTY_TX));
out8((uint8_t) ch, dev->base_addr + UART_TX);
return 0;
}
static int i8250_has_symbol(struct uart *dev) {
return in8(dev->base_addr + UART_LSR) & UART_DATA_READY;
}
static int i8250_getc(struct uart *dev) {
return in8(dev->base_addr + UART_RX);
}
static const struct uart_ops i8250_uart_ops = {
.uart_getc = i8250_getc,
.uart_putc = i8250_putc,
.uart_hasrx = i8250_has_symbol,
.uart_setup = i8250_setup,
};
static struct uart uart0 = {
.uart_ops = &i8250_uart_ops,
.irq_num = COM0_IRQ_NUM,
.base_addr = COM0_PORT_BASE,
};
static const struct uart_params uart_defparams = {
.baud_rate = OPTION_GET(NUMBER,baud_rate),
.parity = 0,
.n_stop = 1,
.n_bits = 8,
.irq = true,
};
static const struct uart_params uart_diag_params = {
.baud_rate = OPTION_GET(NUMBER,baud_rate),
.parity = 0,
.n_stop = 1,
.n_bits = 8,
.irq = false,
};
const struct uart_diag DIAG_IMPL_NAME(__EMBUILD_MOD__) = {
.diag = {
.ops = &uart_diag_ops,
},
.uart = &uart0,
.params = &uart_diag_params,
};
static int uart_init(void) {
return uart_register(&uart0, &uart_defparams);
}
|
/*
Copyright (c) 2014, J.D. Koftinoff Software, Ltd.
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.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "avdecc-cmd.h"
#include "adp-cmd.h"
#include "adp.h"
void adp_print( FILE *s, const struct jdksavdecc_frame *frame, const struct jdksavdecc_adpdu *adpdu )
{
struct jdksavdecc_printer p;
char buf[10240];
jdksavdecc_printer_init( &p, buf, sizeof( buf ) );
avdecc_cmd_print_frame_header( &p, frame );
jdksavdecc_adpdu_print( &p, adpdu );
fprintf( s, "%s", buf );
}
int adp_process( const void *request_, struct raw_context *net, const struct jdksavdecc_frame *frame )
{
const struct jdksavdecc_adpdu *request = (const struct jdksavdecc_adpdu *)request_;
struct jdksavdecc_adpdu adpdu;
(void)net;
if ( adp_check( frame, &adpdu, &request->header.entity_id ) == 0 )
{
fprintf( stdout, "Received ADPDU:\n" );
adp_print( stdout, frame, &adpdu );
fprintf( stdout, "\n" );
}
return 0;
}
int adp( struct raw_context *net, struct jdksavdecc_frame *frame, int argc, char **argv )
{
int r = 1;
struct jdksavdecc_eui64 entity_id;
struct jdksavdecc_adpdu adpdu;
bzero( &entity_id, sizeof( entity_id ) );
bzero( &adpdu, sizeof( adpdu ) );
uint16_t message_type_code;
if ( argc > 4 )
{
arg_entity_id = argv[4];
if ( *arg_entity_id == 0 )
{
arg_entity_id = 0;
}
}
if ( jdksavdecc_get_uint16_value_for_name( jdksavdecc_adpdu_print_message_type, arg_message_type, &message_type_code ) )
{
if ( arg_entity_id )
{
if ( !jdksavdecc_eui64_init_from_cstr( &entity_id, arg_entity_id ) )
{
fprintf( stderr, "ADP: invalid entity_id: '%s'\n", arg_entity_id );
return 1;
}
}
if ( adp_form_msg( frame, &adpdu, message_type_code, entity_id ) == 0 )
{
if ( raw_send( net, frame->dest_address.value, frame->payload, frame->length ) > 0 )
{
if ( arg_verbose > 0 )
{
fprintf( stdout, "Sent:\n" );
adp_print( stdout, frame, &adpdu );
if ( arg_verbose > 1 )
{
avdecc_cmd_print_frame_payload( stdout, frame );
}
}
r = 0;
avdecc_cmd_process_incoming_raw( &adpdu, net, arg_time_in_ms_to_wait, adp_process );
}
}
else
{
fprintf( stderr, "avdecc: unable to form adp message\n" );
}
}
else
{
struct jdksavdecc_uint16_name *name = jdksavdecc_adpdu_print_message_type;
fprintf( stdout, "ADP message type options:\n" );
while ( name->name )
{
fprintf( stdout, "\t0x%04x %s\n", name->value, name->name );
name++;
}
}
return r;
}
|
/*********************************************************************************
*
* Inviwo - Interactive Visualization Workshop
*
* Copyright (c) 2014-2021 Inviwo Foundation
* 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 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.
*
*********************************************************************************/
#pragma once
#include <modules/hdf5/hdf5moduledefine.h>
#include <inviwo/core/properties/optionproperty.h>
#include <inviwo/core/processors/processor.h>
#include <modules/hdf5/ports/hdf5port.h>
#include <modules/hdf5/hdf5utils.h>
#include <warn/push>
#include <warn/ignore/all>
#include <H5Cpp.h>
#include <warn/pop>
namespace inviwo {
namespace hdf5 {
/** \docpage{org.inviwo.HDFPathSelection, HDF Path Selection}
* 
*
* ...
*
* ### Inports
* * __inport__ A HDF5 file handle
*
* ### Outports
* * __outport__ A HDF5 file handle
*
* ### Properties
* * __Select Group__ The subgroup to output
*
*/
class IVW_MODULE_HDF5_API PathSelection : public Processor {
public:
PathSelection();
virtual ~PathSelection() = default;
virtual const ProcessorInfo getProcessorInfo() const override;
static const ProcessorInfo processorInfo_;
protected:
virtual void process() override;
private:
void onDataChange();
Inport inport_;
Outport outport_;
OptionPropertyString selection_;
};
} // namespace hdf5
} // namespace inviwo
|
// Copyright (c) 2020 The Orbit Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ORBIT_BASE_UNIQUE_RESOURCE_H_
#define ORBIT_BASE_UNIQUE_RESOURCE_H_
#include <functional>
#include <optional>
namespace orbit_base {
/* unique_resource helps to manage a unique identity which is not a pointer,
so unique_ptr cannot be used. Typical examples are file or window handles
from C libraries. The resource (handle) is typically small and trivially
copyable, but that's not required. Though we require it to be
moveable.
Unlike unique_ptr this resource requires you to provide a Deleter type.
No default deleter exists.
Empty base class optimization for Deleter is not implemented (yet).
*/
template <typename Resource_, typename Deleter_>
class unique_resource {
public:
using Resource = Resource_;
using Deleter = Deleter_;
constexpr unique_resource() = default;
constexpr unique_resource(Resource resource, Deleter deleter = Deleter{})
: resource_(std::move(resource)), deleter_(std::move(deleter)) {}
unique_resource(const unique_resource&) = delete;
unique_resource& operator=(const unique_resource&) = delete;
unique_resource(unique_resource&& other)
: resource_(std::move(other.resource_)), deleter_(std::move(other.deleter_)) {
other.resource_ = std::nullopt;
}
unique_resource& operator=(unique_resource&& other) {
if (&other != this) {
RunDeleter();
get_deleter() = std::move(other.get_deleter());
resource_ = std::move(other.resource_);
other.resource_ = std::nullopt;
}
return *this;
}
~unique_resource() { RunDeleter(); }
Resource get() const { return resource_.value(); }
Deleter& get_deleter() { return deleter_; }
const Deleter& get_deleter() const { return deleter_; }
void release() { resource_ = std::nullopt; }
explicit operator bool() const { return resource_.has_value(); }
void reset(Resource resource) {
RunDeleter();
resource_ = std::move(resource);
}
private:
void RunDeleter() {
if (resource_) {
std::invoke(get_deleter(), resource_.value());
}
}
std::optional<Resource> resource_;
Deleter deleter_;
};
template <typename Resource, typename Deleter>
unique_resource(Resource, Deleter)
->unique_resource<std::decay_t<Resource>, std::remove_cv_t<Deleter>>;
} // namespace orbit_base
#endif // ORBIT_BASE_UNIQUE_RESOURCE_H_
|
/*************************************************************************
* Copyright (c) 2015, Synopsys, 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*************************************************************************/
// FunctionActions.h: interface for the CFunctionActions class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_FUNCTIONACTIONS_H__D8E1D89D_75B4_4855_8679_7A5F3E085D03__INCLUDED_)
#define AFX_FUNCTIONACTIONS_H__D8E1D89D_75B4_4855_8679_7A5F3E085D03__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "ImpactActionsSet.h"
class CFunctionActions : public CImpactActionsSet
{
public:
CFunctionActions(CString& language,CImpactCtrl* pCtrl);
virtual ~CFunctionActions();
};
#endif // !defined(AFX_FUNCTIONACTIONS_H__D8E1D89D_75B4_4855_8679_7A5F3E085D03__INCLUDED_)
|
/*************************************************************************
* Copyright (c) 2015, Synopsys, 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*************************************************************************/
#ifndef _merge_dialog_h
// file merge_dialog.h
// define some declarations for merge
#define _merge_dialog_h
#define BASE_FILE "Base File:"
#define MY_BRANCH "My Branch:"
#define OTHER_BRANCH "Other Branch:"
extern int merge_change_title_flag;
extern int merge_in_process();
extern void merge_dialog();
extern int merge_file_type(char const *file);
// type == 0 from paraset
// type == 1 form -batch mode
extern int merge_2_files(char *file1, char *file2, char type, char unload_flag, int &do_not_save_flag);
extern int being_merged(app *cur);
extern int get_cmt_idx(char *cmt);
extern "C" void merge_3_files(char *fn_base, char *fn, char *fn_other, char *rev0, char *rev);
extern void merge_3f_prev();
extern void merge_3f_curr();
extern void merge_3f_next();
extern void merge_3f_done();
extern void merge_3f_cancel();
extern void merge_3f_status();
extern void merge_3f_set_travel_only_conflict(int f);
extern int merge_3f_get_travel_only_conflict();
extern int merge_3f_get_conflict_num();
#endif
/*
$Log: merge_dialog.h $
Revision 1.3 1994/09/16 18:34:41EDT so
Bug track: n/a
fix for adac
// Revision 1.9 1993/12/19 16:58:47 so
// Bug track: 5726, 5337
// fix bug 5726 and part of 5337
//
// Revision 1.8 1993/12/17 14:43:02 so
// Bug track: 5688
// fix bug 5688
//
// Revision 1.7 1993/12/16 19:56:38 so
// Bug track: n/a
// move some static functions to be the member functions of class merge_info
//
// Revision 1.6 1993/11/30 21:22:26 so
// Bug track: n/a
// add help text button
// do not unload the file which is being merged
//
// Revision 1.5 1993/11/27 15:32:56 so
// Bug track: 5337
// fix part of bug 5337
// It could not unload the file which is in the process of merging.
//
// Revision 1.4 1993/11/11 16:04:50 so
// Bug track: 5186 5211
// fix bug 5186 5211
//
// Revision 1.3 1993/11/06 22:16:08 so
// Bug track: n/a
// merge project
//
// Revision 1.2 1993/08/04 17:56:30 so
// add "$Log: merge_dialog.h $
// add "Revision 1.3 1994/09/16 18:34:41EDT so
// add "Bug track: n/a
// add "fix for adac
// Revision 1.9 1993/12/19 16:58:47 so
// Bug track: 5726, 5337
// fix bug 5726 and part of 5337
//
// Revision 1.8 1993/12/17 14:43:02 so
// Bug track: 5688
// fix bug 5688
//
// Revision 1.7 1993/12/16 19:56:38 so
// Bug track: n/a
// move some static functions to be the member functions of class merge_info
//
// Revision 1.6 1993/11/30 21:22:26 so
// Bug track: n/a
// add help text button
// do not unload the file which is being merged
//
// Revision 1.5 1993/11/27 15:32:56 so
// Bug track: 5337
// fix part of bug 5337
// It could not unload the file which is in the process of merging.
//
// Revision 1.4 1993/11/11 16:04:50 so
// Bug track: 5186 5211
// fix bug 5186 5211
//
// Revision 1.3 1993/11/06 22:16:08 so
// Bug track: n/a
// merge project
//"
//
*/
|
#ifndef QUEUE_H
#define QUEUE_H
#include <GASPI.h>
void wait_for_queue_entries_for_read_notify (gaspi_queue_id_t*);
void wait_for_queue_entries_for_write_notify (gaspi_queue_id_t*);
void wait_for_queue_entries_for_notify (gaspi_queue_id_t*);
void wait_for_queue_max_half (gaspi_queue_id_t*);
void wait_for_flush_queues();
#endif
|
#include<stdio.h>
// define directive
#define CHOICE 500
#define ANOTHERCHOICE 600
#define AGAINCHOICE
int my_int = 0;
// unsigned integer type, platform dependent
// it can be 16, 32 or 64 bits,
size_t x = 0;
// if, else, endif directives
// conditional compilation
#if (CHOICE == 500)
void set_my_int() {
my_int = 23;
}
#else
void set_my_int() {
my_int = 17;
}
#endif
/* #if defined and ifdef are equivalent */
/* #ifndef and if !defined are equivalent */
// if ANOTHERCHOICE is defined, whatever its value
#ifndef ANOTHERCHOICE
void set_x() {
x = 12;
}
#else
void set_x() {
x = 13;
}
#endif
// will abort compilation if AGAINCHOICE not defined
#ifdef AGAINCHOICE
# define DEBUG(x) do {;}
#else
# error you need AGAINCHOICE to run this code
#endif
int main() {
set_my_int();
printf("%d\n", my_int);
set_x();
// %zu to format size_t type
printf("%zu\n", x);
// sizeof function return size_t type
printf("x is %zu bytes\n", sizeof(x));
return 0;
}
|
#ifndef V2_ENCDEC_H
#define V2_ENCDEC_H
#include "file_segment_ptr.h"
#include "dictionary.h"
#include "xdr_primitives.h"
#include "fwd.h"
#include "encdec_ctx.h"
#include "bitset.h"
#include <monsoon/history/dir/dirhistory_export_.h>
#include <monsoon/xdr/xdr.h>
#include <monsoon/xdr/xdr_stream.h>
#include <monsoon/time_point.h>
#include <monsoon/memoid.h>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <vector>
#include <unordered_map>
#include <monsoon/histogram.h>
#include <monsoon/tags.h>
#include <monsoon/group_name.h>
#include <monsoon/metric_value.h>
#include <monsoon/time_series_value.h>
#include <monsoon/time_series.h>
#include <monsoon/io/fd.h>
#include <monsoon/io/ptr_stream.h>
#include <monsoon/io/stream.h>
#include <mutex>
#include <memory>
namespace monsoon {
namespace history {
namespace v2 {
class monsoon_dirhistory_local_ encdec_writer {
public:
class xdr_writer;
encdec_writer() = delete;
encdec_writer(const encdec_writer&) = delete;
encdec_writer& operator=(const encdec_writer&) = delete;
encdec_writer(const encdec_ctx&, io::fd::offset_type);
const encdec_ctx& ctx() const noexcept { return ctx_; }
xdr_writer begin(bool = true);
io::fd::offset_type offset() const noexcept { return off_; }
private:
file_segment_ptr commit(const std::uint8_t*, std::size_t, bool);
io::fd::offset_type off_;
encdec_ctx ctx_;
};
class monsoon_dirhistory_local_ encdec_writer::xdr_writer
: public xdr::xdr_ostream
{
public:
xdr_writer() = default;
xdr_writer(const xdr_writer&) = delete;
xdr_writer& operator=(const xdr_writer&) = delete;
xdr_writer(xdr_writer&&) noexcept;
xdr_writer& operator=(xdr_writer&&) noexcept;
xdr_writer(encdec_writer&, bool) noexcept;
~xdr_writer() noexcept;
void close() override;
file_segment_ptr ptr() const noexcept;
private:
void put_raw_bytes(const void*, std::size_t) override;
std::vector<std::uint8_t> buffer_;
encdec_writer* ecw_ = nullptr;
bool compress_;
file_segment_ptr ptr_;
bool closed_ = false;
};
/*
* Pointer to file segment.
*
* A file segment is a block in the file.
* It starts at the given 'offset' (bytes from begin for file).
* The file segment contains 'len' bytes of data.
* If the compress bit is specified, this data will be the length after compression.
*
* Following the data, between 0 and 3 padding bytes will exist, such that:
* (padlen + 'len') % 4 == 0
*
* After the padding, a 4 byte CRC32 is written in BIG ENDIAN (xdr int).
* The CRC32 is calculated over the data and the padding bytes.
*/
template<typename T>
class monsoon_dirhistory_local_ [[deprecated]] file_segment {
public:
using offset_type = file_segment_ptr::offset_type;
using size_type = file_segment_ptr::size_type;
file_segment() noexcept;
file_segment(const file_segment&) = delete;
file_segment(file_segment&&) noexcept;
file_segment& operator=(const file_segment&) = delete;
file_segment& operator=(file_segment&&) noexcept;
file_segment(const encdec_ctx&, file_segment_ptr,
std::function<std::shared_ptr<T> (xdr::xdr_istream&)>&&, bool = true) noexcept;
std::shared_ptr<const T> get() const;
const encdec_ctx& ctx() const noexcept { return ctx_; }
const file_segment_ptr& file_ptr() const { return ptr_; }
void update_addr(file_segment_ptr) noexcept;
private:
file_segment_ptr ptr_;
encdec_ctx ctx_;
std::function<std::shared_ptr<T> (xdr::xdr_istream&)> decoder_;
bool enable_compression_;
mutable std::mutex lck_;
mutable std::weak_ptr<const T> decode_result_;
};
/** The TSData structure of the 'list' implementation. */
class monsoon_dirhistory_local_ [[deprecated]] tsdata_list
: public std::enable_shared_from_this<tsdata_list>
{
public:
using record_array = std::unordered_map<
group_name,
file_segment<time_series_value::metric_map>>;
tsdata_list() = default;
tsdata_list(tsdata_list&&) = delete;
tsdata_list& operator=(tsdata_list&&) = delete;
tsdata_list(
const encdec_ctx&,
time_point ts,
std::optional<file_segment_ptr> pred,
std::optional<file_segment_ptr> dd,
file_segment_ptr records,
std::uint32_t reserved) noexcept;
~tsdata_list() noexcept;
time_point ts() const { return ts_; }
std::shared_ptr<tsdata_list> pred() const;
std::shared_ptr<record_array> records(const dictionary_delta&) const;
std::shared_ptr<dictionary_delta> dictionary() const;
private:
time_point ts_;
std::optional<file_segment_ptr> pred_;
std::optional<file_segment_ptr> dd_;
file_segment_ptr records_;
std::uint32_t reserved_;
mutable std::weak_ptr<tsdata_list> cached_pred_;
mutable std::weak_ptr<record_array> cached_records_;
mutable std::mutex lock_;
const encdec_ctx ctx_;
};
[[deprecated]]
monsoon_dirhistory_local_
auto decode_record_metrics(xdr::xdr_istream&, const dictionary_delta&)
-> std::shared_ptr<time_series_value::metric_map>;
[[deprecated]]
monsoon_dirhistory_local_
file_segment_ptr encode_record_metrics(encdec_writer&,
const time_series_value::metric_map&,
dictionary_delta&);
[[deprecated]]
monsoon_dirhistory_local_
auto decode_record_array(xdr::xdr_istream&, const encdec_ctx&,
const dictionary_delta&)
-> std::shared_ptr<tsdata_list::record_array>;
[[deprecated]]
monsoon_dirhistory_local_
file_segment_ptr encode_record_array(encdec_writer&,
const time_series::tsv_set&, dictionary_delta&);
[[deprecated]]
monsoon_dirhistory_local_
auto decode_tsdata(xdr::xdr_istream&, const encdec_ctx&)
-> std::shared_ptr<tsdata_list>;
[[deprecated]]
monsoon_dirhistory_local_
auto encode_tsdata(encdec_writer&, const time_series&, dictionary_delta,
std::optional<file_segment_ptr>)
-> file_segment_ptr;
}}} /* namespace monsoon::history::v2 */
#include "encdec-inl.h"
#endif /* V2_ENCDEC_H */
|
/* @LICENSE(MUSLC_MIT) */
#define _GNU_SOURCE
#include <math.h>
double significand(double x)
{
return scalbn(x, -ilogb(x));
}
|
//
// PLYLostPasswordViewController.h
// PL
//
// Created by Oliver Drobnik on 28/07/14.
// Copyright (c) 2014 Cocoanetics. All rights reserved.
//
@class PLYLostPasswordViewController, PLYTextField, PLYUser;
/**
Protocol for informing a delegate about the result of a user requesting for his password to be reset.
*/
@protocol PLYLostPasswordViewControllerDelegate <NSObject>
@optional
/**
Called if the server reported that the user account with the entered email address existed and a new password was sent
@param lostPasswordViewController The view controller sending the message
@param user The `PLYUser` for which a new password was requested
*/
- (void)lostPasswordViewController:(PLYLostPasswordViewController *)lostPasswordViewController didRequestNewPasswordForUser:(PLYUser *)user;
@end
/**
View Controller for requesting a new password to be sent to a ProductLayer user
*/
@interface PLYLostPasswordViewController : UIViewController
/**
@name Properties
*/
/**
Text field for entering the email address
*/
@property (nonatomic, strong) PLYTextField *emailField;
/**
Delegate to inform about result of the lost password dialog
*/
@property (nonatomic, weak) id <PLYLostPasswordViewControllerDelegate> delegate;
@end
|
../../../JSQMessagesViewController/JSQMessagesViewController/Model/JSQMessageMediaData.h
|
// Copyright (c) 2015, LKC Technologies, 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. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
// HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdio.h>
#include <err.h>
#include <stdlib.h>
#include <string.h> // needed for memset()
#include <png.h>
#include "code128.h"
static void png_error_callback(png_structp png_ptr, const char *msg)
{
(void) png_ptr;
errx(EXIT_FAILURE, "libpng: %s", msg);
}
static void png_warning_callback(png_structp png_ptr, const char *msg)
{
(void) png_ptr;
warnx("libpng: %s", msg);
}
int main(int argc, char *argv[])
{
char out[4096];
int width;
int height = 40;
if (argc < 3) {
printf("%s <output.png> <string to encode>\n", argv[0]);
exit(EXIT_FAILURE);
}
const char *str = argv[2];
width = code128_estimate_len(str);
width = code128_encode_gs1(str, out, width);
if (width == 0)
errx(EXIT_FAILURE, "Invalid characters in string");
FILE *fp = fopen(argv[1], "wb");
if (!fp)
err(EXIT_FAILURE, "can't open output");
png_structp png_ptr = png_create_write_struct
(PNG_LIBPNG_VER_STRING, NULL,
png_error_callback, png_warning_callback);
if (!png_ptr)
errx(EXIT_FAILURE, "png_create_write_struct");
png_infop info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr)
{
png_destroy_write_struct(&png_ptr,
(png_infopp)NULL);
errx(EXIT_FAILURE, "png_create_info_struct");
}
if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_write_struct(&png_ptr, &info_ptr);
fclose(fp);
errx(EXIT_FAILURE, "libpng error");
}
png_init_io(png_ptr, fp);
png_set_IHDR(png_ptr, info_ptr, width, height,
1, PNG_COLOR_TYPE_GRAY, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
png_text note;
memset(¬e, 0, sizeof(note));
note.compression = PNG_TEXT_COMPRESSION_NONE;
note.key = "gs1-128";
note.text = argv[1];
note.text_length = strlen(argv[1]);
png_set_text(png_ptr, info_ptr, ¬e, 1);
png_write_info(png_ptr, info_ptr);
png_set_packing(png_ptr);
png_set_invert_mono(png_ptr);
png_byte *row_pointers[height];
int i;
for (i = 0; i < height; i++)
row_pointers[i] = (png_byte*) out;
png_write_image(png_ptr, row_pointers);
png_write_end(png_ptr, info_ptr);
png_destroy_write_struct(&png_ptr, &info_ptr);
fclose(fp);
return 0;
}
|
/*
* Symmetric primitives for Kyber (90s mode)
* (C) 2022 Jack Lloyd
* (C) 2022 Hannes Rantzsch, René Meusel, neXenio GmbH
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
#ifndef BOTAN_KYBER_90S_H_
#define BOTAN_KYBER_90S_H_
#include <botan/hash.h>
#include <botan/stream_cipher.h>
#include <botan/internal/kyber_symmetric_primitives.h>
#include <array>
#include <memory>
namespace Botan {
class Kyber_90s_Symmetric_Primitives : public Kyber_Symmetric_Primitives
{
public:
std::unique_ptr<HashFunction> G() const override
{
return HashFunction::create_or_throw("SHA-512");
}
std::unique_ptr<HashFunction> H() const override
{
return HashFunction::create_or_throw("SHA-256");
}
std::unique_ptr<HashFunction> KDF() const override
{
return HashFunction::create_or_throw("SHA-256");
}
std::unique_ptr<StreamCipher> XOF(const std::vector<uint8_t>& seed,
const std::tuple<uint8_t, uint8_t>& matrix_position) const override
{
std::array<uint8_t, 12> iv = {std::get<0>(matrix_position), std::get<1>(matrix_position), 0};
auto cipher = Botan::StreamCipher::create_or_throw("CTR-BE(AES-256)");
cipher->set_key(seed);
cipher->set_iv(iv.data(), iv.size());
return cipher;
}
secure_vector<uint8_t> PRF(const secure_vector<uint8_t>& seed, const uint8_t nonce,
const size_t outlen) const override
{
auto cipher = Botan::StreamCipher::create_or_throw("CTR-BE(AES-256)");
cipher->set_key(seed);
const std::array<uint8_t, 12> iv = {nonce, 0};
cipher->set_iv(iv.data(), iv.size());
secure_vector<uint8_t> out(outlen);
cipher->encrypt(out);
return out;
}
};
} // namespace Botan
#endif
|
#ifndef SV_UPSERT_H_
#define SV_UPSERT_H_
/*
* sophia database
* sphia.org
*
* Copyright (c) Dmitry Simonenko
* BSD License
*/
typedef struct svupsertnode svupsertnode;
typedef struct svupsert svupsert;
struct svupsertnode {
uint64_t lsn;
uint8_t flags;
ssbuf buf;
};
#define SV_UPSERTRESRV 16
struct svupsert {
svupsertnode reserve[SV_UPSERTRESRV];
ssbuf stack;
ssbuf tmp;
int max;
int count;
sv result;
};
static inline void
sv_upsertinit(svupsert *u)
{
const int reserve = SV_UPSERTRESRV;
int i = 0;
while (i < reserve) {
ss_bufinit(&u->reserve[i].buf);
i++;
}
memset(&u->result, 0, sizeof(u->result));
u->max = reserve;
u->count = 0;
ss_bufinit_reserve(&u->stack, u->reserve, sizeof(u->reserve));
ss_bufinit(&u->tmp);
}
static inline void
sv_upsertfree(svupsert *u, sr *r)
{
svupsertnode *n = (svupsertnode*)u->stack.s;
int i = 0;
while (i < u->max) {
ss_buffree(&n[i].buf, r->a);
i++;
}
ss_buffree(&u->stack, r->a);
ss_buffree(&u->tmp, r->a);
}
static inline void
sv_upsertreset(svupsert *u)
{
svupsertnode *n = (svupsertnode*)u->stack.s;
int i = 0;
while (i < u->count) {
ss_bufreset(&n[i].buf);
i++;
}
u->count = 0;
ss_bufreset(&u->stack);
ss_bufreset(&u->tmp);
memset(&u->result, 0, sizeof(u->result));
}
static inline void
sv_upsertgc(svupsert *u, sr *r, int wm_stack, int wm_buf)
{
svupsertnode *n = (svupsertnode*)u->stack.s;
if (u->max >= wm_stack) {
sv_upsertfree(u, r);
sv_upsertinit(u);
return;
}
ss_bufgc(&u->tmp, r->a, wm_buf);
int i = 0;
while (i < u->count) {
ss_bufgc(&n[i].buf, r->a, wm_buf);
i++;
}
u->count = 0;
memset(&u->result, 0, sizeof(u->result));
}
static inline int
sv_upsertpush_raw(svupsert *u, sr *r, char *pointer, int size,
uint8_t flags, uint64_t lsn)
{
svupsertnode *n;
int rc;
if (sslikely(u->max > u->count)) {
n = (svupsertnode*)u->stack.p;
ss_bufreset(&n->buf);
} else {
rc = ss_bufensure(&u->stack, r->a, sizeof(svupsertnode));
if (ssunlikely(rc == -1))
return -1;
n = (svupsertnode*)u->stack.p;
ss_bufinit(&n->buf);
u->max++;
}
rc = ss_bufensure(&n->buf, r->a, size);
if (ssunlikely(rc == -1))
return -1;
memcpy(n->buf.p, pointer, size);
n->flags = flags;
n->lsn = lsn;
ss_bufadvance(&n->buf, size);
ss_bufadvance(&u->stack, sizeof(svupsertnode));
u->count++;
return 0;
}
static inline int
sv_upsertpush(svupsert *u, sr *r, sv *v)
{
return sv_upsertpush_raw(u, r, sv_pointer(v),
sv_size(v),
sv_flags(v), sv_lsn(v));
}
static inline svupsertnode*
sv_upsertpop(svupsert *u)
{
if (u->count == 0)
return NULL;
int pos = u->count - 1;
u->count--;
u->stack.p -= sizeof(svupsertnode);
return ss_bufat(&u->stack, sizeof(svupsertnode), pos);
}
static inline int
sv_upsertdo(svupsert *u, sr *r, svupsertnode *a, svupsertnode *b)
{
int rc;
int key_count = r->scheme->count;
/* source record */
char *src_value;
int src_size;
if (sslikely(a && !(a->flags & SVDELETE)))
{
/* convert delete to orphan upsert case */
src_value = sf_value(r->fmt, a->buf.s, key_count);
src_size = sf_valuesize(r->fmt,
a->buf.s,
ss_bufused(&a->buf),
key_count);
} else {
src_value = NULL;
src_size = 0;
}
/* upsert record */
assert(b->flags & SVUPSERT);
int key_size[SR_SCHEME_MAXKEY];
char *key[SR_SCHEME_MAXKEY];
int i;
for (i = 0; i < key_count; i++) {
key[i] = sf_key(b->buf.s, i);
key_size[i] = sf_keysize(b->buf.s, i);
}
char *upsert_value;
int upsert_size;
upsert_value = sf_value(r->fmt, b->buf.s, key_count);
upsert_size = sf_valuesize(r->fmt,
b->buf.s,
ss_bufused(&b->buf),
key_count);
/* execute */
sfupsertf upsert = r->fmt_upsert->function;
char *result;
int result_size;
result_size = upsert(&result, key, key_size, key_count,
src_value,
src_size,
upsert_value,
upsert_size,
r->fmt_upsert->arg);
if (ssunlikely(result_size == -1))
return -1;
assert(result != NULL);
/* rebuild record with new value */
int v_size = (upsert_value - b->buf.s) + result_size;
ss_bufreset(&u->tmp);
rc = ss_bufensure(&u->tmp, r->a, v_size);
if (ssunlikely(rc == -1)) {
free(result);
return -1;
}
int off = sf_keycopy(u->tmp.p, b->buf.s, key_count);
ss_bufadvance(&u->tmp, off);
memcpy(u->tmp.p, result, result_size);
ss_bufadvance(&u->tmp, result_size);
free(result);
/* push result */
return sv_upsertpush_raw(u, r, u->tmp.s, ss_bufused(&u->tmp),
b->flags & ~SVUPSERT,
b->lsn);
}
static inline int
sv_upsert(svupsert *u, sr *r)
{
assert(u->count >= 1 );
svupsertnode *f = ss_bufat(&u->stack, sizeof(svupsertnode), u->count - 1);
int rc;
if (f->flags & SVUPSERT) {
f = sv_upsertpop(u);
rc = sv_upsertdo(u, r, NULL, f);
if (ssunlikely(rc == -1))
return -1;
}
if (u->count == 1)
goto done;
while (u->count > 1) {
svupsertnode *f = sv_upsertpop(u);
svupsertnode *s = sv_upsertpop(u);
assert(f != NULL);
assert(s != NULL);
rc = sv_upsertdo(u, r, f, s);
if (ssunlikely(rc == -1))
return -1;
}
done:
sv_init(&u->result, &sv_upsertvif, u->stack.s, NULL);
return 0;
}
#endif
|
/*
* THE NEW CHRONOTEXT TOOLKIT: https://github.com/arielm/new-chronotext-toolkit
* COPYRIGHT (C) 2012, ARIEL MALKA ALL RIGHTS RESERVED.
*
* THE FOLLOWING SOURCE-CODE IS DISTRIBUTED UNDER THE MODIFIED BSD LICENSE:
* https://github.com/arielm/new-chronotext-toolkit/blob/master/LICENSE.md
*/
#pragma once
#include "chronotext/texture/TextureData.h"
namespace chronotext
{
typedef std::shared_ptr<class Texture> TextureRef;
class Texture
{
ci::gl::TextureRef target;
GLuint name;
int width;
int height;
float maxU;
float maxV;
void setTarget(ci::gl::TextureRef texture);
public:
class Exception : public std::exception
{
std::string message;
public:
Exception(const std::string &what) throw() : message(what) {}
~Exception() throw() {}
const char* what() const throw()
{
return message.c_str();
}
};
TextureRequest request;
Texture(InputSourceRef inputSource, bool useMipmap = false, int flags = TextureRequest::FLAGS_NONE);
Texture(const TextureRequest &textureRequest);
Texture(const TextureData &textureData);
void unload();
void reload();
TextureData fetchTextureData();
void uploadTextureData(const TextureData &textureData);
int getId() const;
void bind();
void begin();
void end();
void drawFromCenter();
void draw(float rx = 0, float ry = 0);
void drawInRect(const ci::Rectf &rect, float ox = 0, float oy = 0);
int getWidth() const;
int getHeight() const;
ci::Vec2i getSize() const;
float getMaxU() const;
float getMaxV() const;
};
}
namespace chr = chronotext;
|
// SPDX-License-Identifier: BSD-2-Clause
/*
* Copyright (c) 2016, GlobalLogic
* Copyright (c) 2017, Linaro Limited
* 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <drivers/scif.h>
#include <io.h>
#include <keep.h>
#include <util.h>
#define SCIF_SCSCR (0x08)
#define SCIF_SCFSR (0x10)
#define SCIF_SCFTDR (0x0C)
#define SCIF_SCFCR (0x18)
#define SCIF_SCFDR (0x1C)
#define SCSCR_TE BIT(5)
#define SCFSR_TDFE BIT(5)
#define SCFSR_TEND BIT(6)
#define SCFDR_T_SHIFT 8
#define SCIF_TX_FIFO_SIZE 16
static vaddr_t chip_to_base(struct serial_chip *chip)
{
struct scif_uart_data *pd =
container_of(chip, struct scif_uart_data, chip);
return io_pa_or_va(&pd->base);
}
static void scif_uart_flush(struct serial_chip *chip)
{
vaddr_t base = chip_to_base(chip);
while (!(io_read16(base + SCIF_SCFSR) & SCFSR_TEND))
;
}
static void scif_uart_putc(struct serial_chip *chip, int ch)
{
vaddr_t base = chip_to_base(chip);
/* Wait until there is space in the FIFO */
while ((io_read16(base + SCIF_SCFDR) >> SCFDR_T_SHIFT) >=
SCIF_TX_FIFO_SIZE)
;
io_write8(base + SCIF_SCFTDR, ch);
io_clrbits16(base + SCIF_SCFSR, SCFSR_TEND | SCFSR_TDFE);
}
static const struct serial_ops scif_uart_ops = {
.flush = scif_uart_flush,
.putc = scif_uart_putc,
};
KEEP_PAGER(scif_uart_ops);
void scif_uart_init(struct scif_uart_data *pd, paddr_t base)
{
pd->base.pa = base;
pd->chip.ops = &scif_uart_ops;
/* Set Transmit Enable in Control register */
io_setbits16(base + SCIF_SCSCR, SCSCR_TE);
scif_uart_flush(&pd->chip);
}
|
#include "midimonster.h"
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
//OSX and Windows don't have the cool new toys...
#ifdef __linux__
#define MMBACKEND_LUA_TIMERFD
#endif
MM_PLUGIN_API int init();
static int lua_configure(char* option, char* value);
static int lua_configure_instance(instance* inst, char* option, char* value);
static int lua_instance(instance* inst);
static channel* lua_channel(instance* inst, char* spec, uint8_t flags);
static int lua_set(instance* inst, size_t num, channel** c, channel_value* v);
static int lua_handle(size_t num, managed_fd* fds);
static int lua_start(size_t n, instance** inst);
static int lua_shutdown(size_t n, instance** inst);
#ifndef MMBACKEND_LUA_TIMERFD
static uint32_t lua_interval();
#endif
typedef struct /*_lua_channel*/ {
char* name;
int reference;
double in;
double out;
uint8_t mark;
} lua_channel_data;
typedef struct /*_lua_instance_data*/ {
size_t channels;
lua_channel_data* channel;
lua_State* interpreter;
int cleanup_handler;
char* default_handler;
} lua_instance_data;
typedef struct /*_lua_interval_callback*/ {
uint64_t interval;
uint64_t delta;
lua_State* interpreter;
int reference;
} lua_timer;
typedef struct /*_lua_coroutine*/ {
instance* instance;
lua_State* thread;
int reference;
uint64_t timeout;
} lua_thread;
|
//
// Copyright (c) 2009, Markus Rickert
// 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.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
#ifndef _RL_HAL_DEVICEEXCEPTION_H_
#define _RL_HAL_DEVICEEXCEPTION_H_
#include "Exception.h"
namespace rl
{
namespace hal
{
class DeviceException : public Exception
{
public:
DeviceException(const ::std::string& what_arg);
virtual ~DeviceException() throw();
protected:
private:
};
}
}
#endif // _RL_HAL_DEVICEEXCEPTION_H_
|
/*
* Copyright (c) 2013-2016, Roland Bock
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SQLPP11_JOIN_H
#define SQLPP11_JOIN_H
#include <sqlpp11/join_types.h>
#include <sqlpp11/pre_join.h>
#include <sqlpp11/on.h>
namespace sqlpp
{
template <typename PreJoin, typename On>
struct join_t
{
using _traits = make_traits<no_value_t, tag::is_table, tag::is_join>;
using _nodes = detail::type_vector<PreJoin, On>;
using _can_be_null = std::false_type;
using _provided_tables = provided_tables_of<PreJoin>;
using _required_tables = detail::make_difference_set_t<required_tables_of<On>, _provided_tables>;
template <typename T>
auto join(T t) const -> decltype(::sqlpp::join(*this, t))
{
return ::sqlpp::join(*this, t);
}
template <typename T>
auto inner_join(T t) const -> decltype(::sqlpp::inner_join(*this, t))
{
return ::sqlpp::inner_join(*this, t);
}
template <typename T>
auto left_outer_join(T t) const -> decltype(::sqlpp::left_outer_join(*this, t))
{
return ::sqlpp::left_outer_join(*this, t);
}
template <typename T>
auto right_outer_join(T t) const -> decltype(::sqlpp::right_outer_join(*this, t))
{
return ::sqlpp::right_outer_join(*this, t);
}
template <typename T>
auto outer_join(T t) const -> decltype(::sqlpp::outer_join(*this, t))
{
return ::sqlpp::outer_join(*this, t);
}
template <typename T>
auto cross_join(T t) const -> decltype(::sqlpp::cross_join(*this, t))
{
return ::sqlpp::cross_join(*this, t);
}
PreJoin _pre_join;
On _on;
};
template <typename Context, typename PreJoin, typename On>
struct serializer_t<Context, join_t<PreJoin, On>>
{
using _serialize_check = serialize_check_of<Context, PreJoin, On>;
using T = join_t<PreJoin, On>;
static Context& _(const T& t, Context& context)
{
serialize(t._pre_join, context);
serialize(t._on, context);
return context;
}
};
} // namespace sqlpp
#endif
|
/* $NetBSD: bitops.h,v 1.11 2012/12/07 02:27:58 christos Exp $ */
/*-
* Copyright (c) 2007, 2010 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas and Joerg Sonnenberger.
*
* 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 THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
#ifndef COMPAT_BITOPS_H
#define COMPAT_BITOPS_H
#include <stdint.h>
#include "common.h"
/*
* Find First Set functions
*/
#ifndef ffs32
static inline int __unused
ffs32(uint32_t _n)
{
int _v;
if (!_n)
return 0;
_v = 1;
if ((_n & 0x0000FFFFU) == 0) {
_n >>= 16;
_v += 16;
}
if ((_n & 0x000000FFU) == 0) {
_n >>= 8;
_v += 8;
}
if ((_n & 0x0000000FU) == 0) {
_n >>= 4;
_v += 4;
}
if ((_n & 0x00000003U) == 0) {
_n >>= 2;
_v += 2;
}
if ((_n & 0x00000001U) == 0) {
//_n >>= 1;
_v += 1;
}
return _v;
}
#endif
#ifndef ffs64
static inline int __unused
ffs64(uint64_t _n)
{
int _v;
if (!_n)
return 0;
_v = 1;
if ((_n & 0x00000000FFFFFFFFULL) == 0) {
_n >>= 32;
_v += 32;
}
if ((_n & 0x000000000000FFFFULL) == 0) {
_n >>= 16;
_v += 16;
}
if ((_n & 0x00000000000000FFULL) == 0) {
_n >>= 8;
_v += 8;
}
if ((_n & 0x000000000000000FULL) == 0) {
_n >>= 4;
_v += 4;
}
if ((_n & 0x0000000000000003ULL) == 0) {
_n >>= 2;
_v += 2;
}
if ((_n & 0x0000000000000001ULL) == 0) {
//_n >>= 1;
_v += 1;
}
return _v;
}
#endif
/*
* Find Last Set functions
*/
#ifndef fls32
static __inline int __unused
fls32(uint32_t _n)
{
int _v;
if (!_n)
return 0;
_v = 32;
if ((_n & 0xFFFF0000U) == 0) {
_n <<= 16;
_v -= 16;
}
if ((_n & 0xFF000000U) == 0) {
_n <<= 8;
_v -= 8;
}
if ((_n & 0xF0000000U) == 0) {
_n <<= 4;
_v -= 4;
}
if ((_n & 0xC0000000U) == 0) {
_n <<= 2;
_v -= 2;
}
if ((_n & 0x80000000U) == 0) {
//_n <<= 1;
_v -= 1;
}
return _v;
}
#endif
#ifndef fls64
static int __unused
fls64(uint64_t _n)
{
int _v;
if (!_n)
return 0;
_v = 64;
if ((_n & 0xFFFFFFFF00000000ULL) == 0) {
_n <<= 32;
_v -= 32;
}
if ((_n & 0xFFFF000000000000ULL) == 0) {
_n <<= 16;
_v -= 16;
}
if ((_n & 0xFF00000000000000ULL) == 0) {
_n <<= 8;
_v -= 8;
}
if ((_n & 0xF000000000000000ULL) == 0) {
_n <<= 4;
_v -= 4;
}
if ((_n & 0xC000000000000000ULL) == 0) {
_n <<= 2;
_v -= 2;
}
if ((_n & 0x8000000000000000ULL) == 0) {
//_n <<= 1;
_v -= 1;
}
return _v;
}
#endif
#endif /* COMPAT_BITOPS_H_ */
|
/*
* Copyright 2014, NICTA
*
* This software may be distributed and modified according to the terms of
* the GNU General Public License version 2. Note that NO WARRANTY is provided.
* See "LICENSE_GPLv2.txt" for details.
*
* @TAG(NICTA_GPL)
*/
#ifndef __ETHIFACE_RAW_IFACE_H__
#define __ETHIFACE_RAW_IFACE_H__
#include <stdint.h>
#include <stdlib.h>
#include <platsupport/io.h>
struct eth_driver;
#define ETHIF_TX_ENQUEUED 0
#define ETHIF_TX_FAILED -1
#define ETHIF_TX_COMPLETE 1
/**
* Transmit a packet.
*
* @param driver Pointer to ethernet driver
* @param num Number of memory regions making up the packet
* @param phys Array of length 'num' detailing physical addresses
* of each memory region
* @param len Array of length 'num' detailing the length of each
* memory region
* @param cookie Cookie to be passed to receive complete function
*
* @return ETHIF_TX_ENQUEUED if buffer request is enqueued, ethif_raw_tx_complete
will be called when completed. ETHIF_TX_COMPLETE if transmit completed
inline and buffer can be freed. ETHIF_TX_FAILED if transmit could not
be done
*/
typedef int (*ethif_raw_tx)(struct eth_driver *driver, unsigned int num, uintptr_t *phys, unsigned int *len, void *cookie);
/**
* Handle an IRQ event
*
* @param driver Pointer to ethernet driver
* @param irq If driver has multiple IRQs this is a driver
* specific encoding of which one
*/
typedef void (*ethif_raw_handleIRQ_t)(struct eth_driver *driver, int irq);
/**
* Get low level device from the driver
*
* @param driver Pointer to ethernet driver
* @param mac Pointer to 6 byte array to fill in HW mac address
* @param mtu Pointer to int that should be filled in with devices MTU
*/
typedef void (*ethif_low_level_init_t)(struct eth_driver *driver, uint8_t *mac, int *mtu);
/* Debug method for printing internal driver state */
typedef void (*ethif_print_state_t)(struct eth_driver* driver);
/**
* Request the driver to poll for any changes. This can
* be used if you want to run without interrupts
*
* @param driver Pointer to ethernet driver
*/
typedef void (*ethif_raw_poll)(struct eth_driver *driver);
/**
* Function called by the driver to allocate receive buffers.
* Must respect the dma_alignment specified by the driver in
* the eth_driver struct
*
* @param cb_cookie Cookie given in eth_driver struct
* @param buf_size Size of buffer to allocate
* @param cookie Pointer to location to store a buffer
* specific cookie that will be passed
* to the ethif_raw_rx_complete function
*
* @return Physical address of buffer, or 0 on error
*/
typedef uintptr_t (*ethif_raw_allocate_rx_buf)(void *cb_cookie, size_t buf_size, void **cookie);
/**
* Function called by the driver upon successful RX
*
* @param cb_cookie Cookie given in the eth_driver struct
* @param num_bufs Number of buffers that were used in the receive
* @param cookies Array of size 'num_bufs' containing all the
* cookies as given by ethif_raw_allocate_rx_buf
* This array will be freed upon completion of the callback
* @param lens Array of size 'num_bufs' containing how much
* data was placed in each receive buffer
* This array will be freed upon completion of the callback
*/
typedef void (*ethif_raw_rx_complete)(void *cb_cookie, unsigned int num_bufs, void **cookies, unsigned int *lens);
/**
* Function called by the driver upon successful TX
*
* @param cb_cookie Cookie given in eth_driver struct
* @param cookie Buffer specific cookie passed to ethif_raw_tx
*/
typedef void (*ethif_raw_tx_complete)(void *cb_cookie, void *cookie);
/**
* Defining of generic function for initializing an ethernet
* driver. Takes an allocated and partially filled out
* eth_driver struct that it will finish filling out.
*
* @param driver Partially filled out eth_driver struct. Expects
i_cb and cb_cookie to already be filled out
* @param io_ops Interface containing OS specific functions
* @param config Pointer to driver specific config struct. The
* caller is responsible for freeing this
*
* @return 0 on success
*/
typedef int (*ethif_driver_init)(struct eth_driver *driver, ps_io_ops_t io_ops, void *config);
/* Structure defining the set of functions an ethernet driver
* must implement and expose */
struct raw_iface_funcs {
ethif_raw_tx raw_tx;
ethif_raw_handleIRQ_t raw_handleIRQ;
ethif_raw_poll raw_poll;
ethif_print_state_t print_state;
ethif_low_level_init_t low_level_init;
};
/* Structure defining the set of functions an ethernet driver
* expects to be given to it for handling memory allocation
* and receive/transmit completions */
struct raw_iface_callbacks {
ethif_raw_tx_complete tx_complete;
ethif_raw_rx_complete rx_complete;
ethif_raw_allocate_rx_buf allocate_rx_buf;
};
/* Structure to hold the interface for an ethernet driver */
struct eth_driver {
void* eth_data;
struct raw_iface_funcs i_fn;
struct raw_iface_callbacks i_cb;
void *cb_cookie;
ps_io_ops_t io_ops;
int dma_alignment;
};
#endif /* __ETHIFACE_RAW_IFACE_H__ */
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.