hexsha stringlengths 40 40 | size int64 22 2.4M | ext stringclasses 5
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 3 260 | max_stars_repo_name stringlengths 5 109 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 9 | max_stars_count float64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 3 260 | max_issues_repo_name stringlengths 5 109 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 9 | max_issues_count float64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 260 | max_forks_repo_name stringlengths 5 109 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 9 | max_forks_count float64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 22 2.4M | avg_line_length float64 5 169k | max_line_length int64 5 786k | alphanum_fraction float64 0.06 0.95 | matches listlengths 1 11 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1136a46a17f4c8d3473b71d568d2a1709aa4787f | 1,960 | h | C | lock/lock.h | Bert-Z/Raichu | a7b21c1d450da3acc36efd120453e882e3eff7a4 | [
"MIT"
] | 3 | 2020-07-09T17:38:59.000Z | 2020-09-17T12:48:42.000Z | lock/lock.h | Bert-Z/Raichu | a7b21c1d450da3acc36efd120453e882e3eff7a4 | [
"MIT"
] | null | null | null | lock/lock.h | Bert-Z/Raichu | a7b21c1d450da3acc36efd120453e882e3eff7a4 | [
"MIT"
] | null | null | null | #pragma once
#include "../server/utils/zk/zk_cpp.h"
#include <mutex>
#include <condition_variable>
namespace raichu
{
namespace lock
{
// Simple CountDownLatch Implementation
class CountDownLatch
{
private:
std::mutex m_mutex;
std::condition_variable m_cv;
unsigned int m_count = 0;
public:
explicit CountDownLatch(const unsigned int count) : m_count(count) {}
void await(void);
void countDown(void);
unsigned int getCount(void);
};
class ReadWriteLock
{
private:
raichu::server::zk::zk_cpp zk_client;
std::string lock_name;
std::string read_lock;
std::string write_lock;
enum LockType
{
Read = 0,
Write
};
inline bool matchLockType(const std::string &path, LockType locktype);
public:
explicit ReadWriteLock(const std::string &host_name, const std::string &lock_name) : lock_name(lock_name)
{
zk_client.connect(host_name);
if (zk_client.exists_node(lock_name.c_str(), nullptr, true) != raichu::server::zk::z_ok)
{
std::vector<raichu::server::zk::zoo_acl_t> acl;
acl.push_back(raichu::server::zk::zk_cpp::create_world_acl(raichu::server::zk::zoo_perm_all));
zk_client.create_persistent_node(lock_name.c_str(), "0", acl);
}
}
void sortNode(std::vector<std::string> &vec);
// get read lock
void lockRead();
// release read lock
void unLockRead();
// get write lock
void lockWrite();
// release write lock
void unLockWrite();
};
} // namespace lock
} // namespace raichu | 28 | 117 | 0.52602 | [
"vector"
] |
113b6a86eb059064da6f6d4a2a61eeb8c81cc112 | 5,817 | h | C | Source/BladeBase/header/interface/public/graphics/IGraphicsBuffer.h | OscarGame/blade | 6987708cb011813eb38e5c262c7a83888635f002 | [
"MIT"
] | 146 | 2018-12-03T08:08:17.000Z | 2022-03-21T06:04:06.000Z | Source/BladeBase/header/interface/public/graphics/IGraphicsBuffer.h | huangx916/blade | 3fa398f4d32215bbc7e292d61e38bb92aad1ee1c | [
"MIT"
] | 1 | 2019-01-18T03:35:49.000Z | 2019-01-18T03:36:08.000Z | Source/BladeBase/header/interface/public/graphics/IGraphicsBuffer.h | huangx916/blade | 3fa398f4d32215bbc7e292d61e38bb92aad1ee1c | [
"MIT"
] | 31 | 2018-12-03T10:32:43.000Z | 2021-10-04T06:31:44.000Z | /********************************************************************
created: 2010/04/13
filename: IGraphicsBuffer.h
author: Crazii
purpose:
*********************************************************************/
#ifndef __Blade_IGraphicsBuffer_h__
#define __Blade_IGraphicsBuffer_h__
#include <math/Box3i.h>
namespace Blade
{
class IGraphicsBuffer
{
public:
typedef enum EGraphicsBufferAccessFLag
{
GBAF_NONE = 0,
GBAF_READ = 0x01, ///read by graphics device or CPU
GBAF_WRITE = 0x02, ///write by graphics device or CPU
GBAF_READ_WRITE = GBAF_READ | GBAF_WRITE,
}ACCESS;
enum EGraphicsBufferUsage
{
//flags
/** @brief indicates the buffer will be modified frequently */
GBUF_DYNAMIC = 0x04,
GBUF_CPU_READ = 0x08,
///note: the difference between GBUF_DYNMIAC & GBU_DYNAMIC_WRITE is:\n
///there's internal extra data copy for GBUF_DYNMIAC, so you can lock it as ready-only buffer like GBU_DEFAULT,
///also with the extra data copy in D3D9 mode, we will auto recreate & fill the dynamic buffers.
///while GBU_DYNAMIC_WRITE doesn't have this data copy because it is assumed to be written in every frame.
//available usages
GBU_NONE = GBAF_NONE,
GBU_STATIC = 0x10, //D3D11_USAGE_IMMUTABLE
GBU_DYNAMIC = GBUF_DYNAMIC | GBAF_READ_WRITE, //D3D11_USAGE_DYNAMIC; D3DUSAGE_DYNAMIC + manual cache management
GBU_DEFAULT = GBU_STATIC | GBAF_READ_WRITE, //D3D11_USAGE_DEFAULT; D3DUSAGE(0)
GBU_DYNAMIC_WRITE = GBUF_DYNAMIC | GBAF_WRITE, //D3D11_USAGE_DYNAMIC; D3DUSAGE_DYNAMIC (no cache management, cannot be read)
GBU_CPU_READ = GBUF_CPU_READ | GBAF_READ, //D3D11_USAGE_IMMUTABLE; D3DUSAGE(0) + D3DPOOL_DEFAULT + manual cache management
//extra flags
//for pixel buffer only
/** @brief as depth stencil buffer */
GBUF_DEPTHSTENCIL = 0x20,
/** @brief render target usage */
GBUF_RENDERTARGET = 0x40,
/** @brief auto generate mip-map */
GBUF_AUTOMIPMAP = 0x80,
};
typedef class Usage
{
public:
Usage(){}
Usage(EGraphicsBufferUsage usage) :mUsage(usage) {}
Usage(int usage) :mUsage( (EGraphicsBufferUsage)usage) {}
operator EGraphicsBufferUsage() const {return mUsage;}
bool operator==(EGraphicsBufferUsage rhs) const {return mUsage == rhs;}
bool operator!=(EGraphicsBufferUsage rhs) const { return !(mUsage == rhs); }
Usage& operator=(EGraphicsBufferUsage rhs) {mUsage = rhs;return *this;}
inline bool isDirectRead() const {return (mUsage&GBUF_CPU_READ) != 0;}
inline bool isDynamic() const {return (mUsage&GBUF_DYNAMIC) != 0;}
inline bool isReadable() const {return (mUsage&GBAF_READ) != 0;}
inline bool isWriteable() const {return (mUsage&GBAF_WRITE) != 0;}
inline bool isAutoMipmap() const {return (mUsage&GBUF_AUTOMIPMAP) != 0;}
inline bool isRenderTarget() const {return (mUsage&GBUF_RENDERTARGET) != 0;}
inline bool isDepthStencil() const {return (mUsage&GBUF_DEPTHSTENCIL) != 0;}
inline ACCESS getCPUAccess() const {return ACCESS(mUsage&GBAF_READ_WRITE);}
protected:
EGraphicsBufferUsage mUsage;
}USAGE;
enum EGraphicsBufferLockFlag
{
GBLF_UNDEFINED = 0,
/** @brief lock for read only */
GBLF_READONLY = 0x01,
/** @brief */
GBLF_WRITEONLY = 0x02,
/** @brief */
GBLF_DISCARD = 0x04,
/** @brief indicates not overwrite buffer that's being used rendering current frame */
GBLF_NO_OVERWRITE = 0x08,
/** @brief */
GBLF_NO_DIRTY_UPDATE = 0x10,
//
GBLF_FORCEWORD = 0xFFFFFFFF,
/** @brief lock for read/write */
GBLF_NORMAL = GBLF_READONLY|GBLF_WRITEONLY,
/** @brief discard buffer after modifying,need recreated */
GBLF_DISCARDWRITE = GBLF_WRITEONLY | GBLF_DISCARD,
};
class LOCKFLAGS
{
public:
LOCKFLAGS() :mFlags(GBLF_UNDEFINED) {}
LOCKFLAGS(const LOCKFLAGS& src) :mFlags(src.mFlags) {}
LOCKFLAGS(EGraphicsBufferLockFlag flag) :mFlags(flag) {}
LOCKFLAGS(int flags) :mFlags(flags) {}
int operator&(EGraphicsBufferLockFlag flag) const {return mFlags&flag;}
int operator&(int flags) const {return mFlags&flags;}
int operator|(EGraphicsBufferLockFlag flag) const {return mFlags|flag;}
int operator|(int flags) {return mFlags|flags;}
LOCKFLAGS& operator|=(EGraphicsBufferLockFlag flag) {mFlags |= flag; return *this;}
LOCKFLAGS& operator|=(int flags) {mFlags |= flags; return *this;}
LOCKFLAGS& operator&=(EGraphicsBufferLockFlag flag) {mFlags &= flag; return *this;}
LOCKFLAGS& operator&=(int flags) {mFlags &= flags; return *this;}
bool operator == (int flags) const { return mFlags == flags; }
bool operator != (int flags) const { return mFlags != flags; }
protected:
union
{
EGraphicsBufferLockFlag mEnum; //debug watch
int mFlags;
};
};
virtual ~IGraphicsBuffer() {}
/**
@describe
@param
@return
*/
virtual void* lock(size_t offset, size_t length, LOCKFLAGS lockflags) = 0;
/**
@describe
@param
@return
*/
virtual void* lock(const Box3i& box, size_t& outPitch, LOCKFLAGS lockflags) = 0;
/**
@describe
@param
@return
*/
virtual void unlock(void) = 0;
/**
@describe
@param
@return
*/
virtual USAGE getUsage() const = 0;
/**
@describe
@param
@return
*/
virtual bool isLocked() const = 0;
/**
@describe
@param
@return
*/
virtual bool addDirtyRegion(const Box3i& dirtyBox) = 0;
/** @brief */
inline void* lock(LOCKFLAGS lockflags)
{
return this->lock(0,(size_t)-1,lockflags);
}
inline void* lock(size_t& outPitch,LOCKFLAGS lockflags)
{
return this->lock(Box3i::EMPTY, outPitch, lockflags);
}
};//class IGraphicsBuffer
}//namespace Blade
#endif //__Blade_IGraphicsBuffer_h__ | 29.378788 | 129 | 0.664776 | [
"render"
] |
113c64b25a9a6bcd2bb5c39841b661eb9cd335ca | 268 | h | C | News/News/Classes/News/Views/ListTableViewCell.h | littlestar521/Crazy | e4db0c6f1239e9eba6a2f3023d18bacbc4ed35b4 | [
"Apache-2.0"
] | null | null | null | News/News/Classes/News/Views/ListTableViewCell.h | littlestar521/Crazy | e4db0c6f1239e9eba6a2f3023d18bacbc4ed35b4 | [
"Apache-2.0"
] | null | null | null | News/News/Classes/News/Views/ListTableViewCell.h | littlestar521/Crazy | e4db0c6f1239e9eba6a2f3023d18bacbc4ed35b4 | [
"Apache-2.0"
] | null | null | null | //
// ListTableViewCell.h
// News
//
// Created by scjy on 16/3/9.
// Copyright © 2016年 马娟娟. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ListModel.h"
@interface ListTableViewCell : UITableViewCell
@property(nonatomic,strong)ListModel *model;
@end
| 15.764706 | 47 | 0.705224 | [
"model"
] |
113f7b166fbde4271104e5a5859775db85b6fbf2 | 30,128 | h | C | ClassicStartMenu/ClassicStartMenuDLL/MenuContainer.h | sedwards/ClassicShell | c7d4bac036d7da8e053bc12decfcd2e3744e0e76 | [
"MIT"
] | 11 | 2015-10-23T03:14:26.000Z | 2021-04-19T21:40:28.000Z | ClassicStartMenu/ClassicStartMenuDLL/MenuContainer.h | vonchenplus/ClassicShell | c7d4bac036d7da8e053bc12decfcd2e3744e0e76 | [
"MIT"
] | null | null | null | ClassicStartMenu/ClassicStartMenuDLL/MenuContainer.h | vonchenplus/ClassicShell | c7d4bac036d7da8e053bc12decfcd2e3744e0e76 | [
"MIT"
] | 14 | 2015-11-13T07:09:35.000Z | 2020-04-05T13:10:45.000Z | // Classic Shell (c) 2009-2013, Ivo Beltchev
// The sources for Classic Shell are distributed under the MIT open source license
#pragma once
#include "SkinManager.h"
#include "JumpLists.h"
#include <vector>
#include <map>
#define ALLOW_DEACTIVATE // undefine this to prevent the menu from closing when it is deactivated (useful for debugging)
//#define REPEAT_ITEMS 10 // define this to repeat each menu item (useful to simulate large menus)
#if defined(BUILD_SETUP) && !defined(ALLOW_DEACTIVATE)
#define ALLOW_DEACTIVATE // make sure it is defined in Setup
#endif
#if defined(BUILD_SETUP) && defined(REPEAT_ITEMS)
#undef REPEAT_ITEMS
#endif
enum TMenuID
{
MENU_NO=0,
MENU_LAST=0,
MENU_SEPARATOR,
MENU_EMPTY,
MENU_EMPTY_TOP,
MENU_RECENT,
MENU_JUMPITEM,
MENU_COLUMN_PADDING,
MENU_COLUMN_BREAK,
// standard menu items
MENU_PROGRAMS,
MENU_APPS,
MENU_COMPUTER,
MENU_FAVORITES,
MENU_DOCUMENTS,
MENU_USERFILES,
MENU_USERDOCUMENTS,
MENU_USERPICTURES,
MENU_SETTINGS,
MENU_CONTROLPANEL,
MENU_CONTROLPANEL_CATEGORIES,
MENU_NETWORK,
MENU_SECURITY,
MENU_PRINTERS,
MENU_TASKBAR,
MENU_FEATURES,
MENU_CLASSIC_SETTINGS,
MENU_SEARCH,
MENU_SEARCH_FILES,
MENU_SEARCH_PRINTER,
MENU_SEARCH_COMPUTERS,
MENU_SEARCH_PEOPLE,
MENU_HELP,
MENU_RUN,
MENU_LOGOFF,
MENU_DISCONNECT,
MENU_UNDOCK,
MENU_SHUTDOWN_BOX,
// additional commands
MENU_CUSTOM, // used for any custom item
MENU_SLEEP,
MENU_HIBERNATE,
MENU_RESTART,
MENU_SHUTDOWN,
MENU_SWITCHUSER,
MENU_LOCK,
MENU_RECENT_ITEMS,
MENU_SEARCH_BOX,
MENU_IGNORE=1024, // ignore this item
};
struct StdMenuItem
{
const wchar_t *command;
TMenuID id;
const KNOWNFOLDERID *folder1; // NULL if not used
const KNOWNFOLDERID *folder2; // NULL if not used
const wchar_t *label; // localization key
const wchar_t *tip; // default tooltip
const wchar_t *iconPath;
const wchar_t *link;
unsigned int settings;
const StdMenuItem *submenu;
CString labelString, tipString; // additional storage for the strings
// user settings
enum
{
MENU_OPENUP = 0x0001, // prefer to open up
MENU_OPENUP_REC = 0x0002, // children prefer to open up
MENU_SORTZA = 0x0004, // sort backwards
MENU_SORTZA_REC = 0x0008, // children sort backwards
MENU_SORTONCE = 0x0010, // save the sort order the first time the menu is opened
MENU_ITEMS_FIRST = 0x0020, // place the custom items before the folder items
MENU_TRACK = 0x0040, // track shortcuts from this menu
MENU_NOTRACK = 0x0080, // don't track shortcuts from this menu
MENU_NOEXPAND = 0x0100, // don't expand this link item
MENU_MULTICOLUMN = 0x0200, // make this item a multi-column item
MENU_NOEXTENSIONS = 0x0400, // hide extensions
MENU_INLINE = 0x0800, // inline sub-items in the parent menu
MENU_SPLIT_BUTTON = 0x1000, // the item is drawn as a split button
MENU_NORECENT = 0x8000 // don't show recent items in the root menu (because a sub-menu uses MENU_RECENT_ITEMS)
};
};
struct SpecialFolder
{
const KNOWNFOLDERID *folder;
unsigned int settings;
enum
{
FOLDER_NOSUBFOLDERS=1, // don't show the subfolders of this folder
FOLDER_NONEWFOLDER=2, // don't show the "New Folder" command
FOLDER_NODROP=4, // don't allow reordering, don't show "Sort" and "Auto Arrange" (also implies FOLDER_NONEWFOLDER)
};
};
extern SpecialFolder g_SpecialFolders[];
class CMenuAccessible;
// CMenuContainer - implementation of a single menu box.
class CMenuContainer: public CWindowImpl<CMenuContainer>, public IDropTarget
{
public:
DECLARE_WND_CLASS_EX(L"ClassicShell.CMenuContainer",CS_DROPSHADOW|CS_DBLCLKS,COLOR_MENU)
// message handlers
BEGIN_MSG_MAP( CMenuContainer )
// forward all messages to m_pMenu2 and m_pMenu3 to ensure the context menu functions properly
if (m_pMenu3)
{
if (SUCCEEDED(m_pMenu3->HandleMenuMsg2(uMsg,wParam,lParam,&lResult)))
return TRUE;
}
else if (m_pMenu2)
{
if (SUCCEEDED(m_pMenu2->HandleMenuMsg(uMsg,wParam,lParam)))
{
lResult=0;
return TRUE;
}
}
MESSAGE_HANDLER( WM_CREATE, OnCreate )
MESSAGE_HANDLER( WM_DESTROY, OnDestroy )
MESSAGE_HANDLER( WM_PAINT, OnPaint )
MESSAGE_HANDLER( WM_PRINTCLIENT, OnPaint )
MESSAGE_HANDLER( WM_ERASEBKGND, OnEraseBkgnd )
MESSAGE_HANDLER( WM_ACTIVATE, OnActivate )
MESSAGE_HANDLER( WM_MOUSEACTIVATE, OnMouseActivate )
MESSAGE_HANDLER( WM_MOUSEMOVE, OnMouseMove )
MESSAGE_HANDLER( WM_MOUSELEAVE, OnMouseLeave )
MESSAGE_HANDLER( WM_MOUSEWHEEL, OnMouseWheel )
MESSAGE_HANDLER( WM_LBUTTONDOWN, OnLButtonDown )
MESSAGE_HANDLER( WM_LBUTTONDBLCLK, OnLButtonDblClick )
MESSAGE_HANDLER( WM_LBUTTONUP, OnLButtonUp )
MESSAGE_HANDLER( WM_RBUTTONDOWN, OnRButtonDown )
MESSAGE_HANDLER( WM_RBUTTONUP, OnRButtonUp )
MESSAGE_HANDLER( WM_SETCURSOR, OnSetCursor )
MESSAGE_HANDLER( WM_CONTEXTMENU, OnContextMenu )
MESSAGE_HANDLER( WM_KEYDOWN, OnKeyDown )
MESSAGE_HANDLER( WM_SYSKEYDOWN, OnSysKeyDown )
MESSAGE_HANDLER( WM_CHAR, OnChar )
MESSAGE_HANDLER( WM_TIMER, OnTimer )
MESSAGE_HANDLER( WM_SYSCOMMAND, OnSysCommand )
MESSAGE_HANDLER( WM_GETOBJECT, OnGetAccObject )
MESSAGE_HANDLER( WM_CTLCOLOREDIT, OnColorEdit )
MESSAGE_HANDLER( MCM_REFRESH, OnRefresh )
MESSAGE_HANDLER( MCM_SETCONTEXTITEM, OnSetContextItem )
MESSAGE_HANDLER( MCM_REDRAWEDIT, OnRedrawEdit )
MESSAGE_HANDLER( MCM_REFRESHICONS, OnRefreshIcons )
MESSAGE_HANDLER( MCM_SETHOTITEM, OnSetHotItem )
MESSAGE_HANDLER( s_StartMenuMsg, OnStartMenuMsg )
COMMAND_CODE_HANDLER( EN_CHANGE, OnEditChange )
END_MSG_MAP()
// options when creating a container
enum
{
CONTAINER_LARGE = 0x0000001, // use large icons
CONTAINER_MULTICOLUMN = 0x0000002, // use multiple columns instead of a single scrolling column
CONTAINER_MULTICOL_REC = 0x0000004, // the children will be multi-column
CONTAINER_CONTROLPANEL = 0x0000008, // this is the control panel, don't go into subfolders
CONTAINER_PROGRAMS = 0x0000010, // this is a folder from the Start Menu hierarchy (drop operations prefer link over move)
CONTAINER_DOCUMENTS = 0x0000020, // sort by time, limit the count (for recent documents)
CONTAINER_ALLPROGRAMS = 0x0000040, // this is the main menu of All Programs (combines the Start Menu and Programs folders)
CONTAINER_RECENT = 0x0000080, // insert recent programs (sorted by time)
CONTAINER_LINK = 0x0000100, // this is an expanded link to a folder (always scrolling)
CONTAINER_ITEMS_FIRST = 0x0000200, // put standard items at the top
CONTAINER_DRAG = 0x0000400, // allow items to be dragged out
CONTAINER_DROP = 0x0000800, // allow dropping of items
CONTAINER_LEFT = 0x0001000, // the window is aligned on the left
CONTAINER_TOP = 0x0002000, // the window is aligned on the top
CONTAINER_AUTOSORT = 0x0004000, // the menu is always in alphabetical order
CONTAINER_OPENUP_REC = 0x0008000, // the container's children will prefer to open up instead of down
CONTAINER_SORTZA = 0x0010000, // the container will sort backwards by default
CONTAINER_SORTZA_REC = 0x0020000, // the container's children will sort backwards by default
CONTAINER_SORTONCE = 0x0040000, // the container will save the sort order the first time the menu is opened
CONTAINER_TRACK = 0x0080000, // track shortcuts from this menu
CONTAINER_NOSUBFOLDERS = 0x0100000, // don't go into subfolders
CONTAINER_NONEWFOLDER = 0x0200000, // don't show the "New Folder" command
CONTAINER_SEARCH = 0x0400000, // this is he search results submenu
CONTAINER_NOEXTENSIONS = 0x0800000, // hide extensions
CONTAINER_JUMPLIST = 0x1000000, // this is a jumplist menu
CONTAINER_APPS = 0x2000000, // this is the folder for Metro apps
};
CMenuContainer( CMenuContainer *pParent, int index, int options, const StdMenuItem *pStdItem, PIDLIST_ABSOLUTE path1, PIDLIST_ABSOLUTE path2, const CString ®Name );
~CMenuContainer( void );
void InitItems( void );
void InitWindow( void );
static bool CloseStartMenu( void );
static bool CloseProgramsMenu( void );
static void HideStartMenu( void );
static bool IsMenuOpened( void ) { return !s_Menus.empty(); }
static bool IsMenuWindow( HWND hWnd );
static bool IgnoreTaskbarTimers( void ) { return !s_Menus.empty() && (s_TaskbarState&ABS_AUTOHIDE); }
static HWND ToggleStartMenu( int taskbarId, bool bKeyboard, bool bAllPrograms );
static bool ProcessMouseMessage( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
static void RefreshIcons( void );
// IUnknown
virtual STDMETHODIMP QueryInterface( REFIID riid, void **ppvObject )
{
*ppvObject=NULL;
if (IID_IUnknown==riid || IID_IDropTarget==riid)
{
AddRef();
*ppvObject=static_cast<IDropTarget*>(this);
return S_OK;
}
return E_NOINTERFACE;
}
virtual ULONG STDMETHODCALLTYPE AddRef( void )
{
return InterlockedIncrement(&m_RefCount);
}
virtual ULONG STDMETHODCALLTYPE Release( void )
{
long nTemp=InterlockedDecrement(&m_RefCount);
if (!nTemp) delete this;
return nTemp;
}
// IDropTarget
virtual HRESULT STDMETHODCALLTYPE DragEnter( IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect );
virtual HRESULT STDMETHODCALLTYPE DragOver( DWORD grfKeyState, POINTL pt, DWORD *pdwEffect );
virtual HRESULT STDMETHODCALLTYPE DragLeave( void );
virtual HRESULT STDMETHODCALLTYPE Drop( IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect );
protected:
LRESULT OnCreate( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnDestroy( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnRefresh( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnPaint( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnEraseBkgnd( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled ) { return 1; }
LRESULT OnActivate( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnMouseActivate( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnMouseMove( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnMouseLeave( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnMouseWheel( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnLButtonDown( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnLButtonDblClick( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnLButtonUp( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnRButtonDown( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnRButtonUp( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnSetCursor( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnContextMenu( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnKeyDown( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnSysKeyDown( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnChar( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnTimer( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnSysCommand( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnGetAccObject( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnSetContextItem( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnColorEdit( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnRedrawEdit( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnRefreshIcons( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnSetHotItem( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnStartMenuMsg( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnEditChange( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
virtual void OnFinalMessage( HWND ) { Release(); }
private:
// description of a menu item
struct MenuItem
{
TMenuID id; // if pStdItem!=NULL, this is pStdItem->id. otherwise it can only be MENU_NO, MENU_SEPARATOR, MENU_EMPTY or MENU_EMPTY_TOP
const StdMenuItem *pStdItem; // NULL if not a standard menu item
CString name;
unsigned int nameHash;
int icon;
int column;
int row;
RECT itemRect;
bool bFolder:1; // this is a folder - draw arrow
bool bLink:1; // this is a link (if a link to a folder is expanded it is always single-column)
bool bPrograms:1; // this item is part of the Start Menu folder hierarchy
bool bAlignBottom:1; // two-column menu: this item is aligned to the bottom
bool bBreak:1; // two-column menu: this item starts the second column
bool bInline:1; // this item is inlined in the parent menu
bool bInlineFirst:1; // this item is the first from the inlined group
bool bInlineLast:1; // this item is the last from the inlined group
bool bSplit:1; // split button item
bool bJumpList:1; // this item has a jump list
bool bMetroLink:1; // this is a Windows 8 Metro shortcut
bool bProtectedLink:1; // this is a protected Metro shortcut (can't be deleted or renamed)
bool bBlankSeparator:1; // this is a blank separator that is the same size as normal items
char priority; // used for sorting of the All Programs menu
// pair of shell items. 2 items are used to combine a user folder with a common folder (I.E. user programs/common programs)
PIDLIST_ABSOLUTE pItem1;
PIDLIST_ABSOLUTE pItem2;
union
{
UINT accelerator; // accelerator character, 0 if none
FILETIME time; // timestamp of the file (for sorting recent documents)
};
int jumpIndex; // MAKELONG(group,item)
bool operator<( const MenuItem &x ) const
{
if (priority<x.priority) return true;
if (priority>x.priority) return false;
if (row<x.row) return true;
if (row>x.row) return false;
if ((bFolder && !bJumpList) && !(x.bFolder && !x.bJumpList)) return true;
if (!(bFolder && !bJumpList) && (x.bFolder && !x.bJumpList)) return false;
if (bFolder && !bJumpList)
{
const wchar_t *drive1=name.IsEmpty()?NULL:wcschr((const wchar_t*)name+1,':');
const wchar_t *drive2=x.name.IsEmpty()?NULL:wcschr((const wchar_t*)x.name+1,':');
if (drive1 && !drive2) return true;
if (!drive1 && drive2) return false;
if (drive1)
return drive1[-1]<drive2[-1];
}
return CompareMenuString(name,x.name)<0;
}
void SetName( const wchar_t *_name, bool bNoExtensions )
{
if (bNoExtensions)
{
const wchar_t *end=wcsrchr(_name,'.');
if (end)
{
name=CString(_name,(int)(end-_name));
return;
}
}
name=_name;
}
};
struct SortMenuItem
{
CString name;
unsigned int nameHash;
bool bFolder;
bool bJumpList;
bool operator<( const SortMenuItem &x ) const
{
if ((bFolder && !bJumpList) && !(x.bFolder && !x.bJumpList)) return true;
if (!(bFolder && !bJumpList) && (x.bFolder && !x.bJumpList)) return false;
if (bFolder && !bJumpList)
{
const wchar_t *drive1=name.IsEmpty()?NULL:wcschr((const wchar_t*)name+1,':');
const wchar_t *drive2=x.name.IsEmpty()?NULL:wcschr((const wchar_t*)x.name+1,':');
if (drive1 && !drive2) return true;
if (!drive1 && drive2) return false;
if (drive1)
return drive1[-1]<drive2[-1];
}
return CompareMenuString(name,x.name)<0;
}
};
// Recent document item (sorts by time, newer first)
struct Document
{
CString name;
FILETIME time;
bool operator<( const Document &x ) const { return CompareFileTime(&time,&x.time)>0; }
};
LONG m_RefCount;
bool m_bSubMenu;
bool m_bRefreshPosted;
bool m_bDestroyed; // the menu is destroyed but not yet deleted
bool m_bTrackMouse;
int m_Options;
const StdMenuItem *m_pStdItem; // the first item
CMenuContainer *m_pParent; // parent menu
int m_ParentIndex; // the index of this menu in the parent (usually matches m_pParent->m_Submenu)
int m_Submenu; // the item index of the opened submenu
int m_SubShowTime; // the time when the submenu was shown
int m_HotItem;
int m_InsertMark;
bool m_bInsertAfter;
bool m_bHotArrow;
CString m_RegName; // name of the registry key to store the item order
PIDLIST_ABSOLUTE m_Path1a[2];
PIDLIST_ABSOLUTE m_Path2a[2];
CComPtr<IShellFolder> m_pDropFoldera[2]; // the primary folder (used only as a drop target)
CMenuAccessible *m_pAccessible;
std::vector<int> m_ColumnOffsets;
std::vector<MenuItem> m_Items; // all items in the menu (including separators)
CComQIPtr<IContextMenu2> m_pMenu2; // additional interfaces used when a context menu is displayed
CComQIPtr<IContextMenu3> m_pMenu3;
int m_DragHoverTime;
int m_DragHoverItem;
int m_DragIndex; // the index of the item being dragged
CComPtr<IDropTargetHelper> m_pDropTargetHelper; // to show images while dragging
CComPtr<IDataObject> m_pDragObject;
int m_ClickIndex; // the index of the last clicked item (-2 until the mouse enters the menu for the first time)
DWORD m_HotPos; // last mouse position over a hot item (used to ignore WM_MOUSEMOVE when the mouse didn't really move)
int m_HoverItem; // item under the mouse (used for opening a submenu when the mouse hovers over an item)
int m_ContextItem; // force this to be the hot item while a context menu is up
HBITMAP m_Bitmap; // the background bitmap
HBITMAP m_ArrowsBitmap[4]; // normal, selected, normal2, selected2
HFONT m_Font[4]; // first, second, first separator, second separator
HRGN m_Region; // the outline region
int m_MaxWidth;
bool m_bTwoColumns;
RECT m_rContent;
RECT m_rContent2;
int m_ItemHeight[2];
int m_MaxItemWidth[2];
int m_IconTopOffset[2]; // offset from the top of the item to the top of the icon
int m_TextTopOffset[4]; // offset from the top of the item to the top of the text
RECT m_rUser1; // the user image (0,0,0,0 if the user image is not shown)
RECT m_rUser2; // the user name (0,0,0,0 if the user name is not shown)
RECT m_rPadding; // padding in the menu where right-click is possible
int m_ScrollCount; // number of items to scroll in the pager
int m_ScrollHeight; // 0 - don't scroll
int m_ScrollOffset;
int m_ScrollButtonSize;
int m_MouseWheel;
bool m_bScrollUp, m_bScrollDown;
bool m_bScrollUpHot, m_bScrollDownHot;
bool m_bScrollTimer;
bool m_bNoSearchDraw;
bool m_bSearchDrawn;
bool m_bInSearchUpdate;
bool m_bSearchShowAll;
int m_SearchIndex;
CWindow m_SearchBox;
HBITMAP m_SearchIcons;
struct SearchItem
{
CString name; // all caps (if blank, the item must be ignored)
PIDLIST_ABSOLUTE pidl;
int rank;
mutable int icon;
bool bMetroLink;
bool MatchText( const wchar_t *search ) const;
bool operator<( const SearchItem &item ) const { return rank>item.rank || (rank==item.rank && wcscmp(name,item.name)<0); }
};
std::vector<SearchItem> m_SearchItems;
unsigned int m_ResultsHash;
void InitItems( const std::vector<SearchItem> &items, const wchar_t *search );
// additional commands for the context menu
enum
{
CMD_OPEN=1,
CMD_OPEN_ALL,
CMD_SORT,
CMD_AUTOSORT,
CMD_NEWFOLDER,
CMD_NEWSHORTCUT,
CMD_DELETEMRU,
CMD_DELETEALL,
CMD_EXPLORE,
CMD_PIN,
CMD_LAST,
CMD_MAX=32767
};
// ways to activate a menu item
enum TActivateType
{
ACTIVATE_SELECT, // just selects the item
ACTIVATE_OPEN, // opens the submenu or selects if not a menu
ACTIVATE_OPEN_KBD, // same as above, but when done with a keyboard
ACTIVATE_OPEN_SEARCH, // opens the search results submenu
ACTIVATE_EXECUTE, // executes the item
ACTIVATE_MENU, // shows context menu
ACTIVATE_MENU_BACKGROUND, // shows context menu for the menu itself
ACTIVATE_RENAME, // renames the item
ACTIVATE_DELETE, // deletes the item
ACTIVATE_PROPERTIES, // shows the properties of the item
};
// sound events
enum TMenuSound
{
SOUND_MAIN,
SOUND_POPUP,
SOUND_COMMAND,
SOUND_DROP,
};
// search state
enum TSearchState
{
SEARCH_NONE, // the search is inactive
SEARCH_BLANK, // the search box has the focus but is blank
SEARCH_TEXT, // the search box has the focus and is not blank
SEARCH_MORE, // there are too many search results
};
TSearchState m_SearchState;
enum
{
// timer ID
TIMER_HOVER=1,
TIMER_HOVER_SPLIT=2,
TIMER_SCROLL=3,
TIMER_TOOLTIP_SHOW=4,
TIMER_TOOLTIP_HIDE=5,
TIMER_BALLOON_HIDE=6,
MCM_REFRESH=WM_USER+10, // posted to force the container to refresh its contents
MCM_SETCONTEXTITEM=WM_USER+11, // sets the item for the context menu. wParam is the nameHash of the item
MCM_REDRAWEDIT=WM_USER+12, // redraw the search edit box
MCM_REFRESHICONS=WM_USER+13, // refreshes the icon list and redraws all menus
MCM_SETHOTITEM=WM_USER+14, // sets the hot item
// some constants
SEPARATOR_HEIGHT=8,
MIN_SCROLL_HEIGHT=13, // the scroll buttons are at least this tall
MAX_MENU_ITEMS=500,
MENU_ANIM_SPEED=200,
MENU_ANIM_SPEED_SUBMENU=100,
MENU_FADE_SPEED=400,
MRU_PROGRAMS_COUNT=20,
MRU_DEFAULT_COUNT=5,
};
void AddFirstFolder( CComPtr<IShellFolder> pFolder, PIDLIST_ABSOLUTE path, std::vector<MenuItem> &items, int options, unsigned int hash0 );
void AddSecondFolder( CComPtr<IShellFolder> pFolder, PIDLIST_ABSOLUTE path, std::vector<MenuItem> &items, int options, unsigned int hash0 );
// pPt - optional point in screen space (used only by ACTIVATE_EXECUTE and ACTIVATE_MENU)
void ActivateItem( int index, TActivateType type, const POINT *pPt, bool bNoModifiers=false );
void RunUserCommand( bool bPicture );
void ShowKeyboardCues( void );
void SetActiveWindow( void );
void CreateBackground( int width1, int width2, int height1, int height2 ); // width1/2, height1/2 - the first and second content area
void CreateSubmenuRegion( int width, int height ); // width, height - the content area
void PostRefreshMessage( void );
void SaveItemOrder( const std::vector<SortMenuItem> &items );
void LoadItemOrder( void );
void AddMRUShortcut( const wchar_t *path );
void DeleteMRUShortcut( const wchar_t *path );
void SaveMRUShortcuts( void );
void LoadMRUShortcuts( void );
void FadeOutItem( int index );
bool GetItemRect( int index, RECT &rc );
int HitTest( const POINT &pt, bool bDrop=false );
bool DragOut( int index );
void InvalidateItem( int index );
void SetHotItem( int index, bool bArrow=false );
void SetInsertMark( int index, bool bAfter );
bool GetInsertRect( RECT &rc );
void DrawBackground( HDC hdc, const RECT &drawRect );
bool GetDescription( int index, wchar_t *text, int size );
void UpdateScroll( void );
void UpdateScroll( const POINT *pt );
void PlayMenuSound( TMenuSound sound );
bool CanSelectItem( const MenuItem &item );
void CollectSearchItems( void );
void SetSearchState( TSearchState state );
void UpdateSearchResults( bool bForceShowAll );
void AddStandardItems( void );
void UpdateAccelerators( int first, int last );
void ExecuteCommandElevated( const wchar_t *command );
void OpenSubMenu( int index, TActivateType type, bool bShift );
enum
{
COLLECT_RECURSIVE =1, // go into subfolders
COLLECT_PROGRAMS =2, // only collect programs (.exe, .com, etc)
COLLECT_FOLDERS =4, // include folder items
COLLECT_METRO =8, // check for metro links (non-recursive)
};
void CollectSearchItemsInt( IShellFolder *pFolder, PIDLIST_ABSOLUTE pidl, int flags, int &count );
static int s_MaxRecentDocuments; // limit for the number of recent documents
static int s_ScrollMenus; // global scroll menus setting
static bool s_bRTL; // RTL layout
static bool s_bKeyboardCues; // show keyboard cues
static bool s_bOverrideFirstDown; // the first down key from the search box will select the top item
static bool s_bExpandRight; // prefer expanding submenus to the right
static bool s_bRecentItems; // show and track recent items
static bool s_bBehindTaskbar; // the main menu is behind the taskbar (when the taskbar is horizontal)
static bool s_bShowTopEmpty; // shows the empty item on the top menu so the user can drag items there
static bool s_bNoDragDrop; // disables drag/drop
static bool s_bNoContextMenu; // disables the context menu
static bool s_bExpandLinks; // expand links to folders
static bool s_bSearchSubWord; // the search will match parts of words
static bool s_bLogicalSort; // use StrCmpLogical instead of CompareString
static bool s_bExtensionSort; // sort file names by extension
static bool s_bAllPrograms; // this is the All Programs menu of the Windows start menu
static bool s_bNoCommonFolders; // don't show the common folders (start menu and programs)
static char s_bActiveDirectory; // the Active Directory services are available (-1 - uninitialized)
static bool s_bPreventClosing; // prevents the menus from closing even if they lose focus
static bool s_bDisableHover; // disable hovering while the search box has the focus
static CMenuContainer *s_pDragSource; // the source of the current drag operation
static bool s_bRightDrag; // dragging with the right mouse button
static RECT s_MainRect; // area of the main monitor
static DWORD s_TaskbarState; // the state of the taskbar (ABS_AUTOHIDE and ABS_ALWAYSONTOP)
static DWORD s_HoverTime;
static DWORD s_SplitHoverTime;
static DWORD s_XMouse;
static DWORD s_SubmenuStyle;
static CLIPFORMAT s_ShellFormat; // CFSTR_SHELLIDLIST
static CComPtr<IShellFolder> s_pDesktop; // cached pointer of the desktop object
static CComPtr<IKnownFolderManager> s_pKnownFolders;
static int s_TaskBarId;
static HWND s_TaskBar, s_StartButton; // the current taskbar and start button
static HWND s_LastFGWindow; // stores the foreground window to restore later when the menu closes
static HTHEME s_Theme;
static HTHEME s_PagerTheme;
static CWindow s_Tooltip;
static CWindow s_TooltipBalloon;
static int s_TipShowTime;
static int s_TipHideTime;
static int s_TipShowTimeFolder;
static int s_TipHideTimeFolder;
static int s_HotItem;
static CMenuContainer *s_pHotMenu; // the menu with the hot item
static int s_TipItem; // the item that needs a tooltip
static CMenuContainer *s_pTipMenu;
static std::vector<CMenuContainer*> s_Menus; // all menus, in cascading order
static volatile HWND s_FirstMenu;
static std::map<unsigned int,int> s_MenuScrolls; // scroll offset for each sub menu
static CString s_MRUShortcuts[MRU_PROGRAMS_COUNT];
struct ItemRank
{
unsigned int hash; // hash of the item name in caps
int rank; // number of times it was used
bool operator<( const ItemRank &rank ) const { return hash<rank.hash; }
};
static std::vector<ItemRank> s_ItemRanks;
static void SaveItemRanks( void );
static void LoadItemRanks( void );
static void AddItemRank( unsigned int hash );
static wchar_t s_JumpAppId[_MAX_PATH];
static CJumpList s_JumpList;
static MenuSkin s_Skin;
friend class COwnerWindow;
friend class CMenuAccessible;
friend LRESULT CALLBACK SubclassTopMenuProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData );
static int CompareMenuString( const wchar_t *str1, const wchar_t *str2 );
static void MarginsBlit( HDC hSrc, HDC hDst, const RECT &rSrc, const RECT &rDst, const RECT &rMargins, bool bAlpha );
static void UpdateUsedIcons( void );
static LRESULT CALLBACK SubclassSearchBox( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData );
// To control the placement of the start menu, send ClassicStartMenu.StartMenuMsg message right after the start menu is created but before it is displayed
// The lParam must point to StartMenuParams
// monitorRect - the entire area available to the start menu (sub-menus will use it). It is usually the monitor area but can be less if the Desktop app is docked in Win8
// uEdge - the location of the taskbar - ABE_BOTTOM, ABE_LEFT, etc
// taskbarRect - the bounding box of the taskbar. When the taskbar is at the top or bottom, the main menu will try to not overlap that rect. When the taskbar is on the side the behavior depends on the ShowNextToTaskbar setting
// startButtonRect - the bounding box of the start button. When the taskbar is on the side the main menu will appear below that box if ShowNextToTaskbar is not set
// taskbar - the taskbar window (optional). The main menu will try to stay in front of that window
// startButton - the start button window (optional). The main menu will try to stay behind that window
struct StartMenuParams
{
HWND startButton;
HWND taskbar;
RECT startButtonRect;
RECT taskbarRect;
RECT monitorRect;
DWORD uEdge;
};
static StartMenuParams s_StartMenuParams;
static UINT s_StartMenuMsg;
};
class CMenuFader: public CWindowImpl<CMenuFader>
{
public:
CMenuFader( HBITMAP bmp, HRGN region, int duration, RECT &rect );
~CMenuFader( void );
DECLARE_WND_CLASS_EX(L"ClassicShell.CMenuFader",0,COLOR_MENU)
// message handlers
BEGIN_MSG_MAP( CMenuFader )
MESSAGE_HANDLER( WM_ERASEBKGND, OnEraseBkgnd )
MESSAGE_HANDLER( WM_TIMER, OnTimer )
END_MSG_MAP()
void Create( void );
static void ClearAll( void );
protected:
LRESULT OnEraseBkgnd( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
LRESULT OnTimer( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
virtual void OnFinalMessage( HWND ) { PostQuitMessage(0); delete this; }
private:
int m_Time0;
int m_Duration;
int m_LastTime;
HBITMAP m_Bitmap;
HRGN m_Region;
RECT m_Rect;
static std::vector<CMenuFader*> s_Faders;
};
const RECT DEFAULT_SEARCH_PADDING={4,4,4,4};
| 40.170667 | 228 | 0.732873 | [
"object",
"vector"
] |
1144f140fc3e995f4f8532b6b4d4f5af00a0e3fe | 3,083 | h | C | gui/include/fruitcandy/core/value.h | silmerusse/fudge_pathfinding | eb1d300d6712af69a684d3f4f511cf3961ee827c | [
"MIT"
] | 63 | 2015-09-07T10:34:36.000Z | 2022-01-02T09:18:13.000Z | gui/include/fruitcandy/core/value.h | silmerusse/fudge_pathfinding | eb1d300d6712af69a684d3f4f511cf3961ee827c | [
"MIT"
] | 1 | 2018-04-30T08:42:34.000Z | 2018-05-19T02:25:34.000Z | gui/include/fruitcandy/core/value.h | silmerusse/fudge_pathfinding | eb1d300d6712af69a684d3f4f511cf3961ee827c | [
"MIT"
] | 20 | 2015-05-23T09:13:00.000Z | 2021-12-08T10:30:37.000Z | #ifndef FRUITCANDY_CORE_VALUE_H_
#define FRUITCANDY_CORE_VALUE_H_
#include <string>
#include <vector>
#include <map>
#include <memory>
#include <boost/any.hpp>
#include "../util/log.h"
class Value {
protected:
boost::any v_;
public:
Value() : v_(boost::any()) {}
Value(const boost::any &v) : v_(v) {}
Value(std::vector<std::unique_ptr<Value>> list) {
list_.reset(new std::vector<std::unique_ptr<Value>>(std::move(list)));
}
Value(std::map<std::string, std::unique_ptr<Value>> dict) {
dict_.reset(new std::map<std::string, std::unique_ptr<Value>>(std::move(dict)));
}
virtual ~Value() = default;
public:
virtual Value* get(int index) {
return as_list().at(index).get();
}
virtual Value* get(const std::string &key) {
return as_dict().at(key).get();
}
virtual int get_int(int index) {
return as_list().at(index)->as_int();
}
virtual int get_int(const std::string &key) {
return as_dict().at(key)->as_int();
}
virtual double get_double(int index) {
return as_list().at(index)->as_double();
}
virtual double get_double(const std::string &key) {
return as_dict().at(key)->as_double();
}
virtual std::string get_string(int index) {
return as_list().at(index)->as_string();
}
virtual std::string get_string(const std::string &key) {
return as_dict().at(key)->as_string();
}
virtual int as_int() const {
return boost::any_cast<int>(v_);
}
virtual double as_double() const {
return boost::any_cast<double>(v_);
}
virtual const std::string as_string() const {
return boost::any_cast<const std::string>(v_);
}
virtual void append(std::unique_ptr<Value> value) {
as_list().push_back(std::move(value));
}
virtual void append(const boost::any &v) {
std::unique_ptr<Value> value(new Value(v));
append(std::move(value));
}
virtual void insert(std::pair<std::string, std::unique_ptr<Value>> pair) {
as_dict().emplace(std::move(pair));
}
virtual bool has(const std::string &key) const {
if (dict_)
return dict_->find(key) != dict_->end();
else throw; // Not a dict.
}
virtual int length() const {
if (list_)
return list_->size();
else if (dict_)
return dict_->size();
else
throw; // Not a list or dict.
}
virtual bool empty() const {
if (list_)
return list_->empty();
else if (dict_)
return dict_->empty();
else throw; // Not a list or dict.
}
virtual std::vector<std::unique_ptr<Value>>& as_list() {
if (list_)
return *list_;
else throw; // Not a list.
}
virtual std::map<std::string, std::unique_ptr<Value>>& as_dict() {
if (dict_)
return *dict_;
else throw; // Not a dict.
}
protected:
std::unique_ptr<std::vector<std::unique_ptr<Value>>> list_ = nullptr;
std::unique_ptr<std::map<std::string, std::unique_ptr<Value>>> dict_ = nullptr;
public:
static std::unique_ptr<Value> create(const boost::any &v) {
return std::move(std::unique_ptr<Value>(new Value(v)));
}
};
#endif /* FRUITCANDY_CORE_VALUE_H_ */
| 23.715385 | 84 | 0.63542 | [
"vector"
] |
114bf5baeca5fe73caba7735eeb521dc139f8472 | 415 | h | C | src/GhostOverlay.h | LiquidityC/deadgaem | 3d970ce09e26115e002b391524584eab0583af37 | [
"WTFPL"
] | 1 | 2016-02-18T23:05:13.000Z | 2016-02-18T23:05:13.000Z | src/GhostOverlay.h | LiquidityC/deadgaem | 3d970ce09e26115e002b391524584eab0583af37 | [
"WTFPL"
] | null | null | null | src/GhostOverlay.h | LiquidityC/deadgaem | 3d970ce09e26115e002b391524584eab0583af37 | [
"WTFPL"
] | 1 | 2020-05-13T09:39:51.000Z | 2020-05-13T09:39:51.000Z | #ifndef GHOSTOVERLAY_H_
#define GHOSTOVERLAY_H_
#include <flat/flat.h>
#include "GameSettings.h"
class GhostOverlay : public flat2d::Entity
{
private:
bool visible = false;
public:
GhostOverlay() : Entity(0, 0, GameSettings::SCREEN_WIDTH, GameSettings::SCREEN_HEIGHT) { }
void render(const flat2d::RenderData*) const;
bool isVisible();
void setVisible(bool visible);
};
#endif // GHOSTOVERLAY_H_
| 18.043478 | 92 | 0.73494 | [
"render"
] |
114e9b3ddc7c66b4341fd328ba1bf592aeb36830 | 2,435 | h | C | Plugins/HyperTreeGridADR/HyperTreeGridFilters/vtkMedianAccumulator.h | mmansell7/ParaView | f7ba718b4ab0495840409ceddb8077dc6dc295d7 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | Plugins/HyperTreeGridADR/HyperTreeGridFilters/vtkMedianAccumulator.h | mmansell7/ParaView | f7ba718b4ab0495840409ceddb8077dc6dc295d7 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | Plugins/HyperTreeGridADR/HyperTreeGridFilters/vtkMedianAccumulator.h | mmansell7/ParaView | f7ba718b4ab0495840409ceddb8077dc6dc295d7 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | /*=========================================================================
Program: Visualization Toolkit
Module: vtkMedianAccumulator.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkMedianAccumulator
* @brief accumulates input data in a sorted array
*
* Accumulator for computing the median of the input data.
* Inserting data is logarithmic in function of the input size,
* while merging has a linear complexity.
* Accessing the median from accumulated data has constant complexity
*
*/
#ifndef vtkMedianAccumulator_h
#define vtkMedianAccumulator_h
#include "vtkAbstractAccumulator.h"
#include "vtkFiltersHyperTreeGridADRModule.h" // For export macro
#include <vector>
class VTKFILTERSHYPERTREEGRIDADR_EXPORT vtkMedianAccumulator : public vtkAbstractAccumulator
{
public:
static vtkMedianAccumulator* New();
vtkTypeMacro(vtkMedianAccumulator, vtkAbstractAccumulator);
void PrintSelf(ostream& os, vtkIndent indent) override;
using Superclass::Add;
//@{
/**
* Methods for adding data to the accumulator.
*/
virtual void Add(vtkAbstractAccumulator* accumulator) override;
virtual void Add(double value) override;
//@}
//@{
/**
* Accessor to the accumulated value.
*/
virtual double GetValue() const override;
//@}
//@{
/**
* Set object into initial state
*/
virtual void Initialize() override;
//@}
//@{
/**
* Getter of internally stored sorted list of values
*/
std::vector<double>& GetSortedList() { return this->SortedList; }
const std::vector<double>& GetSortedList() const { return this->SortedList; }
//@}
protected:
//@{
/**
* Default constructor and destructor.
*/
vtkMedianAccumulator() = default;
virtual ~vtkMedianAccumulator() override = default;
//@}
//@{
/**
* Accumulated sorted list of values
*/
std::vector<double> SortedList;
//@}
private:
vtkMedianAccumulator(const vtkMedianAccumulator&) = delete;
void operator=(const vtkMedianAccumulator&) = delete;
};
#endif
| 25.103093 | 92 | 0.670637 | [
"object",
"vector"
] |
115653abfe6ce9317376008986270cf4158be76a | 4,028 | h | C | src/profiling/memory/bookkeeping_dump.h | ztlevi/perfetto | a0de991bf39c5744ab4eef00eae823c378eb99a9 | [
"Apache-2.0"
] | 933 | 2019-12-10T10:45:28.000Z | 2022-03-31T03:43:44.000Z | src/profiling/memory/bookkeeping_dump.h | ztlevi/perfetto | a0de991bf39c5744ab4eef00eae823c378eb99a9 | [
"Apache-2.0"
] | 252 | 2019-12-10T16:13:57.000Z | 2022-03-31T09:56:46.000Z | src/profiling/memory/bookkeeping_dump.h | ztlevi/perfetto | a0de991bf39c5744ab4eef00eae823c378eb99a9 | [
"Apache-2.0"
] | 153 | 2020-01-08T20:17:27.000Z | 2022-03-30T20:53:21.000Z | /*
* Copyright (C) 2019 The Android Open Source Project
*
* 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 SRC_PROFILING_MEMORY_BOOKKEEPING_DUMP_H_
#define SRC_PROFILING_MEMORY_BOOKKEEPING_DUMP_H_
#include <cinttypes>
#include <functional>
#include <set>
#include "perfetto/ext/tracing/core/trace_writer.h"
#include "src/profiling/common/interner.h"
#include "src/profiling/common/interning_output.h"
#include "src/profiling/memory/bookkeeping.h"
#include "protos/perfetto/trace/interned_data/interned_data.pbzero.h"
#include "protos/perfetto/trace/profiling/profile_common.pbzero.h"
#include "protos/perfetto/trace/profiling/profile_packet.pbzero.h"
#include "protos/perfetto/trace/trace_packet.pbzero.h"
namespace perfetto {
namespace profiling {
class DumpState {
public:
DumpState(
TraceWriter* trace_writer,
std::function<void(protos::pbzero::ProfilePacket::ProcessHeapSamples*)>
process_fill_header,
InterningOutputTracker* intern_state)
: trace_writer_(trace_writer),
intern_state_(intern_state),
current_process_fill_header_(std::move(process_fill_header)) {
MakeProfilePacket();
}
// This should be a temporary object, only used on the stack for dumping a
// single process.
DumpState(const DumpState&) = delete;
DumpState& operator=(const DumpState&) = delete;
DumpState(DumpState&&) = delete;
DumpState& operator=(DumpState&&) = delete;
void WriteAllocation(const HeapTracker::CallstackAllocations& alloc,
bool dump_at_max_mode);
void DumpCallstacks(GlobalCallstackTrie* callsites);
private:
void WriteMap(const Interned<Mapping> map);
void WriteFrame(const Interned<Frame> frame);
void WriteBuildIDString(const Interned<std::string>& str);
void WriteMappingPathString(const Interned<std::string>& str);
void WriteFunctionNameString(const Interned<std::string>& str);
void MakeTracePacket() {
last_written_ = trace_writer_->written();
if (current_trace_packet_)
current_trace_packet_->Finalize();
current_trace_packet_ = trace_writer_->NewTracePacket();
current_trace_packet_->set_timestamp(
static_cast<uint64_t>(base::GetBootTimeNs().count()));
current_profile_packet_ = nullptr;
current_interned_data_ = nullptr;
current_process_heap_samples_ = nullptr;
}
void MakeProfilePacket() {
MakeTracePacket();
current_profile_packet_ = current_trace_packet_->set_profile_packet();
uint64_t* next_index = intern_state_->HeapprofdNextIndexMutable();
current_profile_packet_->set_index((*next_index)++);
}
uint64_t currently_written() {
return trace_writer_->written() - last_written_;
}
protos::pbzero::ProfilePacket::ProcessHeapSamples*
GetCurrentProcessHeapSamples();
protos::pbzero::InternedData* GetCurrentInternedData();
std::set<GlobalCallstackTrie::Node*> callstacks_to_dump_;
TraceWriter* trace_writer_;
InterningOutputTracker* intern_state_;
protos::pbzero::ProfilePacket* current_profile_packet_ = nullptr;
protos::pbzero::InternedData* current_interned_data_ = nullptr;
TraceWriter::TracePacketHandle current_trace_packet_;
protos::pbzero::ProfilePacket::ProcessHeapSamples*
current_process_heap_samples_ = nullptr;
std::function<void(protos::pbzero::ProfilePacket::ProcessHeapSamples*)>
current_process_fill_header_;
uint64_t last_written_ = 0;
};
} // namespace profiling
} // namespace perfetto
#endif // SRC_PROFILING_MEMORY_BOOKKEEPING_DUMP_H_
| 34.42735 | 77 | 0.759434 | [
"object"
] |
11685b726d2c1c7419186f1d05df426ebef98e53 | 4,988 | c | C | extern/gtk/demos/gtk-demo/pixbufpaintable.c | PableteProgramming/download | 013e35bb5c085e5dfdb57a3a0a39cdf2fd3064b8 | [
"MIT"
] | null | null | null | extern/gtk/demos/gtk-demo/pixbufpaintable.c | PableteProgramming/download | 013e35bb5c085e5dfdb57a3a0a39cdf2fd3064b8 | [
"MIT"
] | null | null | null | extern/gtk/demos/gtk-demo/pixbufpaintable.c | PableteProgramming/download | 013e35bb5c085e5dfdb57a3a0a39cdf2fd3064b8 | [
"MIT"
] | null | null | null | #include <gtk/gtk.h>
#include "pixbufpaintable.h"
struct _PixbufPaintable {
GObject parent_instance;
char *resource_path;
GdkPixbufAnimation *anim;
GdkPixbufAnimationIter *iter;
guint timeout;
};
enum {
PROP_RESOURCE_PATH = 1,
NUM_PROPERTIES
};
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
static void
pixbuf_paintable_snapshot (GdkPaintable *paintable,
GdkSnapshot *snapshot,
double width,
double height)
{
PixbufPaintable *self = PIXBUF_PAINTABLE (paintable);
GTimeVal val;
GdkPixbuf *pixbuf;
GdkTexture *texture;
g_get_current_time (&val);
gdk_pixbuf_animation_iter_advance (self->iter, &val);
pixbuf = gdk_pixbuf_animation_iter_get_pixbuf (self->iter);
texture = gdk_texture_new_for_pixbuf (pixbuf);
gdk_paintable_snapshot (GDK_PAINTABLE (texture), snapshot, width, height);
g_object_unref (texture);
}
G_GNUC_END_IGNORE_DEPRECATIONS;
static int
pixbuf_paintable_get_intrinsic_width (GdkPaintable *paintable)
{
PixbufPaintable *self = PIXBUF_PAINTABLE (paintable);
return gdk_pixbuf_animation_get_width (self->anim);
}
static int
pixbuf_paintable_get_intrinsic_height (GdkPaintable *paintable)
{
PixbufPaintable *self = PIXBUF_PAINTABLE (paintable);
return gdk_pixbuf_animation_get_height (self->anim);
}
static void
pixbuf_paintable_init_interface (GdkPaintableInterface *iface)
{
iface->snapshot = pixbuf_paintable_snapshot;
iface->get_intrinsic_width = pixbuf_paintable_get_intrinsic_width;
iface->get_intrinsic_height = pixbuf_paintable_get_intrinsic_height;
}
G_DEFINE_TYPE_WITH_CODE(PixbufPaintable, pixbuf_paintable, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
pixbuf_paintable_init_interface))
static void
pixbuf_paintable_init (PixbufPaintable *paintable)
{
}
static gboolean
delay_cb (gpointer data)
{
PixbufPaintable *self = data;
int delay;
delay = gdk_pixbuf_animation_iter_get_delay_time (self->iter);
self->timeout = g_timeout_add (delay, delay_cb, self);
gdk_paintable_invalidate_contents (GDK_PAINTABLE (self));
return G_SOURCE_REMOVE;
}
static void
pixbuf_paintable_set_resource_path (PixbufPaintable *self,
const char *resource_path)
{
int delay;
g_free (self->resource_path);
self->resource_path = g_strdup (resource_path);
g_clear_object (&self->anim);
self->anim = gdk_pixbuf_animation_new_from_resource (resource_path, NULL);
g_clear_object (&self->iter);
self->iter = gdk_pixbuf_animation_get_iter (self->anim, NULL);
delay = gdk_pixbuf_animation_iter_get_delay_time (self->iter);
self->timeout = g_timeout_add (delay, delay_cb, self);
gdk_paintable_invalidate_contents (GDK_PAINTABLE (self));
g_object_notify (G_OBJECT (self), "resource-path");
}
static void
pixbuf_paintable_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
PixbufPaintable *self = PIXBUF_PAINTABLE (object);
switch (prop_id)
{
case PROP_RESOURCE_PATH:
pixbuf_paintable_set_resource_path (self, g_value_get_string (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
pixbuf_paintable_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
PixbufPaintable *self = PIXBUF_PAINTABLE (object);
switch (prop_id)
{
case PROP_RESOURCE_PATH:
g_value_set_string (value, self->resource_path);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
pixbuf_paintable_dispose (GObject *object)
{
PixbufPaintable *self = PIXBUF_PAINTABLE (object);
g_clear_pointer (&self->resource_path, g_free);
g_clear_object (&self->anim);
g_clear_object (&self->iter);
if (self->timeout)
{
g_source_remove (self->timeout);
self->timeout = 0;
}
G_OBJECT_CLASS (pixbuf_paintable_parent_class)->dispose (object);
}
static void
pixbuf_paintable_class_init (PixbufPaintableClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->dispose = pixbuf_paintable_dispose;
object_class->get_property = pixbuf_paintable_get_property;
object_class->set_property = pixbuf_paintable_set_property;
g_object_class_install_property (object_class, PROP_RESOURCE_PATH,
g_param_spec_string ("resource-path", "Resource path", "Resource path",
NULL, G_PARAM_READWRITE));
}
GdkPaintable *
pixbuf_paintable_new_from_resource (const char *path)
{
return g_object_new (PIXBUF_TYPE_PAINTABLE,
"resource-path", path,
NULL);
}
| 26.531915 | 80 | 0.697674 | [
"object"
] |
116d03e7c0649c6b992cdbc18e96cb95aaed9780 | 834 | h | C | CaptainAmericaAndTheAvengers/Game.h | nguyenlamlll/CaptainAmericaAndTheAvengers | 73494d11d59d8f3a08326e22fca0db4cf0b108eb | [
"MIT"
] | null | null | null | CaptainAmericaAndTheAvengers/Game.h | nguyenlamlll/CaptainAmericaAndTheAvengers | 73494d11d59d8f3a08326e22fca0db4cf0b108eb | [
"MIT"
] | null | null | null | CaptainAmericaAndTheAvengers/Game.h | nguyenlamlll/CaptainAmericaAndTheAvengers | 73494d11d59d8f3a08326e22fca0db4cf0b108eb | [
"MIT"
] | null | null | null | #pragma once
#include "GameManager.h"
#include "TextureManager.h"
#include "SpriteManager.h"
#include "Camera.h"
#include "Map.h"
#include "Text.h"
#include "CaptainAmerica.h"
class Game : public GameManager
{
private:
static Game* instance;
TextureManager *textureManager;
SpriteManager *spriteManger;
TextureManager *tileset;
MapInfo* mapInfo;
Map* map;
Camera* camera;
CaptainAmerica* captainAmerica;
// Utility texts
Text* fpsText;
Text* opsText;
public:
Game();
~Game();
static Game* getInstance();
void initialize(HWND hwnd);
void initialize(Graphics* graphics, Input* input);
void update(float dt); // must override pure virtual from Game
void handleInput(float dt);
void collisions(float dt); // "
void render(); // "
void releaseAll();
void resetAll();
HWND getCurrentHWND();
};
| 17.020408 | 68 | 0.709832 | [
"render"
] |
117067d3fecf9280f59833f8063bce6d1b0b426d | 512 | h | C | Leetcode/solutions/1684_CountTheNumberOfConsistentStrings.h | DmitriyMaksimov/leetcode | 52748f321273bcda0b2c4f01c27d804318af1c0e | [
"MIT"
] | null | null | null | Leetcode/solutions/1684_CountTheNumberOfConsistentStrings.h | DmitriyMaksimov/leetcode | 52748f321273bcda0b2c4f01c27d804318af1c0e | [
"MIT"
] | null | null | null | Leetcode/solutions/1684_CountTheNumberOfConsistentStrings.h | DmitriyMaksimov/leetcode | 52748f321273bcda0b2c4f01c27d804318af1c0e | [
"MIT"
] | null | null | null | /// 1684. Count the Number of Consistent Strings: https://leetcode.com/problems/count-the-number-of-consistent-strings/
class Solution_1684
{
public:
int countConsistentStrings(string allowed, vector<string>& words)
{
int count = 0;
const set<char> allowedSet(allowed.cbegin(), allowed.cend());
for (const auto& word: words)
{
if (all_of(word.cbegin(), word.cend(), [&allowedSet](char c) { return allowedSet.contains(c); })) ++count;
}
return count;
}
};
| 25.6 | 119 | 0.646484 | [
"vector"
] |
520de5805a741ec17b15eb13c80e3169785898ec | 675 | h | C | include/menu.h | TheTechdoodle/Vex-V5-TT2019 | 120407c89f7ffba3291cdbb35d4f485655fdba17 | [
"MIT"
] | null | null | null | include/menu.h | TheTechdoodle/Vex-V5-TT2019 | 120407c89f7ffba3291cdbb35d4f485655fdba17 | [
"MIT"
] | null | null | null | include/menu.h | TheTechdoodle/Vex-V5-TT2019 | 120407c89f7ffba3291cdbb35d4f485655fdba17 | [
"MIT"
] | null | null | null | #ifndef MCEC_V5_MENU_H
#define MCEC_V5_MENU_H
#include "displayLib/DisplayCore.h"
#include "displayLib/MenuScreen.h"
#include "displayLib/TextDisplayScreen.h"
#include "displayLib/MenuAction.h"
#include "autonomous.h"
/**
* Opens the main menu as a gateway to other menus
* Note: This is a blocking function!
*
* @param controller The DisplayController object to use for screen output
* @param master The PROS Controller object for button input
*/
void openMainMenu(DisplayController* controller, pros::Controller master);
void openAutoMenu(DisplayCore* core);
void openTempMenu(DisplayCore* core);
void openPosMenu(DisplayCore* core);
#endif //MCEC_V5_CONSTANTS_H | 29.347826 | 74 | 0.786667 | [
"object"
] |
521166aa3b074c422245080ab908c27afca7b989 | 8,429 | h | C | ccm/include/CORBA.h | anjingbin/starccm | 70db48004aa20bbb82cc24de80802b40c7024eff | [
"BSD-3-Clause"
] | 2 | 2020-01-06T07:43:30.000Z | 2020-07-11T20:53:53.000Z | ccm/include/CORBA.h | anjingbin/starccm | 70db48004aa20bbb82cc24de80802b40c7024eff | [
"BSD-3-Clause"
] | null | null | null | ccm/include/CORBA.h | anjingbin/starccm | 70db48004aa20bbb82cc24de80802b40c7024eff | [
"BSD-3-Clause"
] | null | null | null | // **********************************************************************
//
// Copyright (c) 2001-2004
// StarMiddleware.net
// www.StarMiddleware.net
//
// All Rights Reserved
//
// Author: Huang Jie huangjie@email.com
// Wang Kebo mep@263.net
// Su Liang centuryfree@yahoo.com.cn
//
// **********************************************************************
// Version: 1.0.0
#ifndef __CCM_CORBA_H__
#define __CCM_CORBA_H__
// Modified by WangKebo, for compilation on TAO
// Windows.h conflict with ACE/TAO, which included in Trace.h
// Move it to the end this file
//#include <Trace.h>
#ifndef WIN32
#include <dlfcn.h>
#endif
#ifdef WIN32
#define LOADLIBRARY ::LoadLibrary
#define GETPROCADDRESS ::GetProcAddress
#define HANDLEOFDLL HINSTANCE
#define CLOSEDLL ::FreeLibrary
#define PATH_DELILIMITOR "\\"
#define PATH_DELILIMITOR_CHAR '\\'
#else
#define LOADLIBRARY(filename) dlopen(filename,RTLD_NOW)
#define GETPROCADDRESS dlsym
#define HANDLEOFDLL void*
#define CLOSEDLL dlclose
#define PATH_DELILIMITOR "/"
#define PATH_DELILIMITOR_CHAR '/'
#endif
#ifdef DLL_LIB
#define CCM_IMPORT __declspec(dllimport)
#else
#define CCM_IMPORT
#endif
#ifdef ORBacus
#include <OB/CORBA.h>
#include <OB/Hashtable.h>
#include <OB/BootManager.h>
#include <OB/ObjectIdHasher.h>
//#include <OB/CosTransactionsUser_skel.h>
#include <OB/IFR.h>
#include <OB/CosNaming.h>
#include <JTC/JTC.h>
namespace AppServer
{
typedef OB::SynchronizedHashtable< PortableServer::ObjectId,CORBA::Object_var,
OBPortableServer::ObjectIdHasher> OBJECTHASHTABLE;
}
namespace CORBA
{
typedef IRObject* IRObject_ptr;
};
#define OBJVAR(CLASSNAME) typedef OB::ObjVar< CLASSNAME > CLASSNAME##_var;
#define OBJPTR(CLASSNAME) typedef CLASSNAME * CLASSNAME##_ptr;
#define REF_COUNT_LOCAL_OBJECT public OBCORBA::RefCountLocalObject
#define LOCAL_OBJECT_BASE virtual public OBCORBA::LocalObjectBase
#define OBJDUPLICATE(CLASSNAME,OBJ) dynamic_cast< CLASSNAME >(HelpFun::ObjHelper::_duplicate( OBJ ))
#define OBJNIL(CLASSNAME,OBJ) dynamic_cast< CLASSNAME >(HelpFun::ObjHelper::_nil( OBJ ))
#if defined(STARCCM_MTL)
#define STARCCM_COMMA_MONITOR , public JTCMonitor
#define STARCCM_MONITOR(monitorLock_) JTCMonitor monitorLock_;
#define STARCCM_COMMA_RECURSIVE_MUTEX , virtual public JTCRecursiveMutex
#define STARCCM_RECURSIVE_MUTEX(mutex) JTCRecursiveMutex mutex;
#define STARCCM_RECURSIVE_MUTEX_CLASS JTCRecursiveMutex
#define STARCCM_SYNCHRONIZED(sync_,mon_) JTCSynchronized sync_(mon_);
#else
#define STARCCM_COMMA_MONITOR
#define STARCCM_MONITOR(monitorLock_)
#define STARCCM_COMMA_RECURSIVE_MUTEX
#define STARCCM_RECURSIVE_MUTEX(mutex)
#define STARCCM_RECURSIVE_MUTEX_CLASS
#define STARCCM_SYNCHRONIZED(sync_,mon_)
#endif
namespace HelpFun
{
class ObjHelper
{
public:
static OBCORBA::RefCountLocalObject*
_duplicate(OBCORBA::RefCountLocalObject* p)
{
if(p) p -> _OB_incRef(); return p;
}
static OBCORBA::RefCountLocalObject*
_nil(OBCORBA::RefCountLocalObject* p)
{
return 0;
}
};
}
#endif //End of ORBacus
#ifdef StarBus
#include <STAR/CORBA.h>
#include <STAR/ObjectIdHasher.h>
#include <STAR/AssistAdaptorManager.h>
#include <STAR/IFR.h>
#include <STAR/CosNaming.h>
#include <MTL/MTL.h>
namespace AppServer
{
}
namespace CORBA
{
typedef IRObject* IRObject_ptr;
};
#define OBJVAR(CLASSNAME) typedef STAR::ObjVar< CLASSNAME > CLASSNAME##_var;
#define OBJPTR(CLASSNAME) typedef CLASSNAME * CLASSNAME##_ptr;
#define REF_COUNT_LOCAL_OBJECT public CORBA::LocalObject
#define LOCAL_OBJECT_BASE public CORBA::LocalObject
#define OBJDUPLICATE(CLASSNAME,OBJ) dynamic_cast< CLASSNAME >(HelpFun::ObjHelper::_duplicate( OBJ ))
#define OBJNIL(CLASSNAME,OBJ) dynamic_cast< CLASSNAME >(HelpFun::ObjHelper::_nil( OBJ ))
#if defined(STARCCM_MTL)
#define STARCCM_COMMA_MONITOR , public MTLMonitor
#define STARCCM_MONITOR(monitorLock_) MTLMonitor monitorLock_;
#define STARCCM_COMMA_RECURSIVE_MUTEX ,virtual public MTLRecursiveMutex
#define STARCCM_RECURSIVE_MUTEX(mutex) MTLRecursiveMutex mutex;
#define STARCCM_RECURSIVE_MUTEX_CLASS MTLRecursiveMutex
#define STARCCM_SYNCHRONIZED(sync_,mon_) MTLSynchronized sync_(mon_);
#else
#define STARCCM_COMMA_MONITOR
#define STARCCM_MONITOR(monitorLock_)
#define STARCCM_COMMA_RECURSIVE_MUTEX
#define STARCCM_RECURSIVE_MUTEX(mutex)
#define STARCCM_RECURSIVE_MUTEX_CLASS
#define STARCCM_SYNCHRONIZED(sync_,mon_)
#endif
namespace HelpFun
{
class ObjHelper
{
public:
static CORBA::LocalObject*
_duplicate(CORBA::LocalObject* p)
{
if(p) p -> _add_ref(); return p;
}
static CORBA::LocalObject*
_nil(CORBA::LocalObject* p)
{
return 0;
}
};
}
#endif //End of Starbus
#ifdef TAO
#include <tao/corba.h>
#include <tao/PortableServer/PortableServer.h>
#include <tao/IORTable/IORTable.h>
#include <tao/DynamicC.h>
#include <tao/DynamicInterface/context.h>
#include <tao/DynamicInterface/Request.h>
#include <tao/DynamicInterface/ExceptionList.h>
#include <orbsvcs/CosNamingC.h>
#include <tao/DynamicAny/DynamicAny.h>
#include <tao/IFR_Client/IFR_BasicC.h>
#include <tao/IFR_Client/IFR_ExtendedC.h>
#include <tao/TypeCodeFactory/TypeCodeFactory_Adapter_Impl.h>
#include <string>
//namespace CORBA
//{
// typedef IRObject* IRObject_ptr;
//};
template<class T>
class ObjVar : public TAO_Base_var
{
T* ptr_;
ObjVar(const TAO_Base_var &rhs);
ObjVar &operator=(const TAO_Base_var &rhs);
public:
ObjVar(): ptr_(0)
{
}
ObjVar(T* p) : ptr_(p)
{
}
// ObjVar(const ObjVar<T>& p)
// :TAO_Base_var (), ptr_ (T::_duplicate(p.ptr ()))
// {
// };
~ObjVar()
{
// CORBA::release(ptr_);
ptr_ -> _remove_ref();
}
ObjVar& operator=(T*p)
{
CORBA::release(ptr_);
ptr_ = p;
return *this;
}
ObjVar& operator=(const ObjVar<T>& p)
{
if (ptr_ != p.ptr_)
{
CORBA::release(ptr_);
p -> _add_ref();
ptr_ = p.ptr_;
}
return *this;
}
T* operator->() const
{
return ptr_;
}
operator const T*&() const
{
return ptr_;
}
operator T*&()
{
return ptr_;
}
// in, inout, out, _retn
T* in() const
{
return ptr_;
}
T* &inout()
{
return ptr_;
}
T* &out()
{
CORBA::release(ptr_);
ptr_ = 0;
return ptr_;
}
T* _retn()
{
T* val = ptr_;
ptr_ = 0;
return val;
}
T* ptr() const
{
return ptr_;
}
/*
static T* tao_duplicate(T* p)
{
return T::_duplicate (p);
}
static void tao_release(T* p)
{
CORBA::release (p);
}
static T* tao_nil()
{
return T::_nil ();
}
static T* tao_narrow(CORBA::Object* p, CORBA::Environment& ACE_TRY_ENV)
{
return T::_narrow (p, ACE_TRY_ENV);
}
static CORBA::Object* tao_upcast(void* src)
{
T** tmp = ACE_static_cast (T**, src);
return *tmp;
}
*/
};
template <class T>
class VarOut
{
T*& ptr_;
public:
VarOut(T*& p)
: ptr_(p)
{
ptr_ = 0;
}
VarOut(ObjVar<T>& p)
: ptr_(p.out ())
{
CORBA::release (ptr_);
ptr_ = 0;
}
VarOut(const VarOut<T>& p)
: ptr_(ACE_const_cast(VarOut<T>&, p).ptr_)
{
}
VarOut& operator= (const VarOut<T>& p)
{
ptr_ = ACE_const_cast(VarOut<T>&, p).ptr_;
return *this;
}
VarOut& operator= (const ObjVar<T>& p)
{
p -> _add_ref();
ptr_ = p.ptr_;
return *this;
}
VarOut& operator=(T* p)
{
ptr_ = p;
return *this;
}
operator T*&()
{
return ptr_;
}
T*& ptr ()
{
return ptr_;
}
T* operator->()
{
return ptr_;
}
};
#define OBJVAR(CLASSNAME) typedef ObjVar< CLASSNAME > CLASSNAME##_var;
#define OBJPTR(CLASSNAME) typedef CLASSNAME * CLASSNAME##_ptr;
#define REF_COUNT_LOCAL_OBJECT public TAO_Local_RefCounted_Object
#define LOCAL_OBJECT_BASE public CORBA::LocalObject
#define OBJDUPLICATE(CLASSNAME,OBJ) dynamic_cast< CLASSNAME >(HelpFun::ObjHelper::_duplicate( OBJ ))
#define OBJNIL(CLASSNAME,OBJ) dynamic_cast< CLASSNAME >(HelpFun::ObjHelper::_nil( OBJ ))
namespace CORBA
{
typedef CORBA_ValueFactoryBase_var ValueFactoryBase_var;
}
#define STARCCMSTRINGADD 1
namespace HelpFun
{
class ObjHelper
{
public:
static CORBA::LocalObject*
_duplicate(CORBA::LocalObject* p)
{
if(p) p -> _add_ref(); return p;
}
static CORBA::LocalObject*
_nil(CORBA::LocalObject* p)
{
return 0;
}
};
static char*
CORBA_string_add(const char* s1, const char* s2)
{
std::string ss1(s1);
std::string ss2(s2);
ss1 = ss1 + ss2;
CORBA::String_var result = ss1.c_str();
return result._retn();
}
}
#endif //End of TAO
#include <Trace.h>
#endif
| 19.556845 | 100 | 0.699608 | [
"object"
] |
521af3d951557400f2e94d09bfa387919aa4870f | 2,786 | h | C | InfiniteRecharge/src/main/include/subsystems/Intake.h | NorthernForce/InfiniteRecharge | a6eb8129aee4aa959a12b3db9fba229ffbaaec7c | [
"MIT"
] | 1 | 2020-01-30T02:22:38.000Z | 2020-01-30T02:22:38.000Z | InfiniteRecharge/src/main/include/subsystems/Intake.h | NorthernForce/InfiniteRecharge | a6eb8129aee4aa959a12b3db9fba229ffbaaec7c | [
"MIT"
] | 5 | 2020-01-21T00:58:40.000Z | 2021-12-11T17:34:00.000Z | InfiniteRecharge/src/main/include/subsystems/Intake.h | NorthernForce/InfiniteRecharge | a6eb8129aee4aa959a12b3db9fba229ffbaaec7c | [
"MIT"
] | null | null | null | /*----------------------------------------------------------------------------*/
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <frc2/command/SubsystemBase.h>
#include <ctre/Phoenix.h>
#include <rev/CANSparkMax.h>
#include <frc/DigitalInput.h>
#include "Constants.h"
class Intake : public frc2::SubsystemBase {
public:
enum class ArmState {
armIsUp,
armIsDown
};
//"StorageState" = whether there is a PC (Ball) at a Conveyor Position
enum class StorageState {
PRESENT, //Have Ball
EMPTY //No Ball
};
const int noEmptyPositionFound = -1;
const int noFullPositionFound = -1;
Intake();
void InitMotorControllers();
void InitBallPositionSensors();
void Periodic();
void SetInvertedFollower();
void TakeInPowerCell();
void SetIntakeSpeed(double speed);
void PushOutPowerCell();
int GetPowerCellCount();
void Stop();
void SetArmUp();
void SetArmDown();
void SetArm(double speed);
double GetArmPosition();
ArmState GetArmState();
void RunConveyor();
void RunConveyorToShoot();
void StopConveyor();
void ConveyorSetSpeed(double speed);
void NewRunConveyer(double speed = Constants::Intake::normal);
double GetConveyerSpeed();
bool TrevinIntake();
bool NewTrevinIntake();
bool IsConveyorEmpty();
//Checks each Conveyor Storage Location and sets its "StorageState" in the array powerCellPosition
void InventoryPowerCells(); ///set array and then set a counter
//Returns the previously detemined "StorageState" of the specific Conveyor Storage Position (integer) given
StorageState GetInventory(int position);
//Return the First Position in the Conveyor Storage that is empty (no PC).
int GetFirstEmptyPosition();
int LowestFullPosition();
double speed;
private:
ArmState currentArmState;
StorageState powerCellPosition[5]; //changed to 5 from 6 //Holds the StorageState of the associated Conveyor Position
const bool ballDetected = false;
std::vector<frc::DigitalInput*> ballPosition;
std::shared_ptr<WPI_TalonSRX> intakeTalon;
std::shared_ptr<rev::CANSparkMax> armSpark;
std::shared_ptr<rev::CANSparkMax> primaryConveyorSpark;
std::shared_ptr<rev::CANSparkMax> followerConveyorSpark;
bool zeroHasBeenTripped = false;
bool fourHasBeenTripped = false;
bool ballOccupancy[5]; //changed from 6 to 5
int powerCellCount = 0;
double sparkSpeed;
}; | 31.659091 | 120 | 0.661522 | [
"vector"
] |
52232ca927fb51cf854644adc5ed01b8fce4782f | 1,959 | h | C | src/prod/src/Management/BackupRestore/BA/DownloadBackupMessageBody.h | gridgentoo/ServiceFabricAzure | c3e7a07617e852322d73e6cc9819d266146866a4 | [
"MIT"
] | 2,542 | 2018-03-14T21:56:12.000Z | 2019-05-06T01:18:20.000Z | src/prod/src/Management/BackupRestore/BA/DownloadBackupMessageBody.h | gridgentoo/ServiceFabricAzure | c3e7a07617e852322d73e6cc9819d266146866a4 | [
"MIT"
] | 994 | 2019-05-07T02:39:30.000Z | 2022-03-31T13:23:04.000Z | src/prod/src/Management/BackupRestore/BA/DownloadBackupMessageBody.h | gridgentoo/ServiceFabricAzure | c3e7a07617e852322d73e6cc9819d266146866a4 | [
"MIT"
] | 300 | 2018-03-14T21:57:17.000Z | 2019-05-06T20:07:00.000Z | // ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------
#pragma once
namespace Management
{
namespace BackupRestoreAgentComponent
{
class DownloadBackupMessageBody :
public Serialization::FabricSerializable
{
public:
DownloadBackupMessageBody();
~DownloadBackupMessageBody();
__declspec(property(get = get_StoreInfo, put = set_StoreInfo)) BackupStoreInfo StoreInfo;
BackupStoreInfo get_StoreInfo() const { return storeInfo_; }
void set_StoreInfo(BackupStoreInfo value) { storeInfo_ = value; }
__declspec(property(get = get_DestinationRootPath, put = set_DestinationRootPath)) wstring DestinationRootPath;
wstring get_DestinationRootPath() const { return destinationRootPath_; }
void set_DestinationRootPath(wstring value) { destinationRootPath_ = value; }
__declspec(property(get = get_BackupLocationList)) std::vector<std::wstring> & BackupLocationList;
std::vector<std::wstring> get_BackupLocationList() const { return backupLocationList_; }
Common::ErrorCode FromPublicApi(FABRIC_BACKUP_DOWNLOAD_INFO const &, FABRIC_BACKUP_STORE_INFORMATION const &);
Common::ErrorCode ToPublicApi(__in Common::ScopedHeap & heap, __out FABRIC_BACKUP_DOWNLOAD_INFO &, __out FABRIC_BACKUP_STORE_INFORMATION &) const;
FABRIC_FIELDS_03(
storeInfo_,
backupLocationList_,
destinationRootPath_);
private:
BackupStoreInfo storeInfo_;
wstring destinationRootPath_;
std::vector<std::wstring> backupLocationList_;
};
}
}
| 42.586957 | 158 | 0.632466 | [
"vector"
] |
52309a1c4e4d6934c3d76c16897a2a92147a01ed | 3,853 | h | C | src/bio/volume_io.h | hsungyang/poseidonos | 0f523b36ccf0d70726364395ea96ac6ae3b845c3 | [
"BSD-3-Clause"
] | 38 | 2021-04-06T03:20:55.000Z | 2022-03-02T09:33:28.000Z | src/bio/volume_io.h | gye-ul/poseidonos | bce8fe2cd1f36ede8647446ecc4cf8a9749e6918 | [
"BSD-3-Clause"
] | 19 | 2021-04-08T02:27:44.000Z | 2022-03-23T00:59:04.000Z | src/bio/volume_io.h | gye-ul/poseidonos | bce8fe2cd1f36ede8647446ecc4cf8a9749e6918 | [
"BSD-3-Clause"
] | 28 | 2021-04-08T04:39:18.000Z | 2022-03-24T05:56:00.000Z | /*
* BSD LICENSE
* Copyright (c) 2021 Samsung Electronics Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Samsung Electronics Corporation nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include <list>
#include <string>
#include <vector>
#include "src/bio/ubio.h"
#include "src/include/smart_ptr_type.h"
struct pos_io;
namespace pos
{
using VirtualBlockHandler = void (*)(VirtualBlks&);
struct RbaAndSize
{
uint64_t sectorRba;
uint64_t size;
inline bool
operator==(RbaAndSize input) const
{
return (input.sectorRba == sectorRba && input.size == size);
}
inline bool
operator<(RbaAndSize input) const
{
return (sectorRba < input.sectorRba);
}
};
class VolumeIo : public Ubio
{
public:
using RbaList = std::list<RbaAndSize>;
using RbaListIter = RbaList::iterator;
VolumeIo(void) = delete;
VolumeIo(void* buffer, uint32_t unitCount, int arrayId);
VolumeIo(const VolumeIo& volumeIo);
~VolumeIo(void) override;
virtual VolumeIoSmartPtr Split(uint32_t sectors, bool removalFromTail);
virtual VolumeIoSmartPtr GetOriginVolumeIo(void);
virtual uint32_t GetVolumeId(void);
void SetVolumeId(uint32_t inputVolumeId);
bool IsPollingNecessary(void);
uint32_t GetOriginCore(void) override;
virtual void SetLsidEntry(StripeAddr& lsidEntry);
void SetOldLsidEntry(StripeAddr& lsidEntry);
virtual const StripeAddr& GetLsidEntry(void);
virtual const StripeAddr& GetOldLsidEntry(void);
virtual const VirtualBlkAddr& GetVsa(void);
void SetVsa(VirtualBlkAddr&);
void SetSectorRba(uint64_t inputSectorRba);
virtual uint64_t GetSectorRba(void);
private:
static const StripeAddr INVALID_LSID_ENTRY;
static const VirtualBlkAddr INVALID_VSA;
static const uint64_t INVALID_RBA;
uint32_t volumeId;
uint32_t originCore;
StripeAddr lsidEntry;
StripeAddr oldLsidEntry;
VirtualBlkAddr vsa;
uint64_t sectorRba;
bool _IsInvalidVolumeId(uint32_t inputVolumeId);
virtual bool _IsInvalidLsidEntry(StripeAddr& inputLsidEntry);
bool _IsInvalidVsa(VirtualBlkAddr&);
bool _IsInvalidSectorRba(uint64_t inputSectorRba);
bool _CheckVolumeIdSet(void);
bool _CheckOriginCoreSet(void);
bool _CheckVsaSet(void);
bool _CheckSectorRbaSet(void);
};
} // namespace pos
| 33.504348 | 77 | 0.732676 | [
"vector"
] |
5231771dadfd2a94d36e9cf56c0d230305773f80 | 1,113 | c | C | cs231nq/c_functions/expandAxes35Flat6dMatrix.c | ryantorsparks/neuralnet | f5aff244e62f7694ea43bd9b5af2ed43be708465 | [
"MIT"
] | null | null | null | cs231nq/c_functions/expandAxes35Flat6dMatrix.c | ryantorsparks/neuralnet | f5aff244e62f7694ea43bd9b5af2ed43be708465 | [
"MIT"
] | null | null | null | cs231nq/c_functions/expandAxes35Flat6dMatrix.c | ryantorsparks/neuralnet | f5aff244e62f7694ea43bd9b5af2ed43be708465 | [
"MIT"
] | null | null | null | #include"k.h"
#include <stdio.h>
K expandAxes35Flat6dMatrix(K m, K mShape, K emptyres){
// m has shape (A;B;C;D;E;F), extract into vars
long shape[6];
I i;
for(i=0;i<6;++i) shape[i]=(long)kJ(mShape)[i];
long A, B, C, D, E, G;
long a, b, c, d, e, g;
// extract the shape for for-loops
A = shape[0];
B = shape[1];
C = shape[2];
D = shape[3]; // sum along this axis
E = shape[4];
G = shape[5]; // sum along this axis
long emptyIndex;
for(a=0;a<A;++a){
for(b=0;b<B;++b){
for(c=0;c<C;++c){
for(d=0;d<D;++d){
for(e=0;e<E;++e){
for(g=0;g<G;++g){
// equivalent index in the empty list, to matrix[a;b;c;d;e;g]
emptyIndex=a*B*C*D*E*G + b*C*D*E*G + c*D*E*G + d*E*G + e*G + g;
kF(emptyres)[emptyIndex]=kF(kK(kK(kK(kK(kK(m)[a])[b])[c])[0])[e])[0];
}
}
}
}
}
};
R r1(emptyres);
}
| 31.8 | 98 | 0.395328 | [
"shape"
] |
5235b5c4b0fe6229658db416a08f0f1213439b63 | 1,458 | h | C | Mac/HostDisplay/HostDisplay/AppDelegate.h | hansoninc/STEM-in-the-Park | 48d5c8e196b6770687d04313b5250aeb19c786a3 | [
"MIT"
] | null | null | null | Mac/HostDisplay/HostDisplay/AppDelegate.h | hansoninc/STEM-in-the-Park | 48d5c8e196b6770687d04313b5250aeb19c786a3 | [
"MIT"
] | null | null | null | Mac/HostDisplay/HostDisplay/AppDelegate.h | hansoninc/STEM-in-the-Park | 48d5c8e196b6770687d04313b5250aeb19c786a3 | [
"MIT"
] | null | null | null | //
// AppDelegate.h
// HostDisplay
//
// Created by Josh Jacob on 8/4/15.
// Copyright (c) 2015 Hanson, Inc. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@class HTTPServer;
@class UploadEntry;
@interface AppDelegate : NSObject <NSApplicationDelegate>
{
HTTPServer *httpServer;
}
/**
We hide the image aray from the rest of the code and expose specific aspects
of it. Here, we pass back the count of total entries.
*/
- (NSUInteger) uploadCount;
/**
Get at a specific entry.
@param index
The index of the element in the array.
*/
- (UploadEntry *) uploadAtIndex:(NSUInteger)index;
/**
Delete a specific entry.
@param uploadEntry
That entry object to remove from the array.
*/
- (void) deleteImage:(UploadEntry *)uploadEntry;
/**
Add uploaded image to image array and update composition display and admin window.
@param filePath
The local system file path to the image.
@param uploaderName
The name entered by the user uploading the image.
@param appName
The name of the app that uploaded the image.
*/
- (void)addImage:(NSString *)filePath withName:(NSString *)uploaderName appName:(NSString *)appName;
/**
The base data directory data for the app - ~/Library/Application Support/BGSU-StemInThePark/
*/
- (NSString *)getDirectoryBase;
/**
The directory were uploaded images are placed, inside the data diretory.
*/
- (NSString *)getDirectoryUploads;
@end
| 19.44 | 100 | 0.698217 | [
"object"
] |
52397ec830fae8023ec1f0348ad4077ca85bf34c | 2,561 | h | C | Examples/include/asposecpplib/security/cryptography/asymmetric_signature_deformatter.h | kashifiqb/Aspose.PDF-for-C | 13d49bba591c5704685820185741e64a462a5bdc | [
"MIT"
] | null | null | null | Examples/include/asposecpplib/security/cryptography/asymmetric_signature_deformatter.h | kashifiqb/Aspose.PDF-for-C | 13d49bba591c5704685820185741e64a462a5bdc | [
"MIT"
] | null | null | null | Examples/include/asposecpplib/security/cryptography/asymmetric_signature_deformatter.h | kashifiqb/Aspose.PDF-for-C | 13d49bba591c5704685820185741e64a462a5bdc | [
"MIT"
] | null | null | null | /// @file security/cryptography/asymmetric_signature_deformatter.h
#ifndef _security_AsymmetricSignatureDeformatter_h_
#define _security_AsymmetricSignatureDeformatter_h_
#include <system/string.h>
#include <system/shared_ptr.h>
#include <system/object.h>
#include <system/array.h>
#include <security/cryptography/hash_algorithm.h>
#include <security/cryptography/asymmetric_algorithm.h>
namespace System {
namespace Security {
namespace Cryptography {
/// Base class for assimetric signature deformatters.
/// Objects of this class should only be allocated using System::MakeObject() function.
/// Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults.
/// Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument.
class ASPOSECPP_SHARED_CLASS ABSTRACT AsymmetricSignatureDeformatter : public System::Object
{
/// This type.
typedef AsymmetricSignatureDeformatter ThisType;
/// Parent type.
typedef System::Object BaseType;
/// RTTI information.
ASPOSECPP_SHARED_RTTI_INFO_DECL();
/// Unhides protected constructors.
FRIEND_FUNCTION_System_MakeObject
public:
/// Sets hash algorithm associated with deformatter.
/// @param strName Name of hasing algorithm.
virtual ASPOSECPP_SHARED_API void SetHashAlgorithm(System::String strName) = 0;
/// Sets key to use with algorithm.
/// @param key Asymmetric algorithm that holds a key to use.
virtual ASPOSECPP_SHARED_API void SetKey(System::SharedPtr<AsymmetricAlgorithm> key) = 0;
/// Verifies signature on data.
/// @param rgbHash Data signed with @p rgbSignature.
/// @param rgbSignature Signature to be verified for data.
/// @return True if signature check succeeds, false otherwise.
virtual ASPOSECPP_SHARED_API bool VerifySignature(System::ArrayPtr<uint8_t> rgbHash, System::ArrayPtr<uint8_t> rgbSignature) = 0;
/// Verifies signature on data. Not implemented.
/// @param hash Algorithm to use for hashing.
/// @param rgbSignature Signature to be verified for data.
/// @return True if signature check succeeds, false otherwise.
virtual ASPOSECPP_SHARED_API bool VerifySignature(System::SharedPtr<HashAlgorithm> hash, System::ArrayPtr<uint8_t> rgbSignature);
protected:
/// Constructor.
ASPOSECPP_SHARED_API AsymmetricSignatureDeformatter();
};
} // namespace Cryptography
} // namespace Security
} // namespace System
#endif // _security_AsymmetricSignatureDeformatter_h_
| 42.683333 | 133 | 0.767669 | [
"object"
] |
523b7015976e4fa65b844e0777183d262a8b80e6 | 2,025 | h | C | lpsmap/ad3ext/DependencyDecoder.h | andre-martins/lp-sparsemap | 5df0c2f25290881a0ecd4270a9fbbc488d9055ff | [
"MIT"
] | 38 | 2020-02-04T04:26:51.000Z | 2022-03-17T12:08:04.000Z | lpsmap/ad3ext/DependencyDecoder.h | andre-martins/lp-sparsemap | 5df0c2f25290881a0ecd4270a9fbbc488d9055ff | [
"MIT"
] | 5 | 2020-02-04T05:19:26.000Z | 2022-01-12T08:54:24.000Z | lpsmap/ad3ext/DependencyDecoder.h | andre-martins/lp-sparsemap | 5df0c2f25290881a0ecd4270a9fbbc488d9055ff | [
"MIT"
] | 4 | 2020-03-07T10:35:14.000Z | 2021-04-16T11:04:43.000Z | #pragma once
/// Copyright (c) 2012-2015 Andre Martins
// All Rights Reserved.
//
// This file is part of TurboParser 2.3.
//
// TurboParser 2.3 is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// TurboParser 2.3 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TurboParser 2.3. If not, see <http://www.gnu.org/licenses/>.
#include<vector>
using std::vector;
class DependencyDecoder {
public:
DependencyDecoder() {};
virtual ~DependencyDecoder() {};
void RunChuLiuEdmonds(int sentence_length,
const vector<vector<int> > &index_arcs,
const vector<double> &scores,
vector<int> *heads,
double *value);
void RunEisner(int sentence_length,
int num_arcs,
const vector<vector<int> > &index_arcs,
const vector<double> &scores,
vector<int> *heads,
double *value);
void RunChuLiuEdmondsIteration(vector<bool> *disabled,
vector<vector<int> > *candidate_heads,
vector<vector<double> > *candidate_scores,
vector<int> *heads,
double *value);
void RunEisnerBacktrack(const vector<int> &incomplete_backtrack,
const vector<vector<int> > &complete_backtrack,
const vector<vector<int> > &index_arcs,
int h, int m, bool complete, vector<int> *heads);
};
| 36.818182 | 78 | 0.603457 | [
"vector"
] |
523deb0dc2d224e055d985e46dad17f82068ba93 | 2,635 | h | C | sequoia-engine/src/sequoia-engine/Render/GL/GLVertexData.h | thfabian/sequoia | ed7a17452ac946e8208ff60a30fc10298d3939db | [
"MIT"
] | 2 | 2018-01-31T07:44:59.000Z | 2018-01-31T20:34:37.000Z | sequoia-engine/src/sequoia-engine/Render/GL/GLVertexData.h | thfabian/sequoia | ed7a17452ac946e8208ff60a30fc10298d3939db | [
"MIT"
] | null | null | null | sequoia-engine/src/sequoia-engine/Render/GL/GLVertexData.h | thfabian/sequoia | ed7a17452ac946e8208ff60a30fc10298d3939db | [
"MIT"
] | null | null | null | //===--------------------------------------------------------------------------------*- C++ -*-===//
// _____ _
// / ____| (_)
// | (___ ___ __ _ _ _ ___ _ __ _
// \___ \ / _ \/ _` | | | |/ _ \| |/ _` |
// ____) | __/ (_| | |_| | (_) | | (_| |
// |_____/ \___|\__, |\__,_|\___/|_|\__,_| - Game Engine (2016-2017)
// | |
// |_|
//
// This file is distributed under the MIT License (MIT).
// See LICENSE.txt for details.
//
//===------------------------------------------------------------------------------------------===//
#ifndef SEQUOIA_ENGINE_RENDER_GL_GLVERTEXDATA_H
#define SEQUOIA_ENGINE_RENDER_GL_GLVERTEXDATA_H
#include "sequoia-engine/Render/GL/GLFwd.h"
#include "sequoia-engine/Render/GL/GLIndexBuffer.h"
#include "sequoia-engine/Render/GL/GLVertexBuffer.h"
#include "sequoia-engine/Render/VertexData.h"
namespace sequoia {
namespace render {
/// @brief OpenGL Vertex Array
/// @ingroup render
class SEQUOIA_API GLVertexData final : public VertexData {
public:
/// @brief Allocate a vertex array object (VAO) with a vertex and index buffer
GLVertexData(const VertexDataParameter& param);
/// @brief Deallocate all memory
~GLVertexData();
/// @brief Bind the vertex array
void bind();
/// @brief Unbind texture
static void unbind();
/// @copydoc VertexData::getVertexBuffer
virtual VertexBuffer* getVertexBuffer() const override { return vertexBuffer_.get(); }
/// @copydoc VertexData::getIndexBuffer
virtual IndexBuffer* getIndexBuffer() const override { return indexBuffer_.get(); }
/// @brief Draw the vertex-data
//TODO: move this out of VertexData
void draw() const noexcept;
/// @brief Get the VAO ID
unsigned int getVAOID() const noexcept { return vaoID_; }
/// @brief Get the corresponding enum of VertexLayout type
static GLenum getGLType(VertexLayout::TypeID type);
SEQUOIA_GL_OBJECT(VertexData)
protected:
/// @brief Implementation of `toString` returns stringified members and title
virtual std::pair<std::string, std::string> toStringImpl() const override;
private:
/// Allocated VertexBuffer
std::unique_ptr<GLVertexBuffer> vertexBuffer_;
/// Allocated IndexBuffer (possibly NULL)
std::unique_ptr<GLIndexBuffer> indexBuffer_;
/// Vertex array object (VAO)
unsigned int vaoID_;
private:
using Base = VertexData;
};
} // namespace render
} // namespace sequoia
#endif
| 31 | 100 | 0.579886 | [
"render",
"object"
] |
52460f930097be2a35840ab84fb5ad051a7c7458 | 6,577 | h | C | Core/Data/Variant.h | manu88/Celesta | 1b6350aac5040b54a1ddabed745586508bc63264 | [
"Apache-2.0"
] | null | null | null | Core/Data/Variant.h | manu88/Celesta | 1b6350aac5040b54a1ddabed745586508bc63264 | [
"Apache-2.0"
] | null | null | null | Core/Data/Variant.h | manu88/Celesta | 1b6350aac5040b54a1ddabed745586508bc63264 | [
"Apache-2.0"
] | null | null | null | //
// Value.h
// MediaCenter
//
// Created by Manuel Deneu on 22/03/15.
// Copyright (c) 2015 Manuel Deneu. All rights reserved.
//
#ifndef __Value__
#define __Value__
#include <typeinfo>
#include <vector>
#include <stdexcept> // std::out_of_range
#include <algorithm>
class Variant;
class ValueImpl;
class VariantList;
typedef std::vector<uint8_t> BytesList;
typedef std::pair<std::string , Variant> DataPair;
#ifdef USE_JAVA_INTERPRETER
class CScriptVar;
#endif
#include "../GXDataType/GXGeometry.h"
/* **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
class Variant
{
public:
//typedef int CastLongAs;
typedef int CastUIntAs;
static Variant &null() noexcept;
explicit Variant();
explicit Variant( int val );
explicit Variant( unsigned int val );
explicit Variant( int64_t val);
explicit Variant( uint64_t val);
explicit Variant( float val );
explicit Variant( double val );
explicit Variant( long val);
explicit Variant( unsigned long val);
Variant( const std::string &val );
explicit Variant( const std::string &name , const Variant &val);
// Added to prevent litterals c—strings from being implicitly converted to bool
explicit Variant( const char* val );
explicit Variant( bool val );
Variant( std::initializer_list< Variant > args);
Variant( const VariantList &list );
Variant( const std::vector<std::string> &args);
Variant( const BytesList &args);
/* For GX types*/
explicit Variant( const GXRect & rect);
explicit Variant( const GXPoint & point);
explicit Variant( const GXSize & size);
/**/
#ifdef USE_JAVA_INTERPRETER
static Variant create( CScriptVar *var);
static VariantList createList( CScriptVar *var);
#endif
/* **** **** */
/* copy & assignment ctors */
Variant ( const Variant &val );
Variant& operator=(Variant const& copy);
~Variant();
friend std::ostream& operator<<( std::ostream& os, const Variant& val );
/* get val */
bool getBool() const;
int getInt() const;
int64_t getInt64() const;
uint64_t getUInt64() const;
float getFloat() const;
double getDouble() const;
const std::string getString() const;
long getLong() const;
unsigned long getULong() const;
const VariantList getList() const;
VariantList getList();
const std::vector< uint8_t > getByteArray() const;
const DataPair &getPair() const;
//! careful! The type will not be checked, and reinterpret_cast may fail!
template <typename T> T getValue() const;
template <typename T> void setValue(const T &val) const;
const std::type_info& getType() const
{
return typeid( this );
}
template <typename T> bool isType() const;
/* test type */
bool isInt() const noexcept;
bool isInt64() const noexcept;
bool isUInt64() const noexcept;
bool isFloat() const noexcept;
bool isDouble() const noexcept;
bool isLong() const noexcept;
bool isULong() const noexcept;
bool isBool() const noexcept;
inline bool isNumeric() const
{
return isBool()
|| isInt()
|| isInt64()
|| isUInt64()
|| isFloat()
|| isDouble()
|| isLong()
|| isULong();
}
bool isString() const noexcept;
bool isList() const noexcept;
bool isNull() const noexcept;
bool isByteArray() const noexcept;
bool isDataPair() const noexcept;
/**/
/* Relationals Operators */
bool operator==( const Variant& rhs) const;
bool operator!=( const Variant& rhs) const;
bool operator==( const void* ptr) const; // use this to test against nullptr
protected:
mutable ValueImpl* _variant;
/*
private:
static Variant _null;
*/
};
std::ostream& operator<<( std::ostream& os, const Variant& val);
/* Class wrapper for std::vector -> catches errors for at() methods
( and returns Variant::null() ) so its guarranted( Maybe? ) noexcept*/
class VariantList
{
public:
typedef typename std::vector< Variant >::iterator iterator;
typedef typename std::vector< Variant >::const_iterator const_iterator;
VariantList()
{}
VariantList( std::initializer_list< Variant > l):
_l( l )
{}
VariantList( const_iterator begin , const_iterator end ):
_l( begin , end)
{}
/**/
iterator begin() noexcept {return _l.begin();}
const_iterator begin() const noexcept {return _l.begin();}
const_iterator cbegin() const noexcept {return _l.cbegin();}
iterator end() noexcept {return _l.end();}
const_iterator end() const noexcept {return _l.end();}
const_iterator cend() const noexcept {return _l.cend();}
/**/
inline bool empty() const noexcept
{
return _l.empty();
}
inline size_t size() const noexcept
{
return _l.size();
}
/**/
inline void push_back( const Variant &v)
{
_l.push_back( v );
}
inline void clear()
{
_l.clear();
}
/**/
inline Variant &at(size_t n) noexcept
{
try
{
return _l.at(n);
}
catch( const std::out_of_range& oor)
{
printf("catched out_of_range %s\n" , oor.what() );
}
return Variant::null();
}
inline const Variant &at(size_t n) const noexcept
{
try
{
return _l.at(n);
}
catch( const std::out_of_range& oor)
{
printf("catched out_of_range %s\n" , oor.what() );
}
return Variant::null();
}
inline const Variant &find( const Variant &value) const
{
const auto it = std::find(_l.begin(), _l.end(), value);
if( it != _l.end() )
return *it;
return Variant::null();
}
inline bool remove( const Variant &value)
{
const auto it = std::find(_l.begin(), _l.end(), value);
if( it != _l.end() )
{
_l.erase( it );
return true;
}
return false;
}
private:
std::vector< Variant > _l;
};
#endif /* defined(__MediaCenter__Value__) */
| 22.07047 | 83 | 0.566824 | [
"vector"
] |
524878c7f1e6910a4835cfdf7e8d4329c26cb3ea | 11,254 | h | C | FxLibCUDA/FxCUDA.h | galek/nvFX | 16866af0afb5d425e3c2db1a4829a79a9ee353bf | [
"Unlicense"
] | 193 | 2015-01-02T18:27:07.000Z | 2022-03-22T01:07:45.000Z | FxLibCUDA/FxCUDA.h | tlorach/nvFX | 16866af0afb5d425e3c2db1a4829a79a9ee353bf | [
"Unlicense"
] | null | null | null | FxLibCUDA/FxCUDA.h | tlorach/nvFX | 16866af0afb5d425e3c2db1a4829a79a9ee353bf | [
"Unlicense"
] | 43 | 2015-01-04T09:57:18.000Z | 2021-12-31T06:50:02.000Z | /*
Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
Copyright (c) 2013, Tristan Lorach. 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.
* Neither the name of NVIDIA CORPORATION nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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.
Please direct any questions to tlorach@nvidia.com (Tristan Lorach)
*/
#ifndef __FXCUDA_H__
#define __FXCUDA_H__
#include <vector>
#include <map>
#include <string>
#define USEMAPRANGE
//#define USEBUFFERSUBDATA
//#undef NVFXCHECKCUDAERRORS
#ifdef NVFXCHECKCUDAERRORS
#define CHECKCUDAERRORS(s) checkCUDAError(s)
#define PRINT_CUDA_ERROR(s) checkCUDAError(s)
#else
#define CHECKCUDAERRORS(s) 0
#define PRINT_CUDA_ERROR
#endif
#include "Fx.h"
#include <cuda.h>// Would be good to remove this include !
#include <cudaGL.h>
#include <builtin_types.h>
class CUmoduleManager;
namespace nvFX
{
class Container;
class Technique;
class Pass;
class CUDAShader;
class CUDAProgram;
class SamplerState;
class Uniform;
class PassState;
class CstBuffer;
class Shader;
/*************************************************************************/ /**
** \name internal structures
**
**/ /*************************************************************************/
/// @{
//
/// Linear memory buffers
//
struct CUDABuffer
{
CUDABuffer() : size(0), dptr(NULL) {}
int size;
CUdeviceptr dptr;
};
extern std::map<int, CUDABuffer> buffers;
enum CUDAArgType
{
CUDAARG_UNKNOWN,
CUDAARG_INT,
CUDAARG_FLOAT,
CUDAARG_PTR_BUFFER,
CUDAARG_PTR_BUFFER_TEX, // can be possible with interop. But better to go through tex sampler
//CUDAARG_PTR_BUFFER_RB,
};
union CUDAArgVal {
float f;
int i;
CUdeviceptr dptr;
};
struct CUDAArg
{
CUDAArg() { vals = NULL; }
std::string name;
//CGparameter param;
int textureRef;
int offset;
int sizeOf;
int ncomps;
CUDAArgType type;
CUDAArgVal* vals;
};
struct CUDAKernel
{
CUDAKernel()
{argsSz = 0; fpFunc = NULL; sharedMemory = 0; block = dim3(); grid = dim3(); streamID = NULL; }
std::string kernelName;
std::string kernelFuncName;
//CGparameter param;
CUfunction fpFunc;
CUstream streamID;
int sharedMemory;
dim3 block;
dim3 grid;
std::vector<CUDAArg> args;
int argsSz;
};
/// @}
/*************************************************************************/ /**
**
**
**/ /*************************************************************************/
class CstBufferCUDA : public CstBuffer
{
private:
int m_size;
int m_handle;
CUdeviceptr m_dptr;
public:
CstBufferCUDA(const char* name) : CstBuffer(name) {}
~CstBufferCUDA() {}
virtual CstBuffer* update(Pass *pass, int layerID, bool bCreateIfNeeded, bool bCreateBufferIfNeeded)
{ /*TODO if needed*/return this; }
};
/*************************************************************************/ /**
** \brief Uniform Parameter class
** \note CUDA uniform extends GLSL uniforms. Nothing done for D3D case (yet)
**/ /*************************************************************************/
class UniformCUDA : public Uniform
{
public:
virtual ~UniformCUDA();
UniformCUDA(const char* name = NULL, const char* groupname = NULL, const char* semantic = NULL);
Uniform* updateTextures(ShadowedData* data, Pass *pass, int layerID, bool bCreateIfNeeded);
virtual Uniform* update(ShadowedData* pData, Pass *pass, int ppID, bool bCreateIfNeeded);
virtual Uniform* updateForTarget(ShadowedData* pData, int target);
};
/*************************************************************************/ /**
**
**/ /*************************************************************************/
class CUDAShader : public Shader
{
public:
CUDAShader(const char *name = NULL);
~CUDAShader();
virtual void cleanupShader() {}
virtual bool isCompiled(int type) { return false; }
virtual GLhandleARB getGLSLShaderObj(GLenum type) { return NULL; }
friend class CUDAProgram;
friend class CUDAShaderProgram;
friend class Container;
friend class Pass;
};
/*************************************************************************/ /**
**
**
**/ /*************************************************************************/
struct KernelEntry
{
std::string funcName;
int gridSz[3];
int blockSz[3];
int ShMemSz;
int numArgs;
ArgVal *args;
CUfunction cudaFunc;
};
/*************************************************************************/ /**
**
**
**/ /*************************************************************************/
class CUDAProgram : public Program
{
private:
int m_moduleID;
CUmodule m_cuModule;
std::vector<KernelEntry> m_kernelEntries;
typedef std::map<std::string, CUDAShader*> ShaderMap;
bool m_usable;
bool m_linkNeeded;
ShaderMap m_shaders; ///< list of attached vertex shaders, sorted by the name
std::string m_fullCode;
std::map<std::string, CUDABuffer> m_buffers; // CUDA buffers
CUDABuffer *CreateCudaBuffer(const char *name, int Sz);
public:
CUDAProgram(Container *pCont);
~CUDAProgram();
virtual bool addShader(ShaderType type, IShader* pShader, IContainer* pContainer);
virtual bool addFragmentShader(IShader* pShader, IContainer* pContainer) { return false; }
virtual bool addVertexShader(IShader* pShader, IContainer* pContainer) { return false; }
virtual IShader* getShader(int n, ShaderType *t = NULL);
virtual IShader* getShader(IShader *pShader, ShaderType *t = NULL);
virtual IShader* getShader(const char *name, ShaderType *t = NULL);
virtual int getNumShaders();
virtual void cleanup();
virtual bool bind(IContainer* pContainer);
virtual void unbind(IContainer* pContainer);
virtual bool link(IContainer* pContainer);
virtual bool linkNeeded(int bYes) { return false; }
virtual int getProgram() { return 0;}
virtual int getProgramShaderFlags() { return 0; }
virtual int getUniformLocation(const char* name) { return 0; }
virtual int getAttribLocation(const char* attrName) { return 0; }
virtual void bindAttribLocation(int i, const char* attrName) {}
virtual void setUniform(const char* name, float val) {}
virtual void setUniform(const char* name, int val) {}
virtual void setUniformVector(const char * name, const float* val, int count, int numUniforms=1) {}
virtual void setUniformVector(const char * name, const int* val, int count, int numUniforms=1) {}
virtual void setSampler(const char * texname, int texunit) {}
virtual void bindTexture(ResourceType target, const char * texname, GLuint texid, int texunit) {}
#ifndef OGLES2
virtual bool bindSubRoutineToUniform(int uniformID, GLenum shadertype, char **subroutineNames, int numNames) { return false; }
virtual int getSubRoutineID(const char *name, GLenum shadertype) { return 0; }
#endif
virtual void* getD3DIASignature() { return NULL; }
virtual int getD3DIASignatureSize() { return 0; }
virtual bool execute(int szx, int szy, int szz=1) { return false; } // fails because only for Graphic-compute
virtual bool execute(RenderingMode mode, const PassInfo::PathInfo *p) { return false; } // fails because only for path programs
virtual int createKernelEntry(const char*kernelName, int *gridSz/*[3]*/, int *blockSz/*[3]*/, int ShMemSz,int numArgs, ArgVal *args);
virtual bool executeKernelEntry(int entryID);
friend class UniformCUDA;
};
/*************************************************************************/ /**
**
**
**/ /*************************************************************************/
class ResourceCUDA : public Resource
{
private:
int m_size, m_xByteSz;
size_t m_pitch;
CUdeviceptr m_dptr;
CUgraphicsResource m_cudaResource;
//CUtexref m_texRef; wrong place : should be in a target
protected:
bool setupAsCUDATarget();
bool setupAsCUDATexture();
bool updateResourceFromCUDA(CUstream streamID=NULL);
CUarray mapResource(CUstream streamID=NULL);
bool unmapResource(CUstream streamID=NULL);
bool unmapFromCUDA() { return unmapResource(); }
public:
ResourceCUDA(ResourceRepository* pCont, const char *name=NULL);
~ResourceCUDA();
friend class CUDAProgram;
friend class UniformCUDA;
};
}//namespace nvFX
#endif
| 39.626761 | 149 | 0.532255 | [
"vector"
] |
524ec4c15e6a73622bf35549924b100a43259c3a | 8,172 | h | C | Sources/Common/ivanGraphNodeVisitor.h | imacia/ivantk | a9e1cd6ee39986c7504ded80c2ab9b568bafc1f2 | [
"Apache-2.0"
] | 17 | 2015-03-30T22:12:16.000Z | 2020-07-05T10:35:15.000Z | Sources/Common/ivanGraphNodeVisitor.h | imacia/ivantk | a9e1cd6ee39986c7504ded80c2ab9b568bafc1f2 | [
"Apache-2.0"
] | 1 | 2015-04-01T14:43:51.000Z | 2017-02-21T09:11:52.000Z | Sources/Common/ivanGraphNodeVisitor.h | imacia/ivantk | a9e1cd6ee39986c7504ded80c2ab9b568bafc1f2 | [
"Apache-2.0"
] | 6 | 2015-03-30T22:12:19.000Z | 2021-02-08T05:20:55.000Z | /*=========================================================================
Image-based Vascular Analysis Toolkit (IVAN)
Copyright (c) 2012, Iván Macía Oliver
Vicomtech Foundation, San Sebastián - Donostia (Spain)
University of the Basque Country, San Sebastián - Donostia (Spain)
All rights reserved
See LICENSE file for license details
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 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.
==========================================================================*/
// File: ivanGraphNodeVisitor.h
// Author: Iv�n Mac�a (imacia@vicomtech.org)
// Description : implements the GOF Visitor pattern for graph nodes
#ifndef __ivanGraphNodeVisitor_h
#define __ivanGraphNodeVisitor_h
#include "itkObject.h"
#include "ivanGraphNode.h"
#include "ivanGraphNodeVisitorDispatcher.h"
#include <map>
#include <string>
namespace ivan
{
/** \class GraphNodeVisitor
* \brief Implements the Visitor Pattern to perform operations on nodes of a graph
*
* GraphNodeVisitor is the base class of the objects that traverse the graph and
* perform operations on the graph nodes. Specific GraphNodeVisitor subclasses implements
* the operators in specific types of nodes. This allows to separate the operations from
* the node definitions.
*
* GraphNodeVisitor implements a double-dispatch mechanism that is able to call the
* appropiate Apply() method in order to perform specific operations depending both on
* the visitor and node type. For example, a specific visitor may only operate on certain
* types on nodes, and does nothing on the rest.
*
* Typically the double-dispatch mechanism requires declaring all types of possible nodes
* in the GraphNode and GraphNodeVisitor classes. However, we want to provide flexibility
* in order to allow any types of nodes to be defined without altering corresponding base
* class interfaces. In order to do this, an alternative, although slower mechanism is
* provided. The dispatch is delegated into a template based dispatcher object that calls
* an appropiate non-virtual Apply() method for the given node types, that must be defined
* on the specific visitor. There is a dispatcher object for every node type that the
* visitor may be applied to. These objects are declared and constructed when the visitor
* is created and stored in a map. When the visitor receives a given node type, it checks
* in the map if a dispatcher is available for that node type (since the visitor is the
* current object) and if so, the corresponding method is applied.
*
* Alternatively, subclasses may use other mechanisms such as RTTI (dynamic_cast<> or
* typeid operators) in order to call the appropiate non-virtual Apply()�methods. In any
* case, these calls must be performed from a reimplementation of Visit().
*
* \ingroup
*/
class ITK_EXPORT GraphNodeVisitor : public itk::Object
{
public:
/** Standard class typedefs. */
typedef GraphNodeVisitor Self;
typedef itk::LightObject Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** List of nodes. */
typedef std::vector<Pointer> NodeContainer;
typedef GraphNode::NodePathType NodePathType;
typedef GraphNode::NodeMaskType NodeMaskType;
/** Map that allows to call the appropiate Apply() method defined in subclasses
* depending on the node type. This avoids declaring all node types here and
* allows flexibility for operating with new node types in the double-dispatch
* mechanism. The cost is that, for every Apply() call, we need to search the
* node type in the map. */
typedef std::map<std::string,GraphNodeVisitorDispatcherBase::Pointer> DispatcherMapType;
enum TraversalModeType
{
TraverseNone = 0,
TraverseAllChildren = 1,
TraverseActiveChildren = 2,
TraverseAllParents = 3,
TraverseActiveParents = 4
};
public:
/** Method for creation through the object factory. */
itkNewMacro( Self );
/** Run-time type information (and related methods). */
itkTypeMacro( GraphNodeVisitor, itk::LightObject );
itkSetMacro( TraversalMask, NodeMaskType );
itkGetConstMacro( TraversalMask, NodeMaskType );
/** Reset the visitor. Useful to reuse the visitor if it accumulates state during
* a traversal and we plan to reuse it. */
virtual void Reset() {}
/** Start visiting given node. */
virtual void Visit( GraphNode * node );
/** Generic apply method. This is called from the dispatcher. */
void Apply( GraphNode * node ) {}
/** Method called by GraphNode::Accept() method in order to visit or not the
* current node and its descendants or ancestors, depending on the traversal mode.
* It returns the result of the bit-wise operation between the visitor's traversal
* mask and the node's node mask. */
inline bool IsValidMask( const GraphNode * node ) const
{ return ( this->GetTraversalMask() & node->GetMask() ) != 0; }
/** Method called by GraphNode::Accept() before a call to the GraphNodeVisitor::Visit()
* method. The back of the path will be the current node being visited inside the
* Visit() method and the rest of the path will be the parental sequence of nodes
* from the top most node applied down the graph to the current node. NOTE: this
* method is not intended to be called directly by the user but internally during
* the traversal process. */
inline void PushOntoNodePath( GraphNode* node )
{
if ( m_TraversalMode != TraverseAllParents && m_TraversalMode != TraverseActiveParents )
m_NodePath.push_back( node ); // push at the back
else
m_NodePath.insert( m_NodePath.begin(), node ); // insert at the front
}
/** Method called by GraphNode::Accept() method after a call to GraphNodeVisitor::Visit().
* It pops the current node from the node path. NOTE: this method is not intended to
* be called directly by the user but internally during the traversal process. */
inline void PopFromNodePath()
{
if ( m_TraversalMode != TraverseAllParents && m_TraversalMode != TraverseActiveParents )
m_NodePath.pop_back();
else
m_NodePath.erase( m_NodePath.begin() );
}
protected:
GraphNodeVisitor();
~GraphNodeVisitor();
/** Add a new dispatcher. Subclasses must register their visitor-node pairs at construction.
* They must also define corresponding non-virtual Apply() methods for supported node types. */
template <class TVisitor, class TNode>
void AddDispatcher();
/** Traverse the current node. */
virtual void Traverse( GraphNode * node );
void PrintSelf( std::ostream& os, itk::Indent indent ) const;
private:
GraphNodeVisitor(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
protected:
/** Help map that redirects calls to appropiate Apply() method depending on node type.
* Subclasses must register their own visitor-node pair types here. */
DispatcherMapType m_DispatcherMap;
/** Traversal type. Default is TraverseAllChildren. */
TraversalModeType m_TraversalMode;
/** Mask that can be used during traversal. */
NodeMaskType m_TraversalMask;
/** Current node path. */
NodePathType m_NodePath;
};
template <class TVisitor, class TNode>
void GraphNodeVisitor::AddDispatcher()
{
m_DispatcherMap[ TNode::GetNameOfClassStatic() ] = GraphNodeVisitorDispatcher<TVisitor,TNode>::New();
}
} // end namespace ivan
#endif
| 39.669903 | 103 | 0.721243 | [
"object",
"vector"
] |
526532856174c31b67894ff09e87a69769a7371f | 1,050 | h | C | source/laplace/core/defs.h | ogryzko/laplace | be63caa0c6d1c4fceab02ab5b41b6d307ef7baaf | [
"MIT"
] | 3 | 2021-05-17T21:15:28.000Z | 2021-09-06T23:01:52.000Z | source/laplace/core/defs.h | ogryzko/laplace | be63caa0c6d1c4fceab02ab5b41b6d307ef7baaf | [
"MIT"
] | 33 | 2021-10-20T10:47:07.000Z | 2022-02-26T02:24:20.000Z | source/laplace/core/defs.h | automainint/laplace | 66956df506918d48d79527e524ff606bb197d8af | [
"MIT"
] | null | null | null | /* laplace/core/defs.h
*
* The core definitions. Type definitions and log
* functions.
*
* Copyright (c) 2021 Mitya Selivanov
*
* This file is part of the Laplace project.
*
* Laplace 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 MIT License for more details.
*/
#ifndef laplace_core_defs_h
#define laplace_core_defs_h
#include "options.h"
#include "slib.h"
namespace laplace {
using vbyte = sl::vector<uint8_t>;
using vuint16 = sl::vector<uint16_t>;
using vuint32 = sl::vector<uint32_t>;
using span_byte = std::span<uint8_t>;
using span_index = std::span<sl::index>;
using span_uint16 = std::span<uint16_t>;
using span_uint32 = std::span<uint32_t>;
using span_cbyte = std::span<const uint8_t>;
using span_cindex = std::span<const sl::index>;
using span_cuint16 = std::span<const uint16_t>;
using span_cuint32 = std::span<const uint32_t>;
}
#endif
| 26.25 | 63 | 0.704762 | [
"vector"
] |
5273657f96b708bd25a500fd0a621ca9049c0493 | 38,779 | c | C | Samba/source/librpc/rpc/dcerpc_util.c | vnation/wmi-1.3.14 | 170c5af4501087ebf35833386ca1345fafed723b | [
"MIT"
] | null | null | null | Samba/source/librpc/rpc/dcerpc_util.c | vnation/wmi-1.3.14 | 170c5af4501087ebf35833386ca1345fafed723b | [
"MIT"
] | null | null | null | Samba/source/librpc/rpc/dcerpc_util.c | vnation/wmi-1.3.14 | 170c5af4501087ebf35833386ca1345fafed723b | [
"MIT"
] | null | null | null | /*
Unix SMB/CIFS implementation.
dcerpc utility functions
Copyright (C) Andrew Tridgell 2003
Copyright (C) Jelmer Vernooij 2004
Copyright (C) Andrew Bartlett <abartlet@samba.org> 2005
Copyright (C) Rafal Szczesniak 2006
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "includes.h"
#include "lib/events/events.h"
#include "libcli/composite/composite.h"
#include "librpc/gen_ndr/ndr_epmapper_c.h"
#include "librpc/gen_ndr/ndr_dcerpc.h"
#include "librpc/gen_ndr/ndr_misc.h"
#include "auth/credentials/credentials.h"
/*
find a dcerpc call on an interface by name
*/
const struct dcerpc_interface_call *dcerpc_iface_find_call(const struct dcerpc_interface_table *iface,
const char *name)
{
int i;
for (i=0;i<iface->num_calls;i++) {
if (strcmp(iface->calls[i].name, name) == 0) {
return &iface->calls[i];
}
}
return NULL;
}
/*
push a ncacn_packet into a blob, potentially with auth info
*/
NTSTATUS ncacn_push_auth(DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
struct ncacn_packet *pkt,
struct dcerpc_auth *auth_info)
{
NTSTATUS status;
struct ndr_push *ndr;
ndr = ndr_push_init_ctx(mem_ctx);
if (!ndr) {
return NT_STATUS_NO_MEMORY;
}
if (!(pkt->drep[0] & DCERPC_DREP_LE)) {
ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
}
if (pkt->pfc_flags & DCERPC_PFC_FLAG_ORPC) {
ndr->flags |= LIBNDR_FLAG_OBJECT_PRESENT;
}
if (auth_info) {
pkt->auth_length = auth_info->credentials.length;
} else {
pkt->auth_length = 0;
}
status = ndr_push_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
if (auth_info) {
status = ndr_push_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS, auth_info);
}
*blob = ndr_push_blob(ndr);
/* fill in the frag length */
dcerpc_set_frag_length(blob, blob->length);
return NT_STATUS_OK;
}
#define MAX_PROTSEQ 10
static const struct {
const char *name;
enum dcerpc_transport_t transport;
int num_protocols;
enum epm_protocol protseq[MAX_PROTSEQ];
} transports[] = {
{ "ncacn_np", NCACN_NP, 3,
{ EPM_PROTOCOL_NCACN, EPM_PROTOCOL_SMB, EPM_PROTOCOL_NETBIOS }},
{ "ncacn_ip_tcp", NCACN_IP_TCP, 3,
{ EPM_PROTOCOL_NCACN, EPM_PROTOCOL_TCP, EPM_PROTOCOL_IP } },
{ "ncacn_http", NCACN_HTTP, 3,
{ EPM_PROTOCOL_NCACN, EPM_PROTOCOL_HTTP, EPM_PROTOCOL_IP } },
{ "ncadg_ip_udp", NCACN_IP_UDP, 3,
{ EPM_PROTOCOL_NCADG, EPM_PROTOCOL_UDP, EPM_PROTOCOL_IP } },
{ "ncalrpc", NCALRPC, 2,
{ EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_PIPE } },
{ "ncacn_unix_stream", NCACN_UNIX_STREAM, 2,
{ EPM_PROTOCOL_NCACN, EPM_PROTOCOL_UNIX_DS } },
{ "ncadg_unix_dgram", NCADG_UNIX_DGRAM, 2,
{ EPM_PROTOCOL_NCADG, EPM_PROTOCOL_UNIX_DS } },
{ "ncacn_at_dsp", NCACN_AT_DSP, 3,
{ EPM_PROTOCOL_NCACN, EPM_PROTOCOL_APPLETALK, EPM_PROTOCOL_DSP } },
{ "ncadg_at_ddp", NCADG_AT_DDP, 3,
{ EPM_PROTOCOL_NCADG, EPM_PROTOCOL_APPLETALK, EPM_PROTOCOL_DDP } },
{ "ncacn_vns_ssp", NCACN_VNS_SPP, 3,
{ EPM_PROTOCOL_NCACN, EPM_PROTOCOL_STREETTALK, EPM_PROTOCOL_VINES_SPP } },
{ "ncacn_vns_ipc", NCACN_VNS_IPC, 3,
{ EPM_PROTOCOL_NCACN, EPM_PROTOCOL_STREETTALK, EPM_PROTOCOL_VINES_IPC }, },
{ "ncadg_ipx", NCADG_IPX, 2,
{ EPM_PROTOCOL_NCADG, EPM_PROTOCOL_IPX },
},
{ "ncacn_spx", NCACN_SPX, 3,
/* I guess some MS programmer confused the identifier for
* EPM_PROTOCOL_UUID (0x0D or 13) with the one for
* EPM_PROTOCOL_SPX (0x13) here. -- jelmer*/
{ EPM_PROTOCOL_NCACN, EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_UUID },
},
};
static const struct {
const char *name;
uint32_t flag;
} ncacn_options[] = {
{"sign", DCERPC_SIGN},
{"seal", DCERPC_SEAL},
{"connect", DCERPC_CONNECT},
{"spnego", DCERPC_AUTH_SPNEGO},
{"ntlm", DCERPC_AUTH_NTLM},
{"krb5", DCERPC_AUTH_KRB5},
{"validate", DCERPC_DEBUG_VALIDATE_BOTH},
{"print", DCERPC_DEBUG_PRINT_BOTH},
{"padcheck", DCERPC_DEBUG_PAD_CHECK},
{"bigendian", DCERPC_PUSH_BIGENDIAN},
{"smb2", DCERPC_SMB2}
};
const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor)
{
struct dcerpc_syntax_id syntax;
NTSTATUS status;
switch(epm_floor->lhs.protocol) {
case EPM_PROTOCOL_UUID:
status = dcerpc_floor_get_lhs_data(epm_floor, &syntax);
if (NT_STATUS_IS_OK(status)) {
/* lhs is used: UUID */
char *uuidstr;
if (GUID_equal(&syntax.uuid, &ndr_transfer_syntax.uuid)) {
return "NDR";
}
if (GUID_equal(&syntax.uuid, &ndr64_transfer_syntax.uuid)) {
return "NDR64";
}
uuidstr = GUID_string(mem_ctx, &syntax.uuid);
return talloc_asprintf(mem_ctx, " uuid %s/0x%02x", uuidstr, syntax.if_version);
} else { /* IPX */
return talloc_asprintf(mem_ctx, "IPX:%s",
data_blob_hex_string(mem_ctx, &epm_floor->rhs.uuid.unknown));
}
case EPM_PROTOCOL_NCACN:
return "RPC-C";
case EPM_PROTOCOL_NCADG:
return "RPC";
case EPM_PROTOCOL_NCALRPC:
return "NCALRPC";
case EPM_PROTOCOL_DNET_NSP:
return "DNET/NSP";
case EPM_PROTOCOL_IP:
return talloc_asprintf(mem_ctx, "IP:%s", epm_floor->rhs.ip.ipaddr);
case EPM_PROTOCOL_PIPE:
return talloc_asprintf(mem_ctx, "PIPE:%s", epm_floor->rhs.pipe.path);
case EPM_PROTOCOL_SMB:
return talloc_asprintf(mem_ctx, "SMB:%s", epm_floor->rhs.smb.unc);
case EPM_PROTOCOL_UNIX_DS:
return talloc_asprintf(mem_ctx, "Unix:%s", epm_floor->rhs.unix_ds.path);
case EPM_PROTOCOL_NETBIOS:
return talloc_asprintf(mem_ctx, "NetBIOS:%s", epm_floor->rhs.netbios.name);
case EPM_PROTOCOL_NETBEUI:
return "NETBeui";
case EPM_PROTOCOL_SPX:
return "SPX";
case EPM_PROTOCOL_NB_IPX:
return "NB_IPX";
case EPM_PROTOCOL_HTTP:
return talloc_asprintf(mem_ctx, "HTTP:%d", epm_floor->rhs.http.port);
case EPM_PROTOCOL_TCP:
return talloc_asprintf(mem_ctx, "TCP:%d", epm_floor->rhs.tcp.port);
case EPM_PROTOCOL_UDP:
return talloc_asprintf(mem_ctx, "UDP:%d", epm_floor->rhs.udp.port);
default:
return talloc_asprintf(mem_ctx, "UNK(%02x):", epm_floor->lhs.protocol);
}
}
/*
form a binding string from a binding structure
*/
const char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b)
{
char *s = talloc_strdup(mem_ctx, "");
int i;
const char *t_name=NULL;
for (i=0;i<ARRAY_SIZE(transports);i++) {
if (transports[i].transport == b->transport) {
t_name = transports[i].name;
}
}
if (!t_name) {
return NULL;
}
if (!GUID_all_zero(&b->object.uuid)) {
s = talloc_asprintf(s, "%s@",
GUID_string(mem_ctx, &b->object.uuid));
}
s = talloc_asprintf_append(s, "%s:", t_name);
if (!s) return NULL;
if (b->host) {
s = talloc_asprintf_append(s, "%s", b->host);
}
if (!b->endpoint && !b->options && !b->flags) {
return s;
}
s = talloc_asprintf_append(s, "[");
if (b->endpoint) {
s = talloc_asprintf_append(s, "%s", b->endpoint);
}
/* this is a *really* inefficent way of dealing with strings,
but this is rarely called and the strings are always short,
so I don't care */
for (i=0;b->options && b->options[i];i++) {
s = talloc_asprintf_append(s, ",%s", b->options[i]);
if (!s) return NULL;
}
for (i=0;i<ARRAY_SIZE(ncacn_options);i++) {
if (b->flags & ncacn_options[i].flag) {
s = talloc_asprintf_append(s, ",%s", ncacn_options[i].name);
if (!s) return NULL;
}
}
s = talloc_asprintf_append(s, "]");
return s;
}
/*
parse a binding string into a dcerpc_binding structure
*/
NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_binding **b_out)
{
struct dcerpc_binding *b;
char *options, *type;
char *p;
int i, j, comma_count;
b = talloc(mem_ctx, struct dcerpc_binding);
if (!b) {
return NT_STATUS_NO_MEMORY;
}
p = strchr(s, '@');
if (p && PTR_DIFF(p, s) == 36) { /* 36 is the length of a UUID */
NTSTATUS status;
status = GUID_from_string(s, &b->object.uuid);
if (NT_STATUS_IS_ERR(status)) {
DEBUG(0, ("Failed parsing UUID\n"));
return status;
}
s = p + 1;
} else {
ZERO_STRUCT(b->object);
}
b->object.if_version = 0;
p = strchr(s, ':');
if (!p) {
return NT_STATUS_INVALID_PARAMETER;
}
type = talloc_strndup(mem_ctx, s, PTR_DIFF(p, s));
if (!type) {
return NT_STATUS_NO_MEMORY;
}
for (i=0;i<ARRAY_SIZE(transports);i++) {
if (strcasecmp(type, transports[i].name) == 0) {
b->transport = transports[i].transport;
break;
}
}
if (i==ARRAY_SIZE(transports)) {
DEBUG(0,("Unknown dcerpc transport '%s'\n", type));
return NT_STATUS_INVALID_PARAMETER;
}
s = p+1;
p = strchr(s, '[');
if (p) {
b->host = talloc_strndup(b, s, PTR_DIFF(p, s));
options = talloc_strdup(mem_ctx, p+1);
if (options[strlen(options)-1] != ']') {
return NT_STATUS_INVALID_PARAMETER;
}
options[strlen(options)-1] = 0;
} else {
b->host = talloc_strdup(b, s);
options = NULL;
}
if (!b->host) {
return NT_STATUS_NO_MEMORY;
}
b->target_hostname = b->host;
b->options = NULL;
b->flags = 0;
b->endpoint = NULL;
if (!options) {
*b_out = b;
return NT_STATUS_OK;
}
comma_count = count_chars(options, ',');
b->options = talloc_array(b, const char *, comma_count+2);
if (!b->options) {
return NT_STATUS_NO_MEMORY;
}
for (i=0; (p = strchr(options, ',')); i++) {
b->options[i] = talloc_strndup(b, options, PTR_DIFF(p, options));
if (!b->options[i]) {
return NT_STATUS_NO_MEMORY;
}
options = p+1;
}
b->options[i] = options;
b->options[i+1] = NULL;
/* some options are pre-parsed for convenience */
for (i=0;b->options[i];i++) {
for (j=0;j<ARRAY_SIZE(ncacn_options);j++) {
if (strcasecmp(ncacn_options[j].name, b->options[i]) == 0) {
int k;
b->flags |= ncacn_options[j].flag;
for (k=i;b->options[k];k++) {
b->options[k] = b->options[k+1];
}
i--;
break;
}
}
}
if (b->options[0]) {
/* Endpoint is first option */
b->endpoint = b->options[0];
if (strlen(b->endpoint) == 0) b->endpoint = NULL;
for (i=0;b->options[i];i++) {
b->options[i] = b->options[i+1];
}
}
if (b->options[0] == NULL)
b->options = NULL;
*b_out = b;
return NT_STATUS_OK;
}
NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct dcerpc_syntax_id *syntax)
{
TALLOC_CTX *mem_ctx = talloc_init("floor_get_lhs_data");
struct ndr_pull *ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx);
NTSTATUS status;
uint16_t if_version=0;
ndr->flags |= LIBNDR_FLAG_NOALIGN;
status = ndr_pull_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid);
if (NT_STATUS_IS_ERR(status)) {
talloc_free(mem_ctx);
return status;
}
status = ndr_pull_uint16(ndr, NDR_SCALARS, &if_version);
syntax->if_version = if_version;
talloc_free(mem_ctx);
return status;
}
static DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, const struct dcerpc_syntax_id *syntax)
{
struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx);
ndr->flags |= LIBNDR_FLAG_NOALIGN;
ndr_push_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid);
ndr_push_uint16(ndr, NDR_SCALARS, syntax->if_version);
return ndr_push_blob(ndr);
}
const char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor)
{
switch (epm_floor->lhs.protocol) {
case EPM_PROTOCOL_TCP:
if (epm_floor->rhs.tcp.port == 0) return NULL;
return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.tcp.port);
case EPM_PROTOCOL_UDP:
if (epm_floor->rhs.udp.port == 0) return NULL;
return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.udp.port);
case EPM_PROTOCOL_HTTP:
if (epm_floor->rhs.http.port == 0) return NULL;
return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.http.port);
case EPM_PROTOCOL_IP:
return talloc_strdup(mem_ctx, epm_floor->rhs.ip.ipaddr);
case EPM_PROTOCOL_NCACN:
return NULL;
case EPM_PROTOCOL_NCADG:
return NULL;
case EPM_PROTOCOL_SMB:
if (strlen(epm_floor->rhs.smb.unc) == 0) return NULL;
return talloc_strdup(mem_ctx, epm_floor->rhs.smb.unc);
case EPM_PROTOCOL_PIPE:
if (strlen(epm_floor->rhs.pipe.path) == 0) return NULL;
return talloc_strdup(mem_ctx, epm_floor->rhs.pipe.path);
case EPM_PROTOCOL_NETBIOS:
if (strlen(epm_floor->rhs.netbios.name) == 0) return NULL;
return talloc_strdup(mem_ctx, epm_floor->rhs.netbios.name);
case EPM_PROTOCOL_NCALRPC:
return NULL;
case EPM_PROTOCOL_VINES_SPP:
return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.vines_spp.port);
case EPM_PROTOCOL_VINES_IPC:
return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.vines_ipc.port);
case EPM_PROTOCOL_STREETTALK:
return talloc_strdup(mem_ctx, epm_floor->rhs.streettalk.streettalk);
case EPM_PROTOCOL_UNIX_DS:
if (strlen(epm_floor->rhs.unix_ds.path) == 0) return NULL;
return talloc_strdup(mem_ctx, epm_floor->rhs.unix_ds.path);
case EPM_PROTOCOL_NULL:
return NULL;
default:
DEBUG(0,("Unsupported lhs protocol %d\n", epm_floor->lhs.protocol));
break;
}
return NULL;
}
static NTSTATUS dcerpc_floor_set_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor, const char *data)
{
switch (epm_floor->lhs.protocol) {
case EPM_PROTOCOL_TCP:
epm_floor->rhs.tcp.port = atoi(data);
return NT_STATUS_OK;
case EPM_PROTOCOL_UDP:
epm_floor->rhs.udp.port = atoi(data);
return NT_STATUS_OK;
case EPM_PROTOCOL_HTTP:
epm_floor->rhs.http.port = atoi(data);
return NT_STATUS_OK;
case EPM_PROTOCOL_IP:
epm_floor->rhs.ip.ipaddr = talloc_strdup(mem_ctx, data);
NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.ip.ipaddr);
return NT_STATUS_OK;
case EPM_PROTOCOL_NCACN:
epm_floor->rhs.ncacn.minor_version = 0;
return NT_STATUS_OK;
case EPM_PROTOCOL_NCADG:
epm_floor->rhs.ncadg.minor_version = 0;
return NT_STATUS_OK;
case EPM_PROTOCOL_SMB:
epm_floor->rhs.smb.unc = talloc_strdup(mem_ctx, data);
NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.smb.unc);
return NT_STATUS_OK;
case EPM_PROTOCOL_PIPE:
epm_floor->rhs.pipe.path = talloc_strdup(mem_ctx, data);
NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.pipe.path);
return NT_STATUS_OK;
case EPM_PROTOCOL_NETBIOS:
epm_floor->rhs.netbios.name = talloc_strdup(mem_ctx, data);
NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.netbios.name);
return NT_STATUS_OK;
case EPM_PROTOCOL_NCALRPC:
return NT_STATUS_OK;
case EPM_PROTOCOL_VINES_SPP:
epm_floor->rhs.vines_spp.port = atoi(data);
return NT_STATUS_OK;
case EPM_PROTOCOL_VINES_IPC:
epm_floor->rhs.vines_ipc.port = atoi(data);
return NT_STATUS_OK;
case EPM_PROTOCOL_STREETTALK:
epm_floor->rhs.streettalk.streettalk = talloc_strdup(mem_ctx, data);
NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.streettalk.streettalk);
return NT_STATUS_OK;
case EPM_PROTOCOL_UNIX_DS:
epm_floor->rhs.unix_ds.path = talloc_strdup(mem_ctx, data);
NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.unix_ds.path);
return NT_STATUS_OK;
case EPM_PROTOCOL_NULL:
return NT_STATUS_OK;
default:
DEBUG(0,("Unsupported lhs protocol %d\n", epm_floor->lhs.protocol));
break;
}
return NT_STATUS_NOT_SUPPORTED;
}
enum dcerpc_transport_t dcerpc_transport_by_endpoint_protocol(int prot)
{
int i;
/* Find a transport that has 'prot' as 4th protocol */
for (i=0;i<ARRAY_SIZE(transports);i++) {
if (transports[i].num_protocols >= 2 &&
transports[i].protseq[1] == prot) {
return transports[i].transport;
}
}
/* Unknown transport */
return (unsigned int)-1;
}
enum dcerpc_transport_t dcerpc_transport_by_tower(struct epm_tower *tower)
{
int i;
/* Find a transport that matches this tower */
for (i=0;i<ARRAY_SIZE(transports);i++) {
int j;
if (transports[i].num_protocols != tower->num_floors - 2) {
continue;
}
for (j = 0; j < transports[i].num_protocols; j++) {
if (transports[i].protseq[j] != tower->floors[j+2].lhs.protocol) {
break;
}
}
if (j == transports[i].num_protocols) {
return transports[i].transport;
}
}
/* Unknown transport */
return (unsigned int)-1;
}
NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx, struct epm_tower *tower, struct dcerpc_binding **b_out)
{
NTSTATUS status;
struct dcerpc_binding *binding;
binding = talloc(mem_ctx, struct dcerpc_binding);
NT_STATUS_HAVE_NO_MEMORY(binding);
ZERO_STRUCT(binding->object);
binding->options = NULL;
binding->host = NULL;
binding->flags = 0;
binding->transport = dcerpc_transport_by_tower(tower);
if (binding->transport == (unsigned int)-1) {
return NT_STATUS_NOT_SUPPORTED;
}
if (tower->num_floors < 1) {
return NT_STATUS_OK;
}
/* Set object uuid */
status = dcerpc_floor_get_lhs_data(&tower->floors[0], &binding->object);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Error pulling object uuid and version: %s", nt_errstr(status)));
return status;
}
/* Ignore floor 1, it contains the NDR version info */
binding->options = NULL;
/* Set endpoint */
if (tower->num_floors >= 4) {
binding->endpoint = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[3]);
} else {
binding->endpoint = NULL;
}
/* Set network address */
if (tower->num_floors >= 5) {
binding->host = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[4]);
}
*b_out = binding;
return NT_STATUS_OK;
}
NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding, struct epm_tower *tower)
{
const enum epm_protocol *protseq = NULL;
int num_protocols = -1, i;
NTSTATUS status;
/* Find transport */
for (i=0;i<ARRAY_SIZE(transports);i++) {
if (transports[i].transport == binding->transport) {
protseq = transports[i].protseq;
num_protocols = transports[i].num_protocols;
break;
}
}
if (num_protocols == -1) {
DEBUG(0, ("Unable to find transport with id '%d'\n", binding->transport));
return NT_STATUS_UNSUCCESSFUL;
}
tower->num_floors = 2 + num_protocols;
tower->floors = talloc_array(mem_ctx, struct epm_floor, tower->num_floors);
/* Floor 0 */
tower->floors[0].lhs.protocol = EPM_PROTOCOL_UUID;
tower->floors[0].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx, &binding->object);
tower->floors[0].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2);
/* Floor 1 */
tower->floors[1].lhs.protocol = EPM_PROTOCOL_UUID;
tower->floors[1].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx,
&ndr_transfer_syntax);
tower->floors[1].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2);
/* Floor 2 to num_protocols */
for (i = 0; i < num_protocols; i++) {
tower->floors[2 + i].lhs.protocol = protseq[i];
tower->floors[2 + i].lhs.lhs_data = data_blob_talloc(mem_ctx, NULL, 0);
ZERO_STRUCT(tower->floors[2 + i].rhs);
dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[2 + i], "");
}
/* The 4th floor contains the endpoint */
if (num_protocols >= 2 && binding->endpoint) {
status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[3], binding->endpoint);
if (NT_STATUS_IS_ERR(status)) {
return status;
}
}
/* The 5th contains the network address */
if (num_protocols >= 3 && binding->host) {
if (is_ipaddress(binding->host)) {
status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4],
binding->host);
} else {
/* note that we don't attempt to resolve the
name here - when we get a hostname here we
are in the client code, and want to put in
a wildcard all-zeros IP for the server to
fill in */
status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4],
"0.0.0.0");
}
if (NT_STATUS_IS_ERR(status)) {
return status;
}
}
return NT_STATUS_OK;
}
struct epm_map_binding_state {
struct dcerpc_binding *binding;
const struct dcerpc_interface_table *table;
struct dcerpc_pipe *pipe;
struct policy_handle handle;
struct GUID guid;
struct epm_twr_t twr;
struct epm_twr_t *twr_r;
struct epm_Map r;
};
static void continue_epm_recv_binding(struct composite_context *ctx);
static void continue_epm_map(struct rpc_request *req);
/*
Stage 2 of epm_map_binding: Receive connected rpc pipe and send endpoint
mapping rpc request
*/
static void continue_epm_recv_binding(struct composite_context *ctx)
{
struct rpc_request *map_req;
struct composite_context *c = talloc_get_type(ctx->async.private_data,
struct composite_context);
struct epm_map_binding_state *s = talloc_get_type(c->private_data,
struct epm_map_binding_state);
/* receive result of rpc pipe connect request */
c->status = dcerpc_pipe_connect_b_recv(ctx, c, &s->pipe);
if (!composite_is_ok(c)) return;
s->pipe->conn->flags |= DCERPC_NDR_REF_ALLOC;
/* prepare requested binding parameters */
s->binding->object = s->table->syntax_id;
c->status = dcerpc_binding_build_tower(s->pipe, s->binding, &s->twr.tower);
if (!composite_is_ok(c)) return;
/* with some nice pretty paper around it of course */
s->r.in.object = &s->guid;
s->r.in.map_tower = &s->twr;
s->r.in.entry_handle = &s->handle;
s->r.in.max_towers = 1;
s->r.out.entry_handle = &s->handle;
/* send request for an endpoint mapping - a rpc request on connected pipe */
map_req = dcerpc_epm_Map_send(s->pipe, c, &s->r);
if (composite_nomem(map_req, c)) return;
composite_continue_rpc(c, map_req, continue_epm_map, c);
}
/*
Stage 3 of epm_map_binding: Receive endpoint mapping and provide binding details
*/
static void continue_epm_map(struct rpc_request *req)
{
struct composite_context *c = talloc_get_type(req->async.private,
struct composite_context);
struct epm_map_binding_state *s = talloc_get_type(c->private_data,
struct epm_map_binding_state);
/* receive result of a rpc request */
c->status = dcerpc_ndr_request_recv(req);
if (!composite_is_ok(c)) return;
/* check the details */
if (s->r.out.result != 0 || *s->r.out.num_towers != 1) {
composite_error(c, NT_STATUS_PORT_UNREACHABLE);
return;
}
s->twr_r = s->r.out.towers[0].twr;
if (s->twr_r == NULL) {
composite_error(c, NT_STATUS_PORT_UNREACHABLE);
return;
}
if (s->twr_r->tower.num_floors != s->twr.tower.num_floors ||
s->twr_r->tower.floors[3].lhs.protocol != s->twr.tower.floors[3].lhs.protocol) {
composite_error(c, NT_STATUS_PORT_UNREACHABLE);
return;
}
/* get received endpoint */
s->binding->endpoint = talloc_reference(s->binding,
dcerpc_floor_get_rhs_data(c, &s->twr_r->tower.floors[3]));
if (composite_nomem(s->binding->endpoint, c)) return;
composite_done(c);
}
/*
Request for endpoint mapping of dcerpc binding - try to request for endpoint
unless there is default one.
*/
struct composite_context *dcerpc_epm_map_binding_send(TALLOC_CTX *mem_ctx,
struct dcerpc_binding *binding,
const struct dcerpc_interface_table *table,
struct event_context *ev)
{
struct composite_context *c;
struct epm_map_binding_state *s;
struct composite_context *pipe_connect_req;
struct cli_credentials *anon_creds;
struct event_context *new_ev = NULL;
NTSTATUS status;
struct dcerpc_binding *epmapper_binding;
int i;
/* Try to find event context in memory context in case passed
* event_context (argument) was NULL. If there's none, just
* create a new one.
*/
if (ev == NULL) {
ev = event_context_find(mem_ctx);
if (ev == NULL) {
new_ev = event_context_init(mem_ctx);
if (new_ev == NULL) return NULL;
ev = new_ev;
}
}
/* composite context allocation and setup */
c = composite_create(mem_ctx, ev);
if (c == NULL) {
talloc_free(new_ev);
return NULL;
}
talloc_steal(c, new_ev);
s = talloc_zero(c, struct epm_map_binding_state);
if (composite_nomem(s, c)) return c;
c->private_data = s;
s->binding = binding;
s->table = table;
/* anonymous credentials for rpc connection used to get endpoint mapping */
anon_creds = cli_credentials_init(mem_ctx);
cli_credentials_set_conf(anon_creds);
cli_credentials_set_anonymous(anon_creds);
/*
First, check if there is a default endpoint specified in the IDL
*/
if (table) {
struct dcerpc_binding *default_binding;
/* Find one of the default pipes for this interface */
for (i = 0; i < table->endpoints->count; i++) {
status = dcerpc_parse_binding(mem_ctx, table->endpoints->names[i], &default_binding);
if (NT_STATUS_IS_OK(status)) {
if (default_binding->transport == binding->transport && default_binding->endpoint) {
binding->endpoint = talloc_reference(binding, default_binding->endpoint);
talloc_free(default_binding);
composite_done(c);
return c;
} else {
talloc_free(default_binding);
}
}
}
}
epmapper_binding = talloc_zero(c, struct dcerpc_binding);
if (composite_nomem(epmapper_binding, c)) return c;
/* basic endpoint mapping data */
epmapper_binding->transport = binding->transport;
epmapper_binding->host = talloc_reference(epmapper_binding, binding->host);
epmapper_binding->options = NULL;
epmapper_binding->flags = 0;
epmapper_binding->endpoint = NULL;
/* initiate rpc pipe connection */
pipe_connect_req = dcerpc_pipe_connect_b_send(c, epmapper_binding, &dcerpc_table_epmapper,
anon_creds, c->event_ctx);
if (composite_nomem(pipe_connect_req, c)) return c;
composite_continue(c, pipe_connect_req, continue_epm_recv_binding, c);
return c;
}
/*
Receive result of endpoint mapping request
*/
NTSTATUS dcerpc_epm_map_binding_recv(struct composite_context *c)
{
NTSTATUS status = composite_wait(c);
talloc_free(c);
return status;
}
/*
Get endpoint mapping for rpc connection
*/
NTSTATUS dcerpc_epm_map_binding(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding,
const struct dcerpc_interface_table *table, struct event_context *ev)
{
struct composite_context *c;
c = dcerpc_epm_map_binding_send(mem_ctx, binding, table, ev);
return dcerpc_epm_map_binding_recv(c);
}
struct pipe_auth_state {
struct dcerpc_pipe *pipe;
struct dcerpc_binding *binding;
const struct dcerpc_interface_table *table;
struct cli_credentials *credentials;
};
static void continue_auth_schannel(struct composite_context *ctx);
static void continue_auth(struct composite_context *ctx);
static void continue_auth_none(struct composite_context *ctx);
static void continue_ntlmssp_connection(struct composite_context *ctx);
static void continue_spnego_after_wrong_pass(struct composite_context *ctx);
/*
Stage 2 of pipe_auth: Receive result of schannel bind request
*/
static void continue_auth_schannel(struct composite_context *ctx)
{
struct composite_context *c = talloc_get_type(ctx->async.private_data,
struct composite_context);
c->status = dcerpc_bind_auth_schannel_recv(ctx);
if (!composite_is_ok(c)) return;
composite_done(c);
}
/*
Stage 2 of pipe_auth: Receive result of authenticated bind request
*/
static void continue_auth(struct composite_context *ctx)
{
struct composite_context *c = talloc_get_type(ctx->async.private_data,
struct composite_context);
c->status = dcerpc_bind_auth_recv(ctx);
if (!composite_is_ok(c)) return;
composite_done(c);
}
/*
Stage 2 of pipe_auth: Receive result of authenticated bind request, but handle fallbacks:
SPNEGO -> NTLMSSP
*/
static void continue_auth_auto(struct composite_context *ctx)
{
struct composite_context *c = talloc_get_type(ctx->async.private_data,
struct composite_context);
struct pipe_auth_state *s = talloc_get_type(c->private_data, struct pipe_auth_state);
struct composite_context *sec_conn_req;
c->status = dcerpc_bind_auth_recv(ctx);
if (NT_STATUS_EQUAL(c->status, NT_STATUS_INVALID_PARAMETER)) {
/*
* Retry with NTLMSSP auth as fallback
* send a request for secondary rpc connection
*/
sec_conn_req = dcerpc_secondary_connection_send(s->pipe,
s->binding);
composite_continue(c, sec_conn_req, continue_ntlmssp_connection, c);
return;
} else if (NT_STATUS_EQUAL(c->status, NT_STATUS_LOGON_FAILURE)) {
if (cli_credentials_wrong_password(s->credentials)) {
/*
* Retry SPNEGO with a better password
* send a request for secondary rpc connection
*/
sec_conn_req = dcerpc_secondary_connection_send(s->pipe,
s->binding);
composite_continue(c, sec_conn_req, continue_spnego_after_wrong_pass, c);
return;
}
}
if (!composite_is_ok(c)) return;
composite_done(c);
}
/*
Stage 3 of pipe_auth (fallback to NTLMSSP case): Receive secondary
rpc connection (the first one can't be used any more, due to the
bind nak) and perform authenticated bind request
*/
static void continue_ntlmssp_connection(struct composite_context *ctx)
{
struct composite_context *c;
struct pipe_auth_state *s;
struct composite_context *auth_req;
struct dcerpc_pipe *p2;
c = talloc_get_type(ctx->async.private_data, struct composite_context);
s = talloc_get_type(c->private_data, struct pipe_auth_state);
/* receive secondary rpc connection */
c->status = dcerpc_secondary_connection_recv(ctx, &p2);
if (!composite_is_ok(c)) return;
/* keep the new pipe around by reassining the parent from the composite
context of the current I/O to the pipe_auth_state structure for this
request */
talloc_steal(s, p2);
/* we don't need the original pipe much longer, but it has some data
we'd like to hold onto, so reassign its parent to the pipe_auth_state
as well, and then swap pointers with our new pipe */
talloc_steal(s, s->pipe);
s->pipe = p2;
/* initiate a authenticated bind */
auth_req = dcerpc_bind_auth_send(c, s->pipe, s->table,
s->credentials, DCERPC_AUTH_TYPE_NTLMSSP,
dcerpc_auth_level(s->pipe->conn),
s->table->authservices->names[0]);
composite_continue(c, auth_req, continue_auth, c);
}
/*
Stage 3 of pipe_auth (retry on wrong password): Receive secondary
rpc connection (the first one can't be used any more, due to the
bind nak) and perform authenticated bind request
*/
static void continue_spnego_after_wrong_pass(struct composite_context *ctx)
{
struct composite_context *c;
struct pipe_auth_state *s;
struct composite_context *auth_req;
struct dcerpc_pipe *p2;
c = talloc_get_type(ctx->async.private_data, struct composite_context);
s = talloc_get_type(c->private_data, struct pipe_auth_state);
/* receive secondary rpc connection */
c->status = dcerpc_secondary_connection_recv(ctx, &p2);
if (!composite_is_ok(c)) return;
/* keep the new pipe around by reassining the parent from the composite
context of the current I/O to the pipe_auth_state structure for this
request */
talloc_steal(s, p2);
/* we don't need the original pipe much longer, but it has some data
we'd like to hold onto, so reassign its parent to the pipe_auth_state
as well, and then swap pointers with our new pipe */
talloc_steal(s, s->pipe);
s->pipe = p2;
/* initiate a authenticated bind */
auth_req = dcerpc_bind_auth_send(c, s->pipe, s->table,
s->credentials, DCERPC_AUTH_TYPE_SPNEGO,
dcerpc_auth_level(s->pipe->conn),
s->table->authservices->names[0]);
composite_continue(c, auth_req, continue_auth, c);
}
/*
Stage 2 of pipe_auth: Receive result of non-authenticated bind request
*/
static void continue_auth_none(struct composite_context *ctx)
{
struct composite_context *c = talloc_get_type(ctx->async.private_data,
struct composite_context);
c->status = dcerpc_bind_auth_none_recv(ctx);
if (!composite_is_ok(c)) return;
composite_done(c);
}
/*
Request to perform an authenticated bind if required. Authentication
is determined using credentials passed and binding flags.
*/
struct composite_context *dcerpc_pipe_auth_send(struct dcerpc_pipe *p,
struct dcerpc_binding *binding,
const struct dcerpc_interface_table *table,
struct cli_credentials *credentials)
{
struct composite_context *c;
struct pipe_auth_state *s;
struct composite_context *auth_schannel_req;
struct composite_context *auth_req;
struct composite_context *auth_none_req;
struct dcerpc_connection *conn;
uint8_t auth_type;
/* composite context allocation and setup - use the memory parent of the
dcerpc_pipe passed in since we will replace the provided pipe with the
new one if the connection is successful */
c = composite_create(talloc_parent(p), p->conn->event_ctx);
if (c == NULL) return NULL;
s = talloc_zero(c, struct pipe_auth_state);
if (composite_nomem(s, c)) return c;
c->private_data = s;
/* store parameters in state structure */
s->binding = binding;
s->table = table;
s->credentials = credentials;
s->pipe = p;
conn = s->pipe->conn;
conn->flags = binding->flags;
/* remember the binding string for possible secondary connections */
conn->binding_string = dcerpc_binding_string(p, binding);
if (cli_credentials_is_anonymous(s->credentials)) {
auth_none_req = dcerpc_bind_auth_none_send(c, s->pipe, s->table);
composite_continue(c, auth_none_req, continue_auth_none, c);
return c;
}
if ((binding->flags & DCERPC_SCHANNEL) &&
!cli_credentials_get_netlogon_creds(s->credentials)) {
/* If we don't already have netlogon credentials for
* the schannel bind, then we have to get these
* first */
auth_schannel_req = dcerpc_bind_auth_schannel_send(c, s->pipe, s->table,
s->credentials,
dcerpc_auth_level(conn));
composite_continue(c, auth_schannel_req, continue_auth_schannel, c);
return c;
}
/*
* we rely on the already authenticated CIFS connection
* if not doing sign or seal
*/
if (conn->transport.transport == NCACN_NP &&
!(s->binding->flags & (DCERPC_SIGN|DCERPC_SEAL))) {
auth_none_req = dcerpc_bind_auth_none_send(c, s->pipe, s->table);
composite_continue(c, auth_none_req, continue_auth_none, c);
return c;
}
/* Perform an authenticated DCE-RPC bind
*/
if (!(conn->flags & (DCERPC_SIGN|DCERPC_SEAL))) {
/*
we are doing an authenticated connection,
but not using sign or seal. We must force
the CONNECT dcerpc auth type as a NONE auth
type doesn't allow authentication
information to be passed.
*/
conn->flags |= DCERPC_CONNECT;
}
if (s->binding->flags & DCERPC_AUTH_SPNEGO) {
auth_type = DCERPC_AUTH_TYPE_SPNEGO;
} else if (s->binding->flags & DCERPC_AUTH_KRB5) {
auth_type = DCERPC_AUTH_TYPE_KRB5;
} else if (s->binding->flags & DCERPC_SCHANNEL) {
auth_type = DCERPC_AUTH_TYPE_SCHANNEL;
} else if (s->binding->flags & DCERPC_AUTH_NTLM) {
auth_type = DCERPC_AUTH_TYPE_NTLMSSP;
} else {
/* try SPNEGO with fallback to NTLMSSP */
auth_req = dcerpc_bind_auth_send(c, s->pipe, s->table,
s->credentials, DCERPC_AUTH_TYPE_SPNEGO,
dcerpc_auth_level(conn),
s->table->authservices->names[0]);
composite_continue(c, auth_req, continue_auth_auto, c);
return c;
}
auth_req = dcerpc_bind_auth_send(c, s->pipe, s->table,
s->credentials, auth_type,
dcerpc_auth_level(conn),
s->table->authservices->names[0]);
composite_continue(c, auth_req, continue_auth, c);
return c;
}
/*
Receive result of authenticated bind request on dcerpc pipe
This returns *p, which may be different to the one originally
supllied, as it rebinds to a new pipe due to authentication fallback
*/
NTSTATUS dcerpc_pipe_auth_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
struct dcerpc_pipe **p)
{
NTSTATUS status;
struct pipe_auth_state *s = talloc_get_type(c->private_data,
struct pipe_auth_state);
status = composite_wait(c);
if (!NT_STATUS_IS_OK(status)) {
char *uuid_str = GUID_string(s->pipe, &s->table->syntax_id.uuid);
DEBUG(0, ("Failed to bind to uuid %s - %s\n", uuid_str, nt_errstr(status)));
talloc_free(uuid_str);
status = NT_STATUS_ACCESS_DENIED;
} else {
talloc_steal(mem_ctx, s->pipe);
*p = s->pipe;
}
talloc_free(c);
return status;
}
/*
Perform an authenticated bind if needed - sync version
This may change *p, as it rebinds to a new pipe due to authentication fallback
*/
NTSTATUS dcerpc_pipe_auth(TALLOC_CTX *mem_ctx,
struct dcerpc_pipe **p,
struct dcerpc_binding *binding,
const struct dcerpc_interface_table *table,
struct cli_credentials *credentials)
{
struct composite_context *c;
c = dcerpc_pipe_auth_send(*p, binding, table, credentials);
return dcerpc_pipe_auth_recv(c, mem_ctx, p);
}
NTSTATUS dcerpc_generic_session_key(struct dcerpc_connection *c,
DATA_BLOB *session_key)
{
/* this took quite a few CPU cycles to find ... */
session_key->data = discard_const_p(unsigned char, "SystemLibraryDTC");
session_key->length = 16;
return NT_STATUS_OK;
}
/*
fetch the user session key - may be default (above) or the SMB session key
*/
NTSTATUS dcerpc_fetch_session_key(struct dcerpc_pipe *p,
DATA_BLOB *session_key)
{
return p->conn->security_state.session_key(p->conn, session_key);
}
/*
log a rpc packet in a format suitable for ndrdump. This is especially useful
for sealed packets, where ethereal cannot easily see the contents
this triggers on a debug level of >= 10
*/
void dcerpc_log_packet(const struct dcerpc_interface_table *ndr,
uint32_t opnum, uint32_t flags, DATA_BLOB *pkt)
{
const int num_examples = 20;
int i;
if (DEBUGLEVEL < 10) return;
for (i=0;i<num_examples;i++) {
char *name=NULL;
asprintf(&name, "%s/rpclog/%s-%u.%d.%s",
lp_lockdir(), ndr->name, opnum, i,
(flags&NDR_IN)?"in":"out");
if (name == NULL) {
return;
}
if (!file_exist(name)) {
if (file_save(name, pkt->data, pkt->length)) {
DEBUG(10,("Logged rpc packet to %s\n", name));
}
free(name);
break;
}
free(name);
}
}
/*
create a secondary context from a primary connection
this uses dcerpc_alter_context() to create a new dcerpc context_id
*/
NTSTATUS dcerpc_secondary_context(struct dcerpc_pipe *p,
struct dcerpc_pipe **pp2,
const struct dcerpc_interface_table *table)
{
NTSTATUS status;
struct dcerpc_pipe *p2;
p2 = talloc_zero(p, struct dcerpc_pipe);
if (p2 == NULL) {
return NT_STATUS_NO_MEMORY;
}
p2->conn = talloc_reference(p2, p->conn);
p2->request_timeout = p->request_timeout;
p2->context_id = ++p->conn->next_context_id;
p2->syntax = table->syntax_id;
p2->transfer_syntax = ndr_transfer_syntax;
status = dcerpc_alter_context(p2, p2, &p2->syntax, &p2->transfer_syntax);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(p2);
return status;
}
*pp2 = p2;
return status;
}
| 27.502837 | 113 | 0.711339 | [
"object"
] |
52822c7247868a7ce62fdfaf898be0ca605e8c12 | 731 | h | C | src/image_builder.h | CyberSinh/chromaprint | 3dbc9adeec86f1bafc7a05969766562b9217deac | [
"MIT"
] | 582 | 2016-06-14T14:49:36.000Z | 2022-03-27T16:17:57.000Z | src/image_builder.h | CyberSinh/chromaprint | 3dbc9adeec86f1bafc7a05969766562b9217deac | [
"MIT"
] | 72 | 2016-07-28T14:27:55.000Z | 2022-03-19T18:32:44.000Z | src/image_builder.h | CyberSinh/chromaprint | 3dbc9adeec86f1bafc7a05969766562b9217deac | [
"MIT"
] | 102 | 2016-08-21T17:36:10.000Z | 2022-02-13T15:35:44.000Z | // Copyright (C) 2010-2016 Lukas Lalinsky
// Distributed under the MIT license, see the LICENSE file for details.
#ifndef CHROMAPRINT_IMAGE_BUILDER_H_
#define CHROMAPRINT_IMAGE_BUILDER_H_
#include <vector>
#include "utils.h"
#include "image.h"
#include "feature_vector_consumer.h"
namespace chromaprint {
class ImageBuilder : public FeatureVectorConsumer {
public:
ImageBuilder(Image *image = 0);
~ImageBuilder();
void Reset(Image *image) {
set_image(image);
}
void Consume(std::vector<double> &features);
Image *image() const {
return m_image;
}
void set_image(Image *image) {
m_image = image;
}
private:
CHROMAPRINT_DISABLE_COPY(ImageBuilder);
Image *m_image;
};
}; // namespace chromaprint
#endif
| 17.404762 | 71 | 0.738714 | [
"vector"
] |
52832e4e3c4537fc2401c7fe9adeb410c6e976d7 | 22,224 | h | C | Analysis/ionstats/ionstats.h | iontorrent/TS | 7591590843c967435ee093a3ffe9a2c6dea45ed8 | [
"Apache-2.0"
] | 125 | 2015-01-22T05:43:23.000Z | 2022-03-22T17:15:59.000Z | Analysis/ionstats/ionstats.h | iontorrent/TS | 7591590843c967435ee093a3ffe9a2c6dea45ed8 | [
"Apache-2.0"
] | 59 | 2015-02-10T09:13:06.000Z | 2021-11-11T02:32:38.000Z | Analysis/ionstats/ionstats.h | iontorrent/TS | 7591590843c967435ee093a3ffe9a2c6dea45ed8 | [
"Apache-2.0"
] | 98 | 2015-01-17T01:25:10.000Z | 2022-03-18T17:29:42.000Z | /* Copyright (C) 2012 Ion Torrent Systems, Inc. All Rights Reserved */
#ifndef IONSTATS_H
#define IONSTATS_H
#include <assert.h>
#include <vector>
#include <algorithm>
#include <stdint.h>
#include <math.h>
#include "json/json.h"
#include "OptArgs.h"
#define IONSTATS_BIGGEST_PHRED 47
#define TYPICAL_FLOWS_PER_BASE 2
#define NUMBER_OF_NUCLEOTIDES 4
#define DEFAULT_SEQ_KEY "TCAG"
#define DEFAULT_BARCODE ""
#define DEFAULT_BARCODE_OUTPUT ""
using namespace std;
int IonstatsBasecaller(OptArgs &opts);
int IonstatsBasecallerReduce(const string& output_json_filename, const vector<string>& input_jsons);
int IonstatsAlignment(OptArgs &opts, const string &program_str);
int IonstatsAlignmentReduce(const string& output_json_filename, const vector<string>& input_jsons);
int IonstatsAlignmentReduceH5(const string& output_h5_filename, const vector<string>& input_h5_filename, bool merge_proton_blocks);
int IonstatsTestFragments(OptArgs &opts);
int IonstatsTestFragmentsReduce(const string& output_json_filename, const vector<string>& input_jsons);
// =================================================================================
// ReadLengthHistogram keeps track of:
// - the actual histogram
// - number of reads
// - number of bases
// - mean read length (derived: num_bases/num_reads)
// - max read length
class ReadLengthHistogram {
public:
ReadLengthHistogram() : num_reads_(0), num_bases_(0), max_read_length_(0) {}
~ReadLengthHistogram() {}
void Initialize(int histogram_length) { histogram_.assign(histogram_length,0); }
void Add(unsigned int read_length) {
num_reads_++;
num_bases_ += read_length;
if (read_length > max_read_length_)
max_read_length_ = read_length;
read_length = min(read_length,(unsigned int)histogram_.size()-1);
histogram_[read_length]++;
}
void SummarizeToJson(Json::Value& json_value) {
json_value["num_bases"] = (Json::UInt64)num_bases_;
json_value["num_reads"] = (Json::UInt64)num_reads_;
json_value["max_read_length"] = max_read_length_;
json_value["mean_read_length"] = (Json::UInt64)(num_reads_ ? (num_bases_ / num_reads_) : 0);
}
void SaveToJson(Json::Value& json_value) {
SummarizeToJson(json_value);
json_value["read_length_histogram"] = Json::arrayValue;
for (unsigned int idx = 0; idx < histogram_.size(); ++idx)
json_value["read_length_histogram"][idx] = (Json::UInt64)histogram_[idx];
}
void LoadFromJson(const Json::Value& json_value) {
num_bases_ = json_value["num_bases"].asInt64();
num_reads_ = json_value["num_reads"].asInt64();
max_read_length_ = json_value["max_read_length"].asInt();
int histogram_length = json_value["read_length_histogram"].size();
histogram_.assign(histogram_length,0);
for (unsigned int idx = 0; idx < histogram_.size(); ++idx)
histogram_[idx] = json_value["read_length_histogram"][idx].asUInt64();
}
void MergeFrom(const ReadLengthHistogram& other) {
num_bases_ += other.num_bases_;
num_reads_ += other.num_reads_;
max_read_length_ = max(max_read_length_, other.max_read_length_);
int histogram_length = max(histogram_.size(), other.histogram_.size());
histogram_.resize(histogram_length,0);
for (unsigned int idx = 0; idx < other.histogram_.size(); ++idx)
histogram_[idx] += other.histogram_[idx];
}
uint64_t num_reads() const { return num_reads_; };
unsigned int max_length() const { return max_read_length_; };
private:
vector<uint64_t> histogram_;
uint64_t num_reads_;
uint64_t num_bases_;
unsigned int max_read_length_;
};
// =================================================================================
class ReadAlignmentErrors {
public:
ReadAlignmentErrors() : have_data_(false), len_(0), first_(0), last_(0) {}
~ReadAlignmentErrors() {}
void Initialize() {have_data_=false; len_=0; first_=0; last_=0; ins_.resize(0); del_.resize(0); del_len_.resize(0); sub_.resize(0); no_call_.resize(0); err_.resize(0); err_len_.resize(0); inc_.resize(0);}
void SetHaveData (bool b=true) { have_data_= b; }
void SetLen (const uint16_t i) { len_= i; }
void SetFirst (const uint16_t i) { first_= i; }
void SetLast (const uint16_t i) { last_= i; }
void AddIns (const uint16_t i) { ins_.push_back(i); }
void AddDel (const uint16_t i, const uint16_t l=1, bool append=true) {
if(append) {
del_.push_back(i);
del_len_.push_back(l);
} else {
del_.insert(del_.begin(),i);
del_len_.insert(del_len_.begin(),l);
}
}
void AddDel (const vector <uint16_t> &d) {
for(vector <uint16_t>::const_iterator it=d.begin(); it != d.end(); ++it) {
del_.push_back(*it);
del_len_.push_back(1);
}
}
void AddSub (const uint16_t i) { sub_.push_back(i); }
void AddNoCall (const uint16_t i) { no_call_.push_back(i); }
uint64_t AlignedLen(void) const {
if(len_ > 0)
return( (first_ < last_) ? (last_ - first_ + 1) : (first_ - last_ + 1) );
else
return(0);
}
// ----------------------------------------------------
void ConsolidateErrors(void) {
// Convert deletion list so that multi-base deletions are represented as multiple single-base deletions
vector<uint16_t> del_single;
del_single.reserve(floor(del_.size() * 1.3));
for(unsigned int i=0; i<del_.size(); ++i)
for(unsigned int j=0; j<del_len_[i]; ++j)
del_single.push_back(del_[i]);
// Merge-sort insertions, deletions & substitutions to a list of single-error positions
vector<uint16_t> indel(ins_.size() + del_single.size());
merge(ins_.begin(),ins_.end(),del_single.begin(),del_single.end(),indel.begin());
vector<uint16_t> err_single(indel.size() + sub_.size());
merge(indel.begin(),indel.end(),sub_.begin(),sub_.end(),err_single.begin());
// Collapse cases of multiple errors at same position
err_.resize(0);
err_.reserve(err_single.size());
err_len_.resize(0);
err_len_.reserve(err_single.size());
uint16_t last_err_pos=0;
uint16_t err_len=0;
for(unsigned int i=0; i<err_single.size(); ++i) {
if( (i > 0) && (err_single[i]!=last_err_pos) ) {
// Have completed an error, store & reset
err_.push_back(last_err_pos);
err_len_.push_back(err_len);
err_len=0;
}
last_err_pos = err_single[i];
err_len++;
}
if(err_len > 0) {
err_.push_back(last_err_pos);
err_len_.push_back(err_len);
}
}
// ----------------------------------------------------
void Print (void) {
cout << "(Length,First,Last) = (" << len_ << ", " << first_ << ", " << last_ << ")\n";
vector<uint16_t>::iterator it;
cout << " Insertions: ";
for(it=ins_.begin(); it != ins_.end(); ++it)
cout << *it << ", ";
cout << "\n";
cout << " Deletions: ";
for(unsigned int i=0; i < del_.size(); ++i)
cout << del_[i] << " (" << del_len_[i] << "), ";
cout << "\n";
cout << " Substitutions: ";
for(it=sub_.begin(); it != sub_.end(); ++it)
cout << *it << ", ";
cout << "\n";
cout << " Errors: ";
for(unsigned int i=0; i < err_.size(); ++i)
cout << err_[i] << " (" << err_len_[i] << "), ";
cout << "\n";
cout << " NoCalls: ";
for(it=no_call_.begin(); it != no_call_.end(); ++it)
cout << *it << ", ";
cout << "\n";
if(inc_.size() > 0) {
cout << " Incorporations: ";
for(unsigned int i=0; i < inc_.size(); ++i)
cout << inc_[i] << ", ";
cout << "\n";
}
}
// ----------------------------------------------------
void ShiftPositions (int shift) {
if(shift==0)
return;
len_ += shift;
last_ += shift;
vector<uint16_t>::iterator it;
for(it=ins_.begin(); it != ins_.end(); ++it)
*it += shift;
for(it=del_.begin(); it != del_.end(); ++it)
*it += shift;
for(it=sub_.begin(); it != sub_.end(); ++it)
*it += shift;
for(it=no_call_.begin(); it != no_call_.end(); ++it)
*it += shift;
for(it=err_.begin(); it != err_.end(); ++it)
*it += shift;
for(it=inc_.begin(); it != inc_.end(); ++it)
*it += shift;
}
// ----------------------------------------------------
bool IsAligned(uint16_t position) { return( position >= first_ && position <= last_ ); }
bool HasError(uint16_t position) { return(binary_search(err_.begin(),err_.end(),position)); }
void Reserve(unsigned int r) {
ins_.reserve(r);
del_.reserve(r);
del_len_.reserve(r);
sub_.reserve(r);
no_call_.reserve(r);
err_.reserve(r);
err_len_.reserve(r);
inc_.reserve(r);
}
bool have_data() { return have_data_; }
uint16_t len() { return len_; }
uint16_t first() { return first_; }
uint16_t last() { return last_; }
const vector<uint16_t> & ins() { return ins_; }
const vector<uint16_t> & del() { return del_; }
const vector<uint16_t> & del_len() { return del_len_; }
const vector<uint16_t> & sub() { return sub_; }
const vector<uint16_t> & no_call() { return no_call_; }
const vector<uint16_t> & err() { return err_; }
const vector<uint16_t> & err_len() { return err_len_; }
vector<uint16_t> & inc() { return inc_; }
private:
bool have_data_; // used to indicate whether or not there were data to fill this object
uint16_t len_; // Number of bases or flows
uint16_t first_; // First aligned base or flow
uint16_t last_; // Last aligned base or flow
vector<uint16_t> ins_; // vector of positions where there are insertions
vector<uint16_t> del_; // vector of positions where there are deletions
vector<uint16_t> del_len_; // vector of deletion lengths
vector<uint16_t> sub_; // vector of positions where there are substitutions
vector<uint16_t> no_call_; // vector of positions where there are no_calls
vector<uint16_t> err_; // vector of positions where there are errors of any kind
vector<uint16_t> err_len_; // vector of error lengths
vector<uint16_t> inc_; // vector of positions where there are incorporations (only really relevant/useful for flowspace)
};
// =================================================================================
// MetricGeneratorSNR
class MetricGeneratorSNR {
public:
MetricGeneratorSNR() {
for (int idx = 0; idx < NUMBER_OF_NUCLEOTIDES; idx++) {
zeromer_1_moment_[idx] = 0;
zeromer_2_moment_[idx] = 0;
zeromer_1_moment_kahan_compensation_[idx] = 0;
zeromer_2_moment_kahan_compensation_[idx] = 0;
zeromer_count_[idx] = 0;
onemer_1_moment_[idx] = 0;
onemer_2_moment_[idx] = 0;
onemer_1_moment_kahan_compensation_[idx] = 0;
onemer_2_moment_kahan_compensation_[idx] = 0;
onemer_count_[idx] = 0;
}
nuc_to_int_['A'] = 0;
nuc_to_int_['C'] = 1;
nuc_to_int_['G'] = 2;
nuc_to_int_['T'] = 3;
nuc_to_int_['a'] = 0;
nuc_to_int_['c'] = 1;
nuc_to_int_['g'] = 2;
nuc_to_int_['t'] = 3;
}
void KahanRunningMean(double &mean, double &compensation, uint64_t n, double new_value) {
double weight = (double) (n-1) / double (n);
mean = mean * weight;
new_value *= (1.0 - weight);
double temp1 = new_value - compensation;
double temp2 = mean + new_value;
compensation = (temp2 - mean) - temp1;
mean = temp2;
}
void Add(const vector<uint16_t>& flow_signal, const string &key, const string& flow_order)
{
for (unsigned int flow = 0, base=0; flow < flow_signal.size(); ++flow) {
char nuc = flow_order[flow % flow_order.length()];
unsigned int nuc_idx = nuc_to_int_[nuc];
if (key[base] == nuc) { // Onemer
if(1+base == key.size()) {
// Last Onemer, skip as it may be connected to same base in library
break;
} else {
base++;
onemer_count_[nuc_idx]++;
KahanRunningMean(onemer_1_moment_[nuc_idx], onemer_1_moment_kahan_compensation_[nuc_idx], onemer_count_[nuc_idx], flow_signal[flow]);
KahanRunningMean(onemer_2_moment_[nuc_idx], onemer_2_moment_kahan_compensation_[nuc_idx], onemer_count_[nuc_idx], flow_signal[flow] * flow_signal[flow]);
}
} else { // Zeromer
zeromer_count_[nuc_idx]++;
KahanRunningMean(zeromer_1_moment_[nuc_idx], zeromer_1_moment_kahan_compensation_[nuc_idx], zeromer_count_[nuc_idx], flow_signal[flow]);
KahanRunningMean(zeromer_2_moment_[nuc_idx], zeromer_2_moment_kahan_compensation_[nuc_idx], zeromer_count_[nuc_idx], flow_signal[flow] * flow_signal[flow]);
}
}
}
void Add(const vector<int16_t>& flow_signal, const string &key, const string& flow_order)
{
for (unsigned int flow = 0, base=0; flow < flow_signal.size(); ++flow) {
char nuc = flow_order[flow % flow_order.length()];
unsigned int nuc_idx = nuc_to_int_[nuc];
if (key[base] == nuc) { // Onemer
if(1+base == key.size()) {
// Last Onemer, skip as it may be connected to same base in library
break;
} else {
base++;
onemer_count_[nuc_idx]++;
KahanRunningMean(onemer_1_moment_[nuc_idx], onemer_1_moment_kahan_compensation_[nuc_idx], onemer_count_[nuc_idx], flow_signal[flow]);
KahanRunningMean(onemer_2_moment_[nuc_idx], onemer_2_moment_kahan_compensation_[nuc_idx], onemer_count_[nuc_idx], flow_signal[flow] * flow_signal[flow]);
}
} else { // Zeromer
zeromer_count_[nuc_idx]++;
KahanRunningMean(zeromer_1_moment_[nuc_idx], zeromer_1_moment_kahan_compensation_[nuc_idx], zeromer_count_[nuc_idx], flow_signal[flow]);
KahanRunningMean(zeromer_2_moment_[nuc_idx], zeromer_2_moment_kahan_compensation_[nuc_idx], zeromer_count_[nuc_idx], flow_signal[flow] * flow_signal[flow]);
}
}
}
void LoadFromJson(const Json::Value& json_value) {
for(int idx = 0; idx < NUMBER_OF_NUCLEOTIDES; idx++) {
zeromer_1_moment_[idx] = json_value["key_zeromer_1_moment"][idx].asDouble();
zeromer_2_moment_[idx] = json_value["key_zeromer_2_moment"][idx].asDouble();
zeromer_count_[idx] = json_value["key_zeromer_count"][idx].asInt64();
onemer_1_moment_[idx] = json_value["key_onemer_1_moment"][idx].asDouble();
onemer_2_moment_[idx] = json_value["key_onemer_2_moment"][idx].asDouble();
onemer_count_[idx] = json_value["key_onemer_count"][idx].asInt64();
}
}
void MergeFrom(const MetricGeneratorSNR& other) {
double weight=0;
for(int idx = 0; idx < NUMBER_OF_NUCLEOTIDES; idx++) {
if(zeromer_count_[idx] > 0 && other.zeromer_count_[idx] > 0) {
weight = (double) zeromer_count_[idx] / (double) (zeromer_count_[idx] + other.zeromer_count_[idx]);
zeromer_1_moment_[idx] = (zeromer_1_moment_[idx] * weight) + (other.zeromer_1_moment_[idx] * (1.0 - weight));
zeromer_2_moment_[idx] = (zeromer_2_moment_[idx] * weight) + (other.zeromer_2_moment_[idx] * (1.0 - weight));
} else if(zeromer_count_[idx] == 0 && other.zeromer_count_[idx] > 0) {
zeromer_1_moment_[idx] = other.zeromer_1_moment_[idx];
zeromer_2_moment_[idx] = other.zeromer_2_moment_[idx];
}
if(onemer_count_[idx] > 0 && other.onemer_count_[idx] > 0) {
weight = (double) onemer_count_[idx] / (double) (onemer_count_[idx] + other.onemer_count_[idx]);
onemer_1_moment_[idx] = (onemer_1_moment_[idx] * weight) + (other.onemer_1_moment_[idx] * (1.0 - weight));
onemer_2_moment_[idx] = (onemer_2_moment_[idx] * weight) + (other.onemer_2_moment_[idx] * (1.0 - weight));
} else if(onemer_count_[idx] == 0 && other.onemer_count_[idx] > 0) {
onemer_1_moment_[idx] = other.onemer_1_moment_[idx];
onemer_2_moment_[idx] = other.onemer_2_moment_[idx];
}
zeromer_count_[idx] += other.zeromer_count_[idx];
onemer_count_[idx] += other.onemer_count_[idx];
}
}
double SystemSNR(void) {
double nuc_snr = 0;
unsigned int num_valid_nucs = 0;
for(int idx = 0; idx < NUMBER_OF_NUCLEOTIDES; idx++) {
if(zeromer_count_[idx] > 0 && onemer_count_[idx] > 0) {
double zeromer_var = zeromer_2_moment_[idx] - zeromer_1_moment_[idx] * zeromer_1_moment_[idx];
double onemer_var = onemer_2_moment_[idx] - onemer_1_moment_[idx] * onemer_1_moment_[idx];
// This is the wrong way to summarize the variance of the difference, but it has
// been done this way since The Beginning so we keep it this way for backwards comparability
double average_stdev = (sqrt(zeromer_var) + sqrt(onemer_var)) / 2.0;
if (average_stdev > 0.0) {
nuc_snr += (onemer_1_moment_[idx] - zeromer_1_moment_[idx]) / average_stdev;
num_valid_nucs++;
}
}
}
if(num_valid_nucs > 0)
nuc_snr /= (double) num_valid_nucs;
return(nuc_snr);
}
void SaveToJson(Json::Value& json_value) {
json_value["key_zeromer_1_moment"] = Json::arrayValue;
json_value["key_zeromer_2_moment"] = Json::arrayValue;
json_value["key_zeromer_count"] = Json::arrayValue;
json_value["key_onemer_1_moment"] = Json::arrayValue;
json_value["key_onemer_2_moment"] = Json::arrayValue;
json_value["key_onemer_count"] = Json::arrayValue;
for(int idx = 0; idx < NUMBER_OF_NUCLEOTIDES; idx++) {
json_value["key_zeromer_1_moment"][idx] = zeromer_1_moment_[idx];
json_value["key_zeromer_2_moment"][idx] = zeromer_2_moment_[idx];
json_value["key_zeromer_count"][idx] = (Json::UInt64) zeromer_count_[idx];
json_value["key_onemer_1_moment"][idx] = onemer_1_moment_[idx];
json_value["key_onemer_2_moment"][idx] = onemer_2_moment_[idx];
json_value["key_onemer_count"][idx] = (Json::UInt64) onemer_count_[idx];
}
json_value["system_snr"] = SystemSNR();
}
private:
map<char, unsigned int> nuc_to_int_;
double zeromer_1_moment_[NUMBER_OF_NUCLEOTIDES];
double zeromer_2_moment_[NUMBER_OF_NUCLEOTIDES];
double zeromer_1_moment_kahan_compensation_[NUMBER_OF_NUCLEOTIDES];
double zeromer_2_moment_kahan_compensation_[NUMBER_OF_NUCLEOTIDES];
uint64_t zeromer_count_[NUMBER_OF_NUCLEOTIDES];
double onemer_1_moment_[NUMBER_OF_NUCLEOTIDES];
double onemer_2_moment_[NUMBER_OF_NUCLEOTIDES];
double onemer_1_moment_kahan_compensation_[NUMBER_OF_NUCLEOTIDES];
double onemer_2_moment_kahan_compensation_[NUMBER_OF_NUCLEOTIDES];
uint64_t onemer_count_[NUMBER_OF_NUCLEOTIDES];
};
// =================================================================================
class BaseQVHistogram {
public:
BaseQVHistogram() : histogram_(64,0) {}
void Add (const string& fastq_qvs) {
for (unsigned int idx = 0; idx < fastq_qvs.length(); ++idx)
histogram_[max(min(fastq_qvs[idx]-33,63),0)]++;
}
void MergeFrom(const BaseQVHistogram& other) {
for (int qv = 0; qv < 64; ++qv)
histogram_[qv] += other.histogram_[qv];
}
void SaveToJson(Json::Value& json_value) {
json_value["qv_histogram"] = Json::arrayValue;
for (int qv = 0; qv < 64; ++qv)
json_value["qv_histogram"][qv] = (Json::Int64)histogram_[qv];
}
void LoadFromJson(const Json::Value& json_value) {
for (int qv = 0; qv < 64; ++qv)
histogram_[qv] = json_value["qv_histogram"][qv].asInt64();
}
private:
vector<uint64_t> histogram_;
};
// =================================================================================
class SimpleHistogram {
public:
void Initialize(int histogram_length) { histogram_.assign(histogram_length,0); }
void Initialize(vector<uint64_t>::iterator begin, vector<uint64_t>::iterator end) { histogram_.assign(begin,end); }
uint64_t Count (unsigned int value) { return(histogram_[value]); }
unsigned int Size (void) { return(histogram_.size()); }
void Add (unsigned int value, unsigned int count=1) {
value = min(value,(unsigned int)histogram_.size()-1);
histogram_[value] += count;
}
void MergeFrom(const SimpleHistogram& other) {
int histogram_length = max(histogram_.size(), other.histogram_.size());
histogram_.resize(histogram_length,0);
for (unsigned int idx = 0; idx < other.histogram_.size(); ++idx)
histogram_[idx] += other.histogram_[idx];
}
void SaveToJson(Json::Value& json_value) {
json_value = Json::arrayValue;
for (unsigned int idx = 0; idx < histogram_.size(); ++idx)
json_value[idx] = (Json::Int64)histogram_[idx];
}
void LoadFromJson(const Json::Value& json_value) {
int histogram_length = json_value.size();
histogram_.assign(histogram_length,0);
for (unsigned int idx = 0; idx < histogram_.size(); ++idx)
histogram_[idx] = json_value[idx].asUInt64();
}
void clear(void) { histogram_.clear(); }
private:
vector<uint64_t> histogram_;
};
// =================================================================================
class MetricGeneratorHPAccuracy {
public:
MetricGeneratorHPAccuracy() {
for(int hp = 0; hp < 8; hp++) {
hp_count_[hp] = 0;
hp_accuracy_[hp] = 0;
}
}
void Add(int ref_hp, int called_hp) {
if (ref_hp >= 8)
return;
hp_count_[ref_hp]++;
if (ref_hp == called_hp)
hp_accuracy_[ref_hp]++;
}
void LoadFromJson(const Json::Value& json_value) {
for(int hp = 0; hp < 8; hp++) {
hp_accuracy_[hp] = json_value["hp_accuracy_numerator"][hp].asUInt64();
hp_count_[hp] = json_value["hp_accuracy_denominator"][hp].asInt64();
}
}
void SaveToJson(Json::Value& json_value) {
for(int hp = 0; hp < 8; hp++) {
json_value["hp_accuracy_numerator"][hp] = (Json::UInt64)hp_accuracy_[hp];
json_value["hp_accuracy_denominator"][hp] = (Json::UInt64)hp_count_[hp];
}
}
void MergeFrom(const MetricGeneratorHPAccuracy& other) {
for(int hp = 0; hp < 8; hp++) {
hp_count_[hp] += other.hp_count_[hp];
hp_accuracy_[hp] += other.hp_accuracy_[hp];
}
}
private:
uint64_t hp_accuracy_[8];
uint64_t hp_count_[8];
};
#endif // IONSTATS_H
| 38.054795 | 206 | 0.633189 | [
"object",
"vector"
] |
5287e8f082a40610f7aff227b78290ab69b44cfa | 10,986 | h | C | src/Vector.h | mDevv/AISDI-Linear | 8dd1e04c1ef622857ca9a1d7e8c7e9458142cc2b | [
"MIT"
] | null | null | null | src/Vector.h | mDevv/AISDI-Linear | 8dd1e04c1ef622857ca9a1d7e8c7e9458142cc2b | [
"MIT"
] | null | null | null | src/Vector.h | mDevv/AISDI-Linear | 8dd1e04c1ef622857ca9a1d7e8c7e9458142cc2b | [
"MIT"
] | null | null | null | #ifndef AISDI_LINEAR_VECTOR_H
#define AISDI_LINEAR_VECTOR_H
#define INIT_BUFFER_SIZE 64 // AN ITERATION OF 2!
#include <cstddef>
#include <initializer_list>
#include <stdexcept>
namespace aisdi
{
template <typename Type>
class Vector
{
private:
size_t size;
size_t bufCapacity;
char *buffer;
Type *bufBegin;
Type *next;
Type *bufEnd;
void increaseSize(size_t requiredSize)
{
size_t newCapacity = calcCapacity(requiredSize);
char* newBuf = new char[sizeof(Type) * (newCapacity + 1)];
Type* orgNext = next;
Type* orgBufBegin = bufBegin;
bufCapacity = newCapacity;
next = reinterpret_cast<Type*>(newBuf) + (next - bufBegin);
bufBegin = reinterpret_cast<Type*>(newBuf);
bufEnd = bufBegin + bufCapacity;
if (size > 0)
{
Type* ptr = orgBufBegin;
Type* tmpNext = bufBegin;
while (ptr != orgNext)
{
new(tmpNext) Type(*ptr);
ptr->~Type();
++ptr;
++tmpNext;
}
}
delete [] buffer;
buffer = newBuf;
}
void clear()
{
while (!isEmpty())
{
(next - 1)->~Type();
--next;
--size;
}
}
size_t calcCapacity(size_t requiredSize)
{
size_t newCapacity = INIT_BUFFER_SIZE;
while (newCapacity <= requiredSize)
newCapacity = newCapacity << 1;
return newCapacity;
}
public:
using difference_type = std::ptrdiff_t;
using size_type = std::size_t;
using value_type = Type;
using pointer = Type *;
using reference = Type &;
using const_pointer = const Type *;
using const_reference = const Type &;
class ConstIterator;
class Iterator;
using iterator = Iterator;
using const_iterator = ConstIterator;
Vector() : Vector(INIT_BUFFER_SIZE) {}
Vector(size_t capacity) : size(0), bufCapacity(capacity)
{
buffer = new char[sizeof(Type) * (bufCapacity + 1)];
bufBegin = reinterpret_cast<Type *>(buffer);
next = bufBegin;
bufEnd = bufBegin + bufCapacity;
}
Vector(std::initializer_list<Type> l) : Vector(calcCapacity(l.size()))
{
for (const Type& el : l)
append(el);
}
Vector(const Vector &other) : Vector(calcCapacity(other.size))
{
for (auto i = other.begin(); i != other.end(); i++)
append(*i);
}
Vector(Vector &&other) : size(0), bufCapacity(0), buffer(nullptr), bufBegin(nullptr), next(nullptr), bufEnd(nullptr)
{
*this = std::move(other);
}
~Vector()
{
if (buffer)
{
clear();
delete [] buffer;
}
}
Vector &operator=(const Vector &other)
{
if (this != &other)
{
clear();
for (auto i = other.begin(); i != other.end(); i++)
append(*i);
}
return *this;
}
Vector &operator=(Vector &&other)
{
if (this != &other)
{
if (buffer)
{
clear();
delete [] buffer;
}
size = other.size;
bufCapacity = other.bufCapacity;
buffer = other.buffer;
bufBegin = other.bufBegin;
next = other.next;
bufEnd = other.bufEnd;
other.size = 0;
other.bufCapacity = 0;
other.buffer = nullptr;
other.bufBegin = nullptr;
other.next = nullptr;
other.bufEnd = nullptr;
}
return *this;
}
bool isEmpty() const
{
return bufBegin == next;
}
size_type getSize() const
{
return size;
}
void append(const Type &item)
{
if (size == bufCapacity)
increaseSize(size + 1);
new(next) Type(item);
++next;
++size;
}
void prepend(const Type &item)
{
if (isEmpty())
{
append(item);
return;
}
if (size == bufCapacity)
increaseSize(size + 1);
Type* tmp = next - 1;
Type* tmpNext = next;
while (tmp != bufBegin)
{
new(tmpNext) Type(*tmp);
tmp->~Type();
--tmp;
--tmpNext;
}
new(tmpNext) Type(*tmp);
tmp->~Type();
new(bufBegin) Type(item);
++next;
++size;
}
void insert(const const_iterator &insertPosition, const Type &item)
{
if (insertPosition == cend())
{
append(item);
return;
}
if (insertPosition == cbegin())
{
prepend(item);
return;
}
if (size == bufCapacity)
increaseSize(size + 1);
Type* tmp = next - 1;
Type* tmpNext = next;
while (tmp != insertPosition.ptr)
{
new(tmpNext) Type(*tmp);
tmp->~Type();
--tmp;
--tmpNext;
}
new(tmpNext) Type(*tmp);
tmp->~Type();
new(insertPosition.ptr) Type(item);
++next;
++size;
}
Type popFirst()
{
if (isEmpty())
throw std::logic_error("Collection already empty");
Type ret = *bufBegin;
bufBegin->~Type();
Type* tmp = bufBegin + 1;
Type* tmpNext = bufBegin;
while (tmp != next)
{
new(tmpNext) Type(*tmp);
tmp->~Type();
++tmp;
++tmpNext;
}
--next;
--size;
return ret;
}
Type popLast()
{
if (isEmpty())
throw std::logic_error("Collection already empty");
Type tmp = *(next - 1);
(next - 1)->~Type();
--next;
--size;
return tmp;
}
void erase(const const_iterator &position)
{
if (isEmpty() || position == cend())
throw std::out_of_range("Position out of range");
position.ptr->~Type();
Type *tmp = position.ptr + 1;
Type *tmpNext = position.ptr;
while (tmp != next)
{
new (tmpNext) Type(*tmp);
tmp->~Type();
++tmp;
++tmpNext;
}
--next;
--size;
}
void erase(const const_iterator &firstIncluded,
const const_iterator &nextExcluded)
{
if (isEmpty())
throw std::out_of_range("Collection already empty");
difference_type rangeSize = nextExcluded.ptr - firstIncluded.ptr;
Type *tmp = firstIncluded.ptr + rangeSize;
Type *tmpNext = firstIncluded.ptr;
auto i = 0;
while (tmp != next)
{
if (i < rangeSize)
tmpNext->~Type();
new (tmpNext) Type(*tmp);
tmp->~Type();
++tmp;
++tmpNext;
}
next -= rangeSize;
size -= rangeSize;
}
iterator begin()
{
return iterator(bufBegin, bufBegin, next);
}
iterator end()
{
return iterator(next, bufBegin, next);
}
const_iterator cbegin() const
{
return const_iterator(bufBegin, bufBegin, next);
}
const_iterator cend() const
{
return const_iterator(next, bufBegin, next);
}
const_iterator begin() const { return cbegin(); }
const_iterator end() const { return cend(); }
};
template <typename Type>
class Vector<Type>::ConstIterator
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = typename Vector::value_type;
using difference_type = typename Vector::difference_type;
using pointer = typename Vector::const_pointer;
using reference = typename Vector::const_reference;
Type* ptr;
Type* begin;
Type* next;
explicit ConstIterator(Type* ptr, Type* begin, Type* next) : ptr(ptr), begin(begin), next(next)
{
}
reference operator*() const
{
if (ptr == next)
throw std::out_of_range("This iterator does not point to a valid item");
return *ptr;
}
ConstIterator &operator++()
{
if (ptr == next)
throw std::out_of_range("The next iterator does not exist");
++ptr;
return *this;
}
ConstIterator operator++(int)
{
ConstIterator tmp(ptr, begin, next);
++(*this);
return tmp;
}
ConstIterator &operator--()
{
if (ptr == begin)
throw std::out_of_range("The previous iterator does not exist");
--ptr;
return *this;
}
ConstIterator operator--(int)
{
ConstIterator tmp(ptr, begin, next);
--(*this);
return tmp;
}
ConstIterator operator+(difference_type d) const
{
difference_type distToNext = next - ptr;
if (d > distToNext)
throw std::out_of_range("Given iterator does not exist");
ConstIterator tmp(ptr + d, begin, next);
return tmp;
}
ConstIterator operator-(difference_type d) const
{
difference_type distToBeg = ptr - begin;
if (d > distToBeg)
throw std::out_of_range("Given iterator does not exist");
ConstIterator tmp(ptr - d, begin, next);
return tmp;
}
bool operator==(const ConstIterator &other) const
{
return this->ptr == other.ptr;
}
bool operator!=(const ConstIterator &other) const
{
return !(*this == other);
}
};
template <typename Type>
class Vector<Type>::Iterator : public Vector<Type>::ConstIterator
{
public:
using pointer = typename Vector::pointer;
using reference = typename Vector::reference;
explicit Iterator(Type* ptr, Type* begin, Type* next) : ConstIterator(ptr, begin, next) {}
Iterator(const ConstIterator &other) : ConstIterator(other) {}
Iterator &operator++()
{
ConstIterator::operator++();
return *this;
}
Iterator operator++(int)
{
auto result = *this;
ConstIterator::operator++();
return result;
}
Iterator &operator--()
{
ConstIterator::operator--();
return *this;
}
Iterator operator--(int)
{
auto result = *this;
ConstIterator::operator--();
return result;
}
Iterator operator+(difference_type d) const
{
return ConstIterator::operator+(d);
}
Iterator operator-(difference_type d) const
{
return ConstIterator::operator-(d);
}
reference operator*() const
{
// ugly cast, yet reduces code duplication.
return const_cast<reference>(ConstIterator::operator*());
}
};
}
#endif // AISDI_LINEAR_VECTOR_H
| 22.193939 | 120 | 0.517022 | [
"vector"
] |
52a025a22a73fa2a0e034aa46d42c9f4ba0793c9 | 1,802 | h | C | crypt_sha256_ctr.h | SystemOverlord/crypto_SHA256_CTR | 61aa61bdd53fa9eee24223658960dbaed98de319 | [
"Unlicense"
] | null | null | null | crypt_sha256_ctr.h | SystemOverlord/crypto_SHA256_CTR | 61aa61bdd53fa9eee24223658960dbaed98de319 | [
"Unlicense"
] | null | null | null | crypt_sha256_ctr.h | SystemOverlord/crypto_SHA256_CTR | 61aa61bdd53fa9eee24223658960dbaed98de319 | [
"Unlicense"
] | null | null | null | //
// THIS SOFTWARE IS NOT TESTED AND PROVIDES INSECURE ENCRYPTION.
// DO NOT USE IT IN SERIOUS BUISNESS!
//
// 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// software written by
// Olaf Pichler, system.overlord@magheute.net
//
#ifndef CRYPT_SHA256_CTR_H
#define CRYPT_SHA256_CTR_H
#include "sha256.h"
#include "utils.h"
#include <QString>
#include <vector>
class crypt_sha256_ctr
{
public:
crypt_sha256_ctr(){}
// The actuall encryption and decryption
std::vector<u_int32_t> crypt(std::vector<u_int32_t> data, std::vector<u_int32_t> key, std::vector<u_int32_t> nounce);
// data have to contain the cleartext data for encryption and the chiphered data for decryption
// key have to contain the encryption-key
// nounce have to contain random data you can safe in cleartext (also called salt)
// Qstring and implementations of crypt
QString cryptQStr(QString data, QString key, QString nounce);
// Functions to convert QString to std::vector<u_int32_t> and return
QString VecUInt32ToQStr(std::vector<u_int32_t> vec);
std::vector<u_int32_t> QStrToVecUInt32(QString str);
private:
// Functions to convert std::vector<u_int32_t> to std::string
std::string VecUINT32ToStdStr(std::vector<u_int32_t> data);
};
#endif // CRYPT_SHA256_CTR_H
| 38.340426 | 125 | 0.724195 | [
"vector"
] |
26e41306a5d5c81b8e19dafa2ce95a0b0de1a5a5 | 612 | h | C | Vic2ToHoI4/Source/V2World/Issues/IssuesBuilder.h | gawquon/Vic2ToHoI4 | 8371cfb1fd57cf81d854077963135d8037e754eb | [
"MIT"
] | 25 | 2018-12-10T03:41:49.000Z | 2021-10-04T10:42:36.000Z | Vic2ToHoI4/Source/V2World/Issues/IssuesBuilder.h | gawquon/Vic2ToHoI4 | 8371cfb1fd57cf81d854077963135d8037e754eb | [
"MIT"
] | 739 | 2018-12-13T02:01:20.000Z | 2022-03-28T02:57:13.000Z | Vic2ToHoI4/Source/V2World/Issues/IssuesBuilder.h | Osariusz/Vic2ToHoI4 | 9738b52c7602b1fe187c3820660c58a8d010d87e | [
"MIT"
] | 43 | 2018-12-10T03:41:58.000Z | 2022-03-22T23:55:41.000Z | #ifndef ISSUES_BUILDER_H
#define ISSUES_BUILDER_H
#include "Issues.h"
#include <memory>
namespace Vic2
{
class Issues::Builder
{
public:
Builder() { issues = std::make_unique<Issues>(); }
std::unique_ptr<Issues> build() { return std::move(issues); }
Builder& setIssueNames(std::vector<std::string> issueNames)
{
issues->issueNames = std::move(issueNames);
return *this;
}
Builder& addIssueName(std::string issueName)
{
issues->issueNames.push_back(std::move(issueName));
return *this;
}
private:
std::unique_ptr<Issues> issues;
};
} // namespace Vic2
#endif // ISSUES_BUILDER_H | 15.3 | 62 | 0.70098 | [
"vector"
] |
26ec10b607859783d834df3b2999c14dc215d57a | 7,723 | h | C | src/ffmpegAVFrameImageComponentSource.h | hokiedsp/libffmpegio | 633f71017d33a5e4ac129e80945aec436de72aa7 | [
"BSD-2-Clause"
] | 1 | 2019-10-18T09:09:37.000Z | 2019-10-18T09:09:37.000Z | src/ffmpegAVFrameImageComponentSource.h | hokiedsp/libffmpegio | 633f71017d33a5e4ac129e80945aec436de72aa7 | [
"BSD-2-Clause"
] | null | null | null | src/ffmpegAVFrameImageComponentSource.h | hokiedsp/libffmpegio | 633f71017d33a5e4ac129e80945aec436de72aa7 | [
"BSD-2-Clause"
] | 1 | 2019-10-18T09:09:37.000Z | 2019-10-18T09:09:37.000Z | #pragma once
#include "ffmpegAVFrameBufferBases.h" // import AVFrameSinkBase
#include "ffmpegException.h" // import AVFrameSinkBase
#include "ffmpegImageUtils.h"
#include "ffmpegLogUtils.h"
extern "C" {
#include <libavutil/pixfmt.h> // import AVPixelFormat
#include <libavutil/pixdesc.h> // import AVPixFmtDescriptor
#include <libavutil/error.h>
#include <libavutil/rational.h>
#include <libavutil/frame.h>
}
#include <memory>
namespace ffmpeg
{
/**
* \brief An AVFrame sink for a video stream to store frames' component data
* An AVFrame sink, which converts a received video AVFrame to component data (e.g., RGB)
*/
class AVFrameImageComponentSource : public AVFrameSourceBase, public VideoAVFrameHandler
{
public:
AVFrameImageComponentSource()
: AVFrameSourceBase(AVMEDIA_TYPE_VIDEO, AVRational({1, 1})),
next_time(0), status(0) {}
// copy constructor
AVFrameImageComponentSource(const AVFrameImageComponentSource &other)
: AVFrameSourceBase(other), VideoAVFrameHandler(other),
status(other.status), next_time(other.next_time) {}
// move constructor
AVFrameImageComponentSource(AVFrameImageComponentSource &&other) noexcept
: AVFrameSourceBase(other), VideoAVFrameHandler(other), status(other.status),
next_time(other.next_time) {}
virtual ~AVFrameImageComponentSource()
{
av_log(NULL, AV_LOG_INFO, "destroyed AVFrameImageComponentSource\n");
}
bool supportedFormat(int format) const
{
return format != AV_PIX_FMT_NONE ? imageCheckComponentSize((AVPixelFormat)format) : false;
}
/**
* \brief Returns true if the data stream has reached end-of-file
*
* Returns true if the queued data stream has reached end-of-file.
* @return True if the last pushed AVFrame was an EOF marker.
*/
bool eof()
{
// no room or eof
std::unique_lock<std::mutex> l_tx(m);
return status < 0;
}
/**
* \brief Put new frame data into the buffer
*
* Place the new image data onto the AVFrame buffer. This includes the byte-array data as well
* as the video frame parameeter.
*
* @param[in] params Image parameters (format, width, height, SAR)
* @param[in] pdata Points to the frame component data buffer or NULL to end stream
* @param[in] frame_offset First frame offset relative to the first frame in the buffer. The offset is given in frames.
* @return Number of frame available in the returned pointers.
*/
void load(VideoParams params, const uint8_t *pdata, const int pdata_size, const int linesize = 0, const int compsize = 0)
{
// create new frame first without destroying current frame in case writing fails
// if data is present, create new AVFrame, else mark it eof
if (pdata)
{
// overwrite any invalid params values with the object's value
if (params.format == AV_PIX_FMT_NONE)
params.format = (AVPixelFormat)frame->format;
if (params.width <= 0)
params.width = frame->width;
if (params.height <= 0)
params.height = frame->height;
if (av_cmp_q(params.sample_aspect_ratio, {0, 0}))
params.sample_aspect_ratio = frame->sample_aspect_ratio;
int total_size = imageGetComponentBufferSize(params.format, params.width, params.height);
if (!total_size)
throw Exception("[ffmpeg::AVFrameImageComponentSource::load] Critical image parameters missing.");
if (pdata_size < total_size)
throw Exception("[ffmpeg::AVFrameImageComponentSource::load] Not enough data (%d bytes) given to fill the image buffers (%d bytes).", pdata_size, total_size);
auto avFrameFree = [](AVFrame *frame) { av_frame_free(&frame); };
std::unique_ptr<AVFrame, decltype(avFrameFree)> new_frame(av_frame_alloc(), avFrameFree);
if (!new_frame)
throw Exception("[ffmpeg::AVFrameImageComponentSource::load] Could not allocate video frame.");
new_frame->format = params.format;
new_frame->width = params.width;
new_frame->height = params.height;
new_frame->sample_aspect_ratio = params.sample_aspect_ratio;
if (av_frame_get_buffer(new_frame.get(), 0) < 0)
throw Exception("[ffmpeg::AVFrameImageComponentSource::load] Could not allocate the video frame data.");
if (av_frame_make_writable(new_frame.get()) < 0)
throw Exception("[ffmpeg::AVFrameImageComponentSource::load] Could not make the video frame writable.");
imageCopyFromComponentBuffer(pdata, pdata_size, new_frame->data, new_frame->linesize,
(AVPixelFormat)new_frame->format, new_frame->width, new_frame->height,
linesize, compsize);
// successfully created a new frame, ready to update the buffer
std::unique_lock<std::mutex> l_tx(m);
// if NULL, queue NULL to indicate the end of stream
av_frame_unref(frame);
av_frame_move_ref(frame, new_frame.get());
status = av_cmp_q(frame->sample_aspect_ratio, {0, 0}) ? 1 : 0; // if data filled,
}
else
{
std::unique_lock<std::mutex> l_tx(m);
av_frame_unref(frame);
status = -1;
}
// notify that the frame data has been updated
cv_tx.notify_one();
}
/**
* \brief Put new frame data into the buffer
*
* Place the new image data onto the AVFrame buffer. This function takes just the data
* and assumes the video parameters are already loaded correctly.
*
* @param[in] pdata Points to the frame component data buffer or NULL to end stream
* @param[in] frame_offset First frame offset relative to the first frame in the buffer. The offset is given in frames.
* @return Number of frame available in the returned pointers.
*/
void load(const uint8_t *pdata, const int pdata_size, const int linesize = 0, const int compsize = 0)
{
load(getVideoParams(), pdata, pdata_size, linesize, compsize);
}
/**
* \brief Mark the source state to be EOF
*
* \note EOF signal gets popped only once and object goes dormant
*/
void
markEOF()
{
std::unique_lock<std::mutex> l_tx(m);
status = -1;
av_frame_unref(frame);
}
protected:
bool readyToPop_threadunsafe() const
{
// no room or eof
return status != 0;
}
/**
* \brief Return a copy of the stored image as an AVFrame
*
* The implementation for thread-safe AVFrameSource::pop() routine to return
* a copy of the stored image data as an AVFrame.
*
* \note This function is called if and only if status!=0
*
* \returns Populated AVFrame. Caller is responsible to free.
*/
void pop_threadunsafe(AVFrame *outgoing_frame)
{
if (status > 0) // if data available
{
if (av_frame_ref(outgoing_frame, frame) < 0)
throw Exception("[ffmpeg::AVFrameImageComponentSource::pop_threadunsafe] Failed to copy AVFrame.");
outgoing_frame->pts = next_time++;
}
else //if (status < 0)
{
status = 0; // popped eof
}
}
/**
* \brief Clear stored frame data
*
* The implementation for thread-safe AVFrameSource::clear() routine to erase
* the stored image data.
*/
void clear_threadunsafe()
{
// free all allocated AVFrames
if (frame)
av_frame_unref(frame);
// reset the eof flag and write pointer positions
status = 0;
next_time = 0;
}
private:
/**
* \brief Reallocate object's AVFrame
*
* release_frame() unreferences the existing frame but maintains
* the parameter values.
*
*/
void release_frame()
{
VideoAVFrameHandler::release_frame();
status = 0;
}
int64_t next_time; // increments after every pop
int status; // 0:not ready; >0:frame ready; <0:eof ready
};
}
| 33.4329 | 166 | 0.681082 | [
"object"
] |
f8084cbe2ef3de1e9252560878f4acc28c2ecd64 | 86,340 | c | C | n64split.c | farisawan-2000/sm64tools | e734799c09e1a10db35df11d2684600f38076e6e | [
"MIT"
] | null | null | null | n64split.c | farisawan-2000/sm64tools | e734799c09e1a10db35df11d2684600f38076e6e | [
"MIT"
] | null | null | null | n64split.c | farisawan-2000/sm64tools | e734799c09e1a10db35df11d2684600f38076e6e | [
"MIT"
] | null | null | null | #include <inttypes.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <zlib.h>
#include "config.h"
#include "libblast.h"
#include "libmio0.h"
#include "libsfx.h"
#include "mipsdisasm.h"
#include "n64graphics.h"
#include "strutils.h"
#include "utils.h"
#define N64SPLIT_VERSION "0.4a"
#define GLOBALS_FILE "globals.inc"
#define MACROS_FILE "macros.inc"
typedef struct _arg_config
{
char input_file[FILENAME_MAX];
char config_file[FILENAME_MAX];
char output_dir[FILENAME_MAX];
float model_scale;
bool raw_texture; // TODO: this should be the default path once n64graphics is updated
bool large_texture;
bool large_texture_depth;
bool keep_going;
bool merge_pseudo;
} arg_config;
typedef enum {
N64_ROM_INVALID,
N64_ROM_Z64,
N64_ROM_V64,
} n64_rom_format;
// default configuration
static const arg_config default_args =
{
.input_file = "",
.config_file = "",
.output_dir = "",
.model_scale = 1024.0f,
.raw_texture = false,
.large_texture = false,
.large_texture_depth = 16,
.keep_going = false,
.merge_pseudo = false,
};
// static files
#include "n64split.makefile.h"
#include "n64split.collision.mtl.h"
const char asm_header[] =
"# %s disassembly and split file\n"
"# generated by n64split v%s - N64 ROM splitter\n"
"\n"
"# assembler directives\n"
".set noat # allow manual use of $at\n"
".set noreorder # don't insert nops after branches\n"
".set mips3 # Allows 64-bit instructions\n"
"\n"
".include \"" GLOBALS_FILE "\"\n"
"\n";
static void print_spaces(FILE *fp, int count)
{
int i;
for (i = 0; i < count; i++) {
fputc(' ', fp);
}
}
static n64_rom_format n64_rom_type(unsigned char *buf, unsigned int length)
{
const unsigned char bs[] = {0x37, 0x80, 0x40, 0x12}; // byte-swapped
const unsigned char be[] = {0x80, 0x37, 0x12, 0x40}; // big-endian
if (length >= (8 * MB)) {
if (!memcmp(buf, bs, sizeof(bs))) {
return N64_ROM_V64;
}
if (!memcmp(buf, be, sizeof(be))) {
return N64_ROM_Z64;
}
}
return N64_ROM_INVALID;
}
static void gzip_decode_file(char *gzfilename, int offset, char *binfilename)
{
#define CHUNK 0x4000
FILE *file;
FILE *fout;
z_stream strm = {0};
unsigned char in[CHUNK];
unsigned char out[CHUNK];
// TODO: add some error checking
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
strm.avail_in = 0;
inflateInit2(&strm, 16+MAX_WBITS);
file = fopen(gzfilename, "rb");
fout = fopen(binfilename, "wb");
fseek(file, offset, SEEK_SET);
while (1) {
int bytes_read;
bytes_read = fread(in, sizeof(char), sizeof(in), file);
strm.avail_in = bytes_read;
strm.next_in = in;
do {
strm.avail_out = CHUNK;
strm.next_out = out;
inflate(&strm, Z_NO_FLUSH);
fwrite(out, sizeof(char), CHUNK - strm.avail_out, fout);
} while (strm.avail_out == 0);
if (feof(file)) {
inflateEnd(&strm);
break;
}
}
fclose(file);
fclose(fout);
}
static int config_section_lookup(rom_config *config, unsigned int addr, char *label, int is_end)
{
int i;
// check for ROM offsets
switch (is_end) {
case 0:
for (i = 0; i < config->section_count; i++) {
// TODO: hack until mario_animation gets moved or AT() is used
if (config->sections[i].start == addr && addr != 0x4EC000) {
if (config->sections[i].label[0] != '\0') {
sprintf(label, "%s", config->sections[i].label);
} else {
sprintf(label, "%s_%06X", config_section2str(config->sections[i].type), addr);
}
INFO("Found 0 %06X: %s\n", addr, label);
return 0;
}
}
break;
case 1:
for (i = 0; i < config->section_count; i++) {
if (config->sections[i].end == addr) {
if (config->sections[i].label[0] != '\0') {
sprintf(label, "%s_end", config->sections[i].label);
} else {
sprintf(label, "%s_%06X", config_section2str(config->sections[i].type), addr);
}
INFO("Found 1 %06X: %s\n", addr, label);
return 0;
}
}
break;
default:
break;
}
sprintf(label, "0x%X", addr);
return -1;
}
static void write_behavior(FILE *out, unsigned char *data, rom_config *config, int s, disasm_state *state)
{
char label[128];
unsigned int a, i;
unsigned int len;
unsigned int val;
int beh_i;
split_section *sec;
split_section *beh;
sec = &config->sections[s];
beh = sec->children;
a = sec->start;
beh_i = 0;
while (a < sec->end) {
if (beh_i < sec->child_count) {
unsigned int offset = a - sec->start;
if (offset == beh[beh_i].start) {
fprintf(out, "%s: # %04X\n", beh[beh_i].label, beh[beh_i].start);
beh_i++;
} else if (offset > beh[beh_i].start) {
ERROR("Warning: skipped behavior %04X \"%s\"\n", beh[beh_i].start, beh[beh_i].label);
beh_i++;
}
}
switch (data[a]) {
case 0x02:
case 0x04:
case 0x0C:
case 0x13:
case 0x14:
case 0x15:
case 0x16:
case 0x17:
case 0x23:
case 0x27:
case 0x2A:
case 0x2E:
case 0x2F:
case 0x31:
case 0x33:
case 0x36:
case 0x37:
len = 8;
break;
case 0x1C:
case 0x29:
case 0x2B:
case 0x2C:
len = 12;
break;
case 0x30:
len = 20;
break;
default:
len = 4;
break;
}
val = read_u32_be(&data[a]);
fprintf(out, ".word 0x%08X", val);
switch(data[a]) {
case 0x0C: // behavior 0x0C is a function pointer
val = read_u32_be(&data[a+4]);
disasm_label_lookup(state, val, label);
fprintf(out, ", %s\n", label);
break;
case 0x02: // jump to another behavior
case 0x04: // jump to segmented address
case 0x1C: // sub-objects
case 0x29: // sub-objects
case 0x2C: // sub-objects
for (i = 4; i < len-4; i += 4) {
val = read_u32_be(&data[a+i]);
fprintf(out, ", 0x%08X", val);
}
val = read_u32_be(&data[a+len-4]);
disasm_label_lookup(state, val, label);
fprintf(out, ", %s\n", label);
break;
default:
for (i = 4; i < len; i += 4) {
val = read_u32_be(&data[a+i]);
fprintf(out, ", 0x%08X", val);
}
fprintf(out, "\n");
break;
}
a += len;
}
}
typedef struct
{
int length;
const char *macro;
} geo_command;
static geo_command geo_table[] =
{
/* 0x00 */ {0x08, "geo_branch_and_link"},
/* 0x01 */ {0x04, "geo_end"},
/* 0x02 */ {0x08, "geo_branch"},
/* 0x03 */ {0x04, "geo_return"},
/* 0x04 */ {0x04, "geo_open_node"},
/* 0x05 */ {0x04, "geo_close_node"},
/* 0x06 */ {0x04, "geo_todo_06"},
/* 0x07 */ {0x04, "geo_update_node_flags"},
/* 0x08 */ {0x0C, "geo_node_screen_area"},
/* 0x09 */ {0x04, "geo_todo_09"},
/* 0x0A */ {0x08, "geo_camera_frustum"}, // 8-12 variable
/* 0x0B */ {0x04, "geo_node_start"},
/* 0x0C */ {0x04, "geo_zbuffer"},
/* 0x0D */ {0x08, "geo_render_range"},
/* 0x0E */ {0x08, "geo_switch_case"},
/* 0x0F */ {0x14, "geo_todo_0F"},
/* 0x10 */ {0x10, "geo_translate_rotate"}, // variable
/* 0x11 */ {0x08, "geo_todo_11"}, // variable
/* 0x12 */ {0x08, "geo_todo_12"}, // variable
/* 0x13 */ {0x0C, "geo_dl_translated"},
/* 0x14 */ {0x08, "geo_billboard"},
/* 0x15 */ {0x08, "geo_display_list"},
/* 0x16 */ {0x08, "geo_shadow"},
/* 0x17 */ {0x04, "geo_todo_17"},
/* 0x18 */ {0x08, "geo_asm"},
/* 0x19 */ {0x08, "geo_background"},
/* 0x1A */ {0x08, "geo_nop_1A"},
/* 0x1B */ {0x04, "geo_todo_1B"},
/* 0x1C */ {0x0C, "geo_todo_1C"},
/* 0x1D */ {0x08, "geo_scale"}, // variable
/* 0x1E */ {0x08, "geo_nop_1E"},
/* 0x1F */ {0x10, "geo_nop_1F"},
/* 0x20 */ {0x04, "geo_start_distance"},
};
static void write_geolayout(FILE *out, unsigned char *data, unsigned int start, unsigned int end, disasm_state *state)
{
const int INDENT_AMOUNT = 3;
const int INDENT_START = INDENT_AMOUNT;
char label[128];
unsigned int a = start;
unsigned int tmp;
int indent;
int cmd_len;
int print_label = 1;
indent = INDENT_START;
fprintf(out, ".include \"macros.inc\"\n"
".include \"geo_commands.inc\"\n\n"
".section .geo, \"a\"\n\n");
while (a < end) {
unsigned cmd = data[a];
if (print_label) {
fprintf(out, "glabel geo_layout_X_%06X # %04X\n", a, a);
print_label = 0;
}
if ((cmd == 0x01 || cmd == 0x05) && indent > INDENT_AMOUNT) {
indent -= INDENT_AMOUNT;
}
print_spaces(out, indent);
if (cmd < DIM(geo_table)) {
if (cmd != 0x10) { // special case 0x10 since multiple pseudo
fprintf(out, "%s", geo_table[cmd].macro);
}
} else {
ERROR("Unknown geo layout command: 0x%02X\n", cmd);
}
cmd_len = geo_table[cmd].length;
switch (cmd) {
case 0x00: // 00 00 00 00 [SS SS SS SS]: branch and store
tmp = read_u32_be(&data[a+4]);
fprintf(out, " geo_layout_%08X # 0x%08X", tmp, tmp);
break;
case 0x01: // 01 00 00 00: terminate
case 0x03: // 03 00 00 00: return from branch
// no params
fprintf(out, "\n");
indent = INDENT_START;
print_label = 1;
break;
case 0x04: // 04 00 00 00: open node
case 0x05: // 05 00 00 00: close node
case 0x0B: // 05 00 00 00: start geo layout
case 0x17: // 17 00 00 00: set up object rendering
case 0x1A: // 1A 00 00 00 00 00 00 00: no op
case 0x1E: // 1E 00 00 00 00 00 00 00: no op
case 0x1F: // 1E 00 00 00 00 00 00 00 00 00 00 00: no op
// no params
break;
case 0x02: // 02 [AA] 00 00 [SS SS SS SS]
tmp = read_u32_be(&data[a+4]);
fprintf(out, " %d, geo_layout_%08X # 0x%08X", data[a+1], tmp, tmp);
break;
case 0x08: // 08 00 00 [AA] [XX XX] [YY YY] [WW WW] [HH HH]
fprintf(out, " %d, %d, %d, %d, %d", data[a+3],
read_s16_be(&data[a+4]), read_s16_be(&data[a+6]),
read_s16_be(&data[a+8]), read_s16_be(&data[a+10]));
break;
case 0x09: // 09 00 00 [AA]
fprintf(out, " %d", data[a+3]);
break;
case 0x0A: // 0A [AA] [BB BB] [NN NN] [FF FF] {EE EE EE EE}: set camera frustum
fprintf(out, " %d, %d, %d", read_s16_be(&data[a+2]), read_s16_be(&data[a+4]), read_s16_be(&data[a+6]));
if (data[a+1] > 0) {
cmd_len += 4;
disasm_label_lookup(state, read_u32_be(&data[a+8]), label);
fprintf(out, ", %s", label);
}
break;
case 0x0C: // 0C [AA] 00 00: enable/disable Z-buffer
fprintf(out, " %d", data[a+1]);
break;
case 0x0D: // 0D 00 00 00 [AA AA] [BB BB]: set render range
fprintf(out, " %d, %d", read_s16_be(&data[a+4]), read_s16_be(&data[a+6]));
break;
case 0x0E: // 0E 00 [NN NN] [AA AA AA AA]: switch/case
fprintf(out, " %d, geo_switch_case_%08X", read_s16_be(&data[a+2]), read_u32_be(&data[a+4]));
break;
case 0x0F: // 0F 00 [TT TT] [XX XX] [YY YY] [ZZ ZZ] [UU UU] [VV VV] [WW WW] [AA AA AA AA]
fprintf(out, " %d, %d, %d, %d, %d, %d, %d", read_s16_be(&data[a+2]),
read_s16_be(&data[a+4]), read_s16_be(&data[a+6]), read_s16_be(&data[a+8]),
read_s16_be(&data[a+10]), read_s16_be(&data[a+12]), read_s16_be(&data[a+14]));
disasm_label_lookup(state, read_u32_be(&data[a+0x10]), label);
fprintf(out, ", %s", label);
break;
case 0x10: // 10 [AA] [BB BB] [XX XX] [YY YY] [ZZ ZZ] [RX RX] [RY RY] [RZ RZ] {SS SS SS SS}: translate & rotate
{
unsigned char params = data[a+1];
unsigned char field_type = (params & 0x70) >> 4;
unsigned char layer = params & 0xF;
switch (field_type) {
case 0: // 10 [0L] 00 00 [TX TX] [TY TY] [TZ TZ] [RX RX] [RY RY] [RZ RZ] {SS SS SS SS}: translate & rotate
fprintf(out, "geo_translate_rotate %d, %d, %d, %d, %d, %d, %d", layer,
read_s16_be(&data[a+4]), read_s16_be(&data[a+6]), read_s16_be(&data[a+8]),
read_s16_be(&data[a+10]), read_s16_be(&data[a+12]), read_s16_be(&data[a+14]));
cmd_len = 16;
break;
case 1: // 10 [1L] [TX TX] [TY TY] [TZ TZ] {SS SS SS SS}: translate
fprintf(out, "geo_translate %d, %d, %d, %d", layer,
read_s16_be(&data[a+2]), read_s16_be(&data[a+4]), read_s16_be(&data[a+6]));
cmd_len = 8;
break;
case 2: // 10 [2L] [RX RX] [RY RY] [RZ RZ] {SS SS SS SS}: rotate
fprintf(out, "geo_rotate %d, %d, %d, %d", layer,
read_s16_be(&data[a+2]), read_s16_be(&data[a+4]), read_s16_be(&data[a+6]));
cmd_len = 8;
break;
case 3: // 10 [3L] [RY RY] {SS SS SS SS}: rotate Y
fprintf(out, "geo_rotate_y %d, %d", layer, read_s16_be(&data[a+2]));
cmd_len = 4;
break;
}
if (params & 0x80) {
tmp = read_u32_be(&data[a+cmd_len]);
fprintf(out, ", seg%X_dl_%08X", (tmp >> 24) & 0xFF, tmp);
cmd_len += 4;
}
break;
}
case 0x11: // 11 [P][L] [XX XX] [YY YY] [ZZ ZZ] {SS SS SS SS}: ? scene graph node, optional DL
case 0x12: // 12 [P][L] [XX XX] [YY YY] [ZZ ZZ] {SS SS SS SS}: ? scene graph node, optional DL
case 0x14: // 14 [P][L] [XX XX] [YY YY] [ZZ ZZ] {SS SS SS SS}: billboard model
fprintf(out, " 0x%02X, %d, %d, %d", data[a+1] & 0xF, read_s16_be(&data[a+2]),
read_s16_be(&data[a+4]), read_s16_be(&data[a+6]));
if (data[a+1] & 0x80) {
disasm_label_lookup(state, read_u32_be(&data[a+8]), label);
fprintf(out, ", %s", label);
cmd_len += 4;
}
break;
case 0x13: // 13 [LL] [XX XX] [YY YY] [ZZ ZZ] [AA AA AA AA]: scene graph node with layer and translation
fprintf(out, " 0x%02X, %d, %d, %d", data[a+1],
read_s16_be(&data[a+2]), read_s16_be(&data[a+4]), read_s16_be(&data[a+6]));
tmp = read_u32_be(&data[a+8]);
if (tmp != 0x0) {
fprintf(out, ", seg%X_dl_%08X", data[a+8], tmp);
}
break;
case 0x15: // 15 [LL] 00 00 [AA AA AA AA]: load display list
fprintf(out, " 0x%02X, seg%X_dl_%08X", data[a+1], data[a+4], read_u32_be(&data[a+4]));
break;
case 0x16: // 16 00 00 [AA] 00 [BB] [CC CC]: start geo layout with shadow
fprintf(out, " 0x%02X, 0x%02X, %d", data[a+3], data[a+5], read_s16_be(&data[a+6]));
break;
case 0x18: // 18 00 [XX XX] [AA AA AA AA]: load polygons from asm
case 0x19: // 19 00 [TT TT] [AA AA AA AA]: set background/skybox
disasm_label_lookup(state, read_u32_be(&data[a+4]), label);
fprintf(out, " %d, %s", read_s16_be(&data[a+2]), label);
break;
case 0x1B: // 1B 00 [XX XX]: ??
fprintf(out, " %d", read_s16_be(&data[a+2]));
break;
case 0x1C: // 1C [PP] [XX XX] [YY YY] [ZZ ZZ] [AA AA AA AA]
disasm_label_lookup(state, read_u32_be(&data[a+8]), label);
fprintf(out, " 0x%02X, %d, %d, %d, %s", data[a+1], read_s16_be(&data[a+2]),
read_s16_be(&data[a+4]), read_s16_be(&data[a+6]), label);
break;
case 0x1D: // 1D [P][L] 00 00 [MM MM MM MM] {SS SS SS SS}: scale model
fprintf(out, " 0x%02X, %d", data[a+1] & 0xF, read_u32_be(&data[a+4]));
if (data[a+1] & 0x80) {
disasm_label_lookup(state, read_u32_be(&data[a+8]), label);
fprintf(out, ", %s", label);
cmd_len += 4;
}
break;
case 0x20: // 20 00 [AA AA]: start geo layout with rendering area
fprintf(out, " %d", read_s16_be(&data[a+2]));
break;
default:
ERROR("Unknown geo layout command: 0x%02X\n", cmd);
break;
}
fprintf(out, "\n");
switch (cmd) {
case 0x04: // open_node
case 0x08: // node_screen_area
//case 0x0B: // node_start
case 0x16: // geo_shadow
case 0x20: // start_distance
indent += INDENT_AMOUNT;
default:
break;
}
if (cmd == 0x01 || cmd == 0x03) { // end or return
a += cmd_len;
cmd_len = 0;
while (a < end && 0 == read_u32_be(&data[a])) {
fprintf(out, ".word 0x0\n");
a += 4;
}
}
a += cmd_len;
}
}
static void write_level(FILE *out, unsigned char *data, rom_config *config, int s, disasm_state *state)
{
char start_label[128];
char end_label[128];
char dst_label[128];
split_section *sec;
unsigned int ptr_start;
unsigned int ptr_end;
unsigned int dst;
unsigned int a;
int i;
int beh_i;
sec = &config->sections[s];
beh_i = -1;
// see if there is a behavior section
for (i = 0; i < config->section_count; i++) {
if (config->sections[i].type == TYPE_SM64_BEHAVIOR) {
beh_i = i;
break;
}
}
a = sec->start;
while (a < sec->end) {
// length = 0 ends level script
if (data[a+1] == 0) {
break;
}
switch (data[a]) {
case 0x00: // load and jump from ROM into a RAM segment
case 0x01: // load and jump from ROM into a RAM segment
case 0x17: // copy uncompressed data from ROM to a RAM segment
case 0x18: // decompress MIO0 data from ROM and copy it into a RAM segment
case 0x1A: // decompress MIO0 data from ROM and copy it into a RAM segment (for texture only segments?)
ptr_start = read_u32_be(&data[a+4]);
ptr_end = read_u32_be(&data[a+8]);
config_section_lookup(config, ptr_start, start_label, 0);
config_section_lookup(config, ptr_end, end_label, 1);
fprintf(out, ".word 0x");
for (i = 0; i < 4; i++) {
fprintf(out, "%02X", data[a+i]);
}
if (0 == strcmp("behavior_data", start_label)) {
fprintf(out, ", __load_%s, __load_%s", start_label, end_label);
} else {
fprintf(out, ", %s, %s", start_label, end_label);
}
for (i = 12; i < data[a+1]; i++) {
if ((i & 0x3) == 0) {
fprintf(out, ", 0x");
}
fprintf(out, "%02X", data[a+i]);
}
fprintf(out, "\n");
break;
case 0x11: // call function
case 0x12: // call function
ptr_start = read_u32_be(&data[a+0x4]);
disasm_label_lookup(state, ptr_start, start_label);
fprintf(out, ".word 0x%08X, %s # %08X\n", read_u32_be(&data[a]), start_label, ptr_start);
break;
case 0x16: // load ASM into RAM
dst = read_u32_be(&data[a+0x4]);
ptr_start = read_u32_be(&data[a+0x8]);
ptr_end = read_u32_be(&data[a+0xc]);
// TODO: differentiate between start/end
disasm_label_lookup(state, dst, dst_label);
config_section_lookup(config, ptr_start, start_label, 0);
config_section_lookup(config, ptr_end, end_label, 1);
fprintf(out, ".word 0x");
for (i = 0; i < 4; i++) {
fprintf(out, "%02X", data[a+i]);
}
fprintf(out, ", %s, %s, %s\n", dst_label, start_label, end_label);
break;
case 0x25: // load mario object with behavior
case 0x24: // load object with behavior
fprintf(out, ".word 0x%08X", read_u32_be(&data[a]));
for (i = 4; i < data[a+1]-4; i+=4) {
fprintf(out, ", 0x%08X", read_u32_be(&data[a+i]));
}
dst = read_u32_be(&data[a+i]);
if (beh_i >= 0) {
unsigned int offset = dst & 0xFFFFFF;
split_section *beh = config->sections[beh_i].children;
for (i = 0; i < config->sections[beh_i].child_count; i++) {
if (offset == beh[i].start) {
fprintf(out, ", %s", beh[i].label);
break;
}
}
if (i >= config->sections[beh_i].child_count) {
ERROR("Error: cannot find behavior %04X needed at offset %X\n", offset, a);
}
} else {
fprintf(out, ", 0x%08X", dst);
}
fprintf(out, "\n");
break;
default:
fprintf(out, ".word 0x%08X", read_u32_be(&data[a]));
for (i = 4; i < data[a+1]; i+=4) {
fprintf(out, ", 0x%08X", read_u32_be(&data[a+i]));
}
fprintf(out, "\n");
break;
}
a += data[a+1];
}
// align to next 16-byte boundary
if (a & 0x0F) {
fprintf(out, "# begin %s alignment 0x%X\n", sec->label, a);
fprintf(out, ".byte ");
fprint_hex_source(out, &data[a], ALIGN(a, 16) - a);
fprintf(out, "\n");
a = ALIGN(a, 16);
}
// remaining is geo layout script
fprintf(out, "# begin %s geo 0x%X\n", sec->label, a);
write_geolayout(out, &data[sec->start], a - sec->start, sec->end - sec->start, state);
}
static void parse_music_sequences(FILE *out, unsigned char *data, split_section *sec, arg_config *args, strbuf *makeheader)
{
#define MUSIC_SUBDIR "music"
typedef struct {
unsigned start;
unsigned length;
} sequence;
typedef struct {
unsigned revision;
unsigned count;
sequence *seq;
} sequence_bank;
char music_dir[FILENAME_MAX];
char m64_file[FILENAME_MAX];
char m64_file_rel[FILENAME_MAX];
char seq_name[128];
sequence_bank seq_bank = {0};
unsigned i;
sprintf(music_dir, "%s/%s", args->output_dir, MUSIC_SUBDIR);
make_dir(music_dir);
seq_bank.revision = read_u16_be(&data[sec->start]);
seq_bank.count = read_u16_be(&data[sec->start+2]);
if (seq_bank.count > 0) {
seq_bank.seq = malloc(seq_bank.count * sizeof(*seq_bank.seq));
for (i = 0; i < seq_bank.count; i++) {
seq_bank.seq[i].start = read_u32_be(&data[sec->start+i*8+4]);
seq_bank.seq[i].length = read_u32_be(&data[sec->start+i*8+8]);
}
}
fprintf(out, "\n# music sequence table\n");
fprintf(out, "music_sequence_table_header:\n");
fprintf(out, ".hword %d, (music_sequence_table_end - music_sequence_table) / 8\n", seq_bank.revision);
fprintf(out, "music_sequence_table:\n");
for (i = 0; i < seq_bank.count; i++) {
sprintf(seq_name, "seq_%02X", i);
fprintf(out, ".word (%s - music_sequence_table_header), (%s_end - %s) # 0x%05X, 0x%04X\n",
seq_name, seq_name, seq_name, seq_bank.seq[i].start, seq_bank.seq[i].length);
}
fprintf(out, "music_sequence_table_end:\n");
fprintf(out, "\n.align 4, 0x01\n");
for (i = 0; i < seq_bank.count; i++) {
sprintf(seq_name, "seq_%02X", i);
fprintf(out, "\n%s:", seq_name);
sprintf(m64_file, "%s/%s.m64", music_dir, seq_name);
write_file(m64_file, &data[sec->start + seq_bank.seq[i].start], seq_bank.seq[i].length);
sprintf(m64_file_rel, "%s/%s.m64", MUSIC_SUBDIR, seq_name);
fprintf(out, "\n.incbin \"%s\"\n", m64_file_rel);
// append to Makefile
strbuf_sprintf(makeheader, " \\\n$(MUSIC_DIR)/%s.m64", seq_name);
fprintf(out, "%s_end:\n", seq_name);
}
// free used memory
if (seq_bank.count > 0) {
free(seq_bank.seq);
}
}
static void parse_instrument_set(FILE *out, unsigned char *data, split_section *sec)
{
unsigned *instrument_set;
unsigned count;
unsigned i, cur;
count = sec->child_count;
// each sequence has its own instrument set defined by offsets table
instrument_set = malloc(count * sizeof(*instrument_set));
for (i = 0; i < count; i++) {
instrument_set[i] = read_u16_be(&data[sec->start + 2*i]);
}
fprintf(out, "\ninstrument_sets:\n");
for (i = 0; i < count; i++) {
fprintf(out, ".hword instrument_set_%02X - instrument_sets # 0x%04X\n", i, instrument_set[i]);
}
// output each instrument set
cur = 0;
for (i = 2*count; sec->start + i < sec->end; i++) {
unsigned char val = data[sec->start + i];
if (instrument_set[cur] == i) {
fprintf(out, "\ninstrument_set_%02X:\n.byte 0x%02X", cur, val);
cur++;
} else {
fprintf(out, ", 0x%02X", val);
}
}
fprintf(out, "\ninstrument_sets_end:\n");
}
static void generate_globals(arg_config *args, rom_config *config)
{
char globalfilename[FILENAME_MAX];
FILE *fglobal;
sprintf(globalfilename, "%s/%s", args->output_dir, GLOBALS_FILE);
fglobal = fopen(globalfilename, "w");
if (fglobal == NULL) {
ERROR("Error opening %s\n", globalfilename);
exit(3);
}
fprintf(fglobal, "# globally accessible functions and data\n"
"# these will be accessible by C code and show up in the .map file\n\n");
for (int i = 0; i < config->label_count; i++) {
fprintf(fglobal, ".global %s\n", config->labels[i].name);
}
fprintf(fglobal, "\n");
fclose(fglobal);
}
static void generate_macros(arg_config *args)
{
char incfilename[FILENAME_MAX];
FILE *finc;
sprintf(incfilename, "%s/%s", args->output_dir, MACROS_FILE);
finc = fopen(incfilename, "w");
if (finc == NULL) {
ERROR("Error opening %s\n", incfilename);
exit(3);
}
fprintf(finc, "# common macros\n"
"\n"
"# F3D vertex\n"
".macro vertex \\x, \\y, \\z, \\u, \\v, \\r=0xFF, \\g=0xFF, \\b=0xFF, \\a=0xFF\n"
" .hword \\x, \\y, \\z, 0, \\u, \\v\n .byte \\r, \\g, \\b, \\a\n"
".endm\n");
fclose(finc);
}
static void parse_sound_banks(FILE *out, unsigned char *data, split_section *secCtl, split_section *secTbl, arg_config *args, strbuf *makeheader)
{
#define SOUNDS_SUBDIR "sounds"
// TODO: unused parameters
(void)out;
(void)makeheader;
char sound_dir[FILENAME_MAX];
char sfx_file[FILENAME_MAX];
unsigned i, j, sound_count;
sfx_initialize_key_table();
sprintf(sound_dir, "%s/%s", args->output_dir, SOUNDS_SUBDIR);
make_dir(sound_dir);
sound_data_header sound_data = read_sound_data(data, secTbl->start);
sound_bank_header sound_banks = read_sound_bank(data, secCtl->start);
sound_count = 0;
for (i = 0; i < sound_banks.bank_count; i++) {
for (j = 0; j < sound_banks.banks[i].instrument_count; j++) {
if(sound_banks.banks[i].sounds[j].wav_prev != NULL) {
sprintf(sfx_file, "Bank%uSound%uPrev", i, j);
extract_raw_sound(sound_dir, sfx_file, sound_banks.banks[i].sounds[j].wav_prev, sound_banks.banks[i].sounds[j].key_base_prev, sound_data.data[i], 16000);
sound_count++;
}
if(sound_banks.banks[i].sounds[j].wav != NULL) {
sprintf(sfx_file, "Bank%uSound%u", i, j);
extract_raw_sound(sound_dir, sfx_file, sound_banks.banks[i].sounds[j].wav, sound_banks.banks[i].sounds[j].key_base, sound_data.data[i], 16000);
sound_count++;
}
if(sound_banks.banks[i].sounds[j].wav_sec != NULL) {
sprintf(sfx_file, "Bank%uSound%uSec", i, j);
extract_raw_sound(sound_dir, sfx_file, sound_banks.banks[i].sounds[j].wav_sec, sound_banks.banks[i].sounds[j].key_base_sec, sound_data.data[i], 16000);
sound_count++;
}
}
// Todo: add percussion export here
}
// free used memory
if (sound_banks.bank_count > 0) {
free(sound_banks.banks);
}
INFO("Successfully exported sounds:\n");
INFO(" # of banks: %u\n", sound_banks.bank_count);
INFO(" # of sounds: %u\n", sound_count);
}
static void generate_geo_macros(arg_config *args)
{
char macrofilename[FILENAME_MAX];
FILE *fmacro;
sprintf(macrofilename, "%s/geo_commands.inc", args->output_dir);
fmacro = fopen(macrofilename, "w");
if (fmacro == NULL) {
ERROR("Error opening %s\n", macrofilename);
exit(3);
}
fprintf(fmacro,
"# geo layout macros\n"
"\n"
"# 0x00: Branch and store return address\n"
"# 0x04: scriptTarget, segment address of geo layout\n"
".macro geo_branch_and_link scriptTarget\n"
" .byte 0x00, 0x00, 0x00, 0x00\n"
" .word \\scriptTarget\n"
".endm\n"
"\n"
"# 0x01: Terminate geo layout\n"
"# 0x01-0x03: unused\n"
".macro geo_end\n"
" .byte 0x01, 0x00, 0x00, 0x00\n"
".endm\n"
"\n"
"# 0x02: Branch\n"
"# 0x01: if 1, store next geo layout address on stack\n"
"# 0x02-0x03: unused\n"
"# 0x04: scriptTarget, segment address of geo layout\n"
".macro geo_branch type, scriptTarget\n"
" .byte 0x02, \\type, 0x00, 0x00\n"
" .word \\scriptTarget\n"
".endm\n"
"\n"
"# 0x03: Return from branch\n"
"# 0x01-0x03: unused\n"
".macro geo_return\n"
" .byte 0x03, 0x00, 0x00, 0x00\n"
".endm\n"
"\n"
"# 0x04: Open node\n"
"# 0x01-0x03: unused\n"
".macro geo_open_node\n"
" .byte 0x04, 0x00, 0x00, 0x00\n"
".endm\n"
"\n"
"# 0x05: Close node\n"
"# 0x01-0x03: unused\n"
".macro geo_close_node\n"
" .byte 0x05, 0x00, 0x00, 0x00\n"
".endm\n"
"\n"
"# 0x06: TODO\n"
"# 0x01: unused\n"
"# 0x02: s16, index of some array\n"
".macro geo_todo_06 param\n"
" .byte 0x06, 0x00\n"
" .hword \\param\n"
".endm\n"
"\n"
"# 0x07: Update current scene graph node flags\n"
"# 0x01: u8 operation (0 = reset, 1 = set, 2 = clear)\n"
"# 0x02: s16 bits\n"
".macro geo_update_node_flags operation, flagBits\n"
" .byte 0x07, \\operation\n"
" .hword \\flagBits\n"
".endm\n"
"\n"
"# 0x08: Create screen area scene graph node\n"
"# 0x01: unused\n"
"# 0x02: s16 num entries (+2) to allocate\n"
"# 0x04: s16 x\n"
"# 0x06: s16 y\n"
"# 0x08: s16 width\n"
"# 0x0A: s16 height\n"
".macro geo_node_screen_area numEntries, x, y, width, height\n"
" .byte 0x08, 0x00\n"
" .hword \\numEntries\n"
" .hword \\x, \\y, \\width, \\height\n"
".endm\n"
"\n"
"# 0x09: TODO Create ? scene graph node\n"
"# 0x02: s16 ?\n"
".macro geo_todo_09 param\n"
" .byte 0x09, 0x00\n"
" .hword \\param\n"
".endm\n"
"\n"
"# 0x0A: Create camera frustum scene graph node\n"
"# 0x01: u8 if nonzero, enable function field\n"
"# 0x02: s16 field of view\n"
"# 0x04: s16 near\n"
"# 0x06: s16 far\n"
"# 0x08: [GraphNodeFunc function]\n"
".macro geo_camera_frustum fov, near, far, function=0\n"
" .byte 0x0A\n"
" .if (\\function != 0)\n"
" .byte 0x01\n"
" .else\n"
" .byte 0x00\n"
" .endif\n"
" .hword \\fov, \\near, \\far\n"
" .if (\\function != 0)\n"
" .word \\function\n"
" .endif\n"
".endm\n"
"\n"
"# 0x0B: Create a root scene graph node\n"
"# 0x01-0x03: unused\n"
".macro geo_node_start\n"
" .byte 0x0B, 0x00, 0x00, 0x00\n"
".endm\n"
"\n"
"# 0x0C: Create zbuffer-toggling scene graph node\n"
"# 0x01: u8 enableZBuffer (1 = on, 0 = off)\n"
"# 0x02-0x03: unused\n"
".macro geo_zbuffer enable\n"
" .byte 0x0C, \\enable, 0x00, 0x00\n"
".endm\n"
"\n"
"# 0x0D: Create render range scene graph node\n"
"# 0x01-0x03: unused\n"
"# 0x04: s16 minDistance\n"
"# 0x06: s16 maxDistance\n"
".macro geo_render_range minDistance, maxDistance\n"
" .byte 0x0D, 0x00, 0x00, 0x00\n"
" .hword \\minDistance, \\maxDistance\n"
".endm\n"
"\n"
"# 0x0E: Create switch-case scene graph node\n"
"# 0x01: unused\n"
"# 0x02: s16 numCases\n"
"# 0x04: GraphNodeFunc caseSelectorFunc\n"
".macro geo_switch_case count, function\n"
" .byte 0x0E, 0x00\n"
" .hword \\count\n"
" .word \\function\n"
".endm\n"
"\n"
"# 0x0F: TODO Create ? scene graph node\n"
"# 0x01: unused\n"
"# 0x02: s16 ?\n"
"# 0x04: s16 unkX\n"
"# 0x06: s16 unkY\n"
"# 0x08: s16 unkZ\n"
"# 0x0A: s16 unkX_2\n"
"# 0x0C: s16 unkY_2\n"
"# 0x0E: s16 unkZ_2\n"
"# 0x10: GraphNodeFunc function\n"
".macro geo_todo_0F unknown, x1, y1, z1, x2, y2, z2, function\n"
" .byte 0x0F, 0x00\n"
" .hword \\unknown, \\x1, \\y1, \\z1, \\x2, \\y2, \\z2\n"
" .word \\function\n"
".endm\n"
"\n"
"# 0x10: Create translation & rotation scene graph node with optional display list\n"
"# Four different versions of 0x10\n"
"# cmd+0x01: u8 params\n"
"# 0b1000_0000: if set, enable displayList field and drawingLayer\n"
"# 0b0111_0000: fieldLayout (determines how rest of data is formatted\n"
"# 0b0000_1111: drawingLayer\n"
"#\n"
"# fieldLayout = 0: Translate & Rotate\n"
"# 0x04: s16 xTranslation\n"
"# 0x06: s16 xTranslation\n"
"# 0x08: s16 xTranslation\n"
"# 0x0A: s16 xRotation\n"
"# 0x0C: s16 xRotation\n"
"# 0x0E: s16 xRotation\n"
"# 0x10: [u32 displayList: if MSbit of params set, display list segmented address]\n"
".macro geo_translate_rotate layer, tx, ty, tz, rx, ry, rz, displayList=0\n"
" .byte 0x10\n"
" .if (\\displayList != 0)\n"
" .byte 0x00 | \\layer | 0x80\n"
" .else\n"
" .byte 0x00 | \\layer\n"
" .endif\n"
" .hword 0x0000\n"
" .hword \\tx, \\ty, \\tz\n"
" .hword \\rx, \\ry, \\rz\n"
" .if (\\displayList != 0)\n"
" .word \\displayList\n"
" .endif\n"
".endm\n"
"\n"
"# fieldLayout = 1: Translate\n"
"# 0x02: s16 xTranslation\n"
"# 0x04: s16 yTranslation\n"
"# 0x06: s16 zTranslation\n"
"# 0x08: [u32 displayList: if MSbit of params set, display list segmented address]\n"
".macro geo_translate layer, tx, ty, tz, displayList=0\n"
" .byte 0x10\n"
" .if (\\displayList != 0)\n"
" .byte 0x10 | \\layer | 0x80\n"
" .else\n"
" .byte 0x10 | \\layer\n"
" .endif\n"
" .hword \\tx, \\ty, \\tz\n"
" .if (\\displayList != 0)\n"
" .word \\displayList\n"
" .endif\n"
".endm\n"
"\n"
"# fieldLayout = 2: Rotate\n"
"# 0x02: s16 xRotation\n"
"# 0x04: s16 yRotation\n"
"# 0x06: s16 zRotation\n"
"# 0x08: [u32 displayList: if MSbit of params set, display list segmented address]\n"
".macro geo_rotate layer, rx, ry, rz, displayList=0\n"
" .byte 0x10\n"
" .if (\\displayList != 0)\n"
" .byte 0x20 | \\layer | 0x80\n"
" .else\n"
" .byte 0x20 | \\layer\n"
" .endif\n"
" .hword \\rx, \\ry, \\rz\n"
" .if (\\displayList != 0)\n"
" .word \\displayList\n"
" .endif\n"
".endm\n"
"\n"
"# fieldLayout = 3: Rotate Y\n"
"# 0x02: s16 yRotation\n"
"# 0x04: [u32 displayList: if MSbit of params set, display list segmented address]\n"
".macro geo_rotate_y layer, ry, displayList=0\n"
" .byte 0x10\n"
" .if (\\displayList != 0)\n"
" .byte 0x30 | \\layer | 0x80\n"
" .else\n"
" .byte 0x30 | \\layer\n"
" .endif\n"
" .hword \\ry\n"
" .if (\\displayList != 0)\n"
" .word \\displayList\n"
" .endif\n"
".endm\n"
"\n"
"# 0x11: TODO Create ? scene graph node with optional display list\n"
"# 0x01: u8 params\n"
"# 0b1000_0000: if set, enable displayList field and drawingLayer\n"
"# 0b0000_1111: drawingLayer\n"
"# 0x02: s16 unkX\n"
"# 0x04: s16 unkY\n"
"# 0x06: s16 unkZ\n"
"# 0x08: [u32 displayList: if MSbit of params set, display list segmented address]\n"
".macro geo_todo_11 layer, ux, uy, uz, displayList=0\n"
" .byte 0x11\n"
" .if (\\displayList != 0)\n"
" .byte 0x80 | \\layer\n"
" .else\n"
" .byte 0x00\n"
" .endif\n"
" .hword \\ux, \\uy, \\uz\n"
" .if (\\displayList != 0)\n"
" .word \\displayList\n"
" .endif\n"
".endm\n"
"\n"
"# 0x12: TODO Create ? scene graph node\n"
"# 0x01: u8 params\n"
"# 0b1000_0000: if set, enable displayList field and drawingLayer\n"
"# 0b0000_1111: drawingLayer\n"
"# 0x02: s16 unkX\n"
"# 0x04: s16 unkY\n"
"# 0x06: s16 unkZ\n"
"# 0x08: [u32 displayList: if MSbit of params set, display list segmented address]\n"
".macro geo_todo_12 layer, ux, uy, uz, displayList=0\n"
" .byte 0x12\n"
" .if (\\displayList != 0)\n"
" .byte 0x80 | \\layer\n"
" .else\n"
" .byte 0x00\n"
" .endif\n"
" .hword \\ux, \\uy, \\uz\n"
" .if (\\displayList != 0)\n"
" .word \\displayList\n"
" .endif\n"
".endm\n"
"\n"
"# 0x13: Create display list scene graph node with translation\n"
"# 0x01: u8 drawingLayer\n"
"# 0x02: s16 xTranslation\n"
"# 0x04: s16 yTranslation\n"
"# 0x06: s16 zTranslation\n"
"# 0x08: u32 displayList: dislay list segmented address\n"
".macro geo_dl_translated layer, x, y, z, displayList=0\n"
" .byte 0x13, \\layer\n"
" .hword \\x, \\y, \\z\n"
" .word \\displayList\n"
".endm\n"
"\n"
"# 0x14: Create billboarding node with optional display list\n"
"# 0x01: u8 params\n"
"# 0b1000_0000: if set, enable displayList field and drawingLayer\n"
"# 0b0000_1111: drawingLayer\n"
"# 0x02: s16 xTranslation\n"
"# 0x04: s16 yTranslation\n"
"# 0x06: s16 zTranslation\n"
"# 0x08: [u32 displayList: if MSbit of params is set, display list segmented address]\n"
".macro geo_billboard layer=0, tx=0, ty=0, tz=0, displayList=0\n"
" .byte 0x14\n"
" .if (\\displayList != 0)\n"
" .byte 0x80 | \\layer\n"
" .else\n"
" .byte 0x00\n"
" .endif\n"
" .hword \\tx, \\ty, \\tz\n"
" .if (\\displayList != 0)\n"
" .word \\displayList\n"
" .endif\n"
".endm\n"
"\n"
"# 0x15: Create plain display list scene graph node\n"
"# 0x01: u8 drawingLayer\n"
"# 0x02=0x03: unused\n"
"# 0x04: u32 displayList: display list segmented address\n"
".macro geo_display_list layer, displayList\n"
" .byte 0x15, \\layer, 0x00, 0x00\n"
" .word \\displayList\n"
".endm\n"
"\n"
"# 0x16: Create shadow scene graph node\n"
"# 0x01: unused\n"
"# 0x02: s16 shadowType (cast to u8)\n"
"# 0x04: s16 shadowSolidity (cast to u8)\n"
"# 0x06: s16 shadowScale\n"
".set SHADOW_CIRCLE_UNK0, 0x00\n"
".set SHADOW_CIRCLE_UNK1, 0x01\n"
".set SHADOW_CIRCLE_UNK2, 0x02 # unused shadow type\n"
".set SHADOW_SQUARE_PERMANENT, 0x0A # square shadow that never disappears\n"
".set SHADOW_SQUARE_SCALABLE, 0x0B # square shadow, shrinks with distance\n"
".set SHADOW_SQUARE_TOGGLABLE, 0x0C # square shadow, disappears with distance\n"
".set SHADOW_CIRCLE_PLAYER, 0x63 # player (Mario) shadow\n"
".set SHADOW_RECTANGLE_HARDCODED_OFFSET, 0x32 # offset of hard-coded shadows\n"
".macro geo_shadow type, solidity, scale\n"
" .byte 0x16, 0x00\n"
" .hword \\type, \\solidity, \\scale\n"
".endm\n"
"\n"
"# 0x17: TODO Create ? scene graph node\n"
"# 0x01-0x03: unused\n"
".macro geo_todo_17\n"
" .byte 0x17, 0x00, 0x00, 0x00\n"
".endm\n"
"\n"
"# 0x18: Create ? scene graph node\n"
"# 0x01: unused\n"
"# 0x02: s16 parameter\n"
"# 0x04: GraphNodeFunc function\n"
".macro geo_asm param, function\n"
" .byte 0x18, 0x00\n"
" .hword \\param\n"
" .word \\function\n"
".endm\n"
"\n"
"# 0x19: Create background scene graph node\n"
"# 0x02: s16 background: background ID, or RGBA5551 color if backgroundFunc is null\n"
"# 0x04: GraphNodeFunc backgroundFunc\n"
".macro geo_background param, function=0\n"
" .byte 0x19, 0x00\n"
" .hword \\param\n"
" .word \\function\n"
".endm\n"
"\n"
"# 0x1A: No operation\n"
".macro geo_nop_1A\n"
" .byte 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n"
".endm\n"
"\n"
"# 0x1B: TODO Create ? scene graph node\n"
"# 0x02: s16 index of array\n"
".macro geo_todo_1B param\n"
" .byte 0x1B, 0x00\n"
" .hword \\param\n"
".endm\n"
"\n"
"# 0x1C: TODO Create ? scene graph node\n"
"# 0x01: u8 unk01\n"
"# 0x02: s16 unkX\n"
"# 0x04: s16 unkY\n"
"# 0x06: s16 unkZ\n"
"# 0x08: GraphNodeFunc nodeFunc\n"
".macro geo_todo_1C param, ux, uy, uz, nodeFunc\n"
" .byte 0x1C, \\param\n"
" .hword \\ux, \\uy, \\uz\n"
" .word \\nodeFunc\n"
".endm\n"
"\n"
"# 0x1D: Create scale scene graph node with optional display list\n"
"# 0x01: u8 params\n"
"# 0b1000_0000: if set, enable displayList field and drawingLayer\n"
"# 0b0000_1111: drawingLayer\n"
"# 0x02-0x03: unused\n"
"# 0x04: u32 scale (0x10000 = 1.0)\n"
"# 0x08: [u32 displayList: if MSbit of params is set, display list segment address]\n"
".macro geo_scale layer, scale, displayList=0\n"
" .byte 0x1D\n"
" .if (\\displayList != 0)\n"
" .byte 0x80 | \\layer\n"
" .else\n"
" .byte 0x00\n"
" .endif\n"
" .byte 0x00, 0x00\n"
" .word \\scale\n"
" .if (\\displayList != 0)\n"
" .word \\displayList\n"
" .endif\n"
".endm\n"
"\n"
"# 0x1E: No operation\n"
".macro geo_nop_1E\n"
" .byte 0x1E, 0x00, 0x00, 0x00\n"
" .byte 0x00, 0x00, 0x00, 0x00\n"
".endm\n"
"\n"
"# 0x1F: No operation\n"
".macro geo_nop_1F\n"
" .byte 0x1F, 0x00, 0x00, 0x00\n"
" .byte 0x00, 0x00, 0x00, 0x00\n"
" .byte 0x00, 0x00, 0x00, 0x00\n"
" .byte 0x00, 0x00, 0x00, 0x00\n"
".endm\n"
"\n"
"# 0x20: Create render distance scene graph node (unconfirmed?)\n"
"# 0x01: unused\n"
"# 0x02: s16 renderDistance?\n"
".macro geo_start_distance renderDistance\n"
" .byte 0x20, 0x00\n"
" .hword \\renderDistance\n"
".endm\n"
"\n"
);
}
static void generate_ld_script(arg_config *args, rom_config *config)
{
char ldfilename[FILENAME_MAX];
FILE *fld;
sprintf(ldfilename, "%s/%s.ld", args->output_dir, config->basename);
fld = fopen(ldfilename, "w");
if (fld == NULL) {
ERROR("Error opening %s\n", ldfilename);
exit(3);
}
fprintf(fld,
"/* %s linker script\n"
" * generated by n64split v%s - N64 ROM splitter */\n"
"\n"
"OUTPUT_ARCH (mips)\n"
"\n"
"SECTIONS\n"
"{\n"
" /* header and boot */\n"
" .header 0x0 : AT(0x0) {\n"
" * (.header);\n"
" * (.boot);\n"
" }\n"
"\n"
" /* load MIO0 and level data at 0x800000 */\n"
" .rodata 0x800000 : {\n"
" FILL (0x01) /* fill unused with 0x01 */\n"
" * (.mio0);\n"
" * (.rodata);\n"
" * (.data);\n"
" * (.MIPS.abiflags);\n"
" . = ALIGN(0x10);\n"
" }\n"
"\n"
" /* use segmented addressing for behaviors */\n"
" .behavior 0x13000000 : AT( LOADADDR(.rodata) + SIZEOF(.rodata) ) {\n"
" FILL (0x01) /* fill unused with 0x01 */\n"
" * (.behavior);\n"
" behavior_length = . - 0x13000000;\n"
" /* default 4MB data (12MB ROM) */\n"
" . = 0x400000 - SIZEOF(.rodata);\n"
" }\n"
" __load_behavior_data = LOADADDR(.behavior);\n"
" __load_behavior_data_end = LOADADDR(.behavior) + behavior_length;\n"
"\n", config->name, N64SPLIT_VERSION);
int ovlNum = 0;
for (int i = 0; i < config->section_count; i++) {
split_section *s = &config->sections[i];
if (s->type == TYPE_ASM) {
unsigned int rom_start = s->start;
unsigned int rom_end = s->end;
unsigned int ram_start = s->vaddr;
unsigned int length = rom_end - rom_start;
fprintf(fld,
" /* 0x%08X %06X-%06X [%X] */\n"
" .text%08X_ovl%d 0x%08X : AT(0x%06X) {\n"
" * (.text%08X_ovl%d);\n"
" }\n"
"\n", ram_start, rom_start, rom_end, length,
ram_start, ovlNum - 2, ram_start, rom_start, ram_start, ovlNum - 2);
}
ovlNum++;
}
fprintf(fld, "}\n");
fclose(fld);
}
typedef struct
{
unsigned type;
char *name;
} terrain_t;
static const terrain_t terrain_table[] =
{
{0x0000, "normal"},
{0x0001, "lethal_lava"},
{0x0005, "hang"},
{0x000A, "deathfloor"},
{0x000E, "water_currents"},
{0x0012, "void"},
{0x0013, "very_slippery"},
{0x0014, "slippery"},
{0x0015, "climbable"},
{0x0028, "wall"},
{0x0029, "grass"},
{0x002A, "unclimbable"},
{0x002C, "windy"},
{0x002E, "icy"},
{0x0030, "flat"},
{0x0036, "snowy"},
{0x0037, "snowy2"},
{0x0076, "fence"},
{0x007B, "vanishing_wall"},
{0x00FD, "pool_warp"},
};
char *terrain2str(unsigned type)
{
unsigned i;
static char retval[16];
if (0x1B <= type && type <= 0x1E) {
sprintf(retval, "switch%02X", type);
return retval;
} else if (0xA6 <= type && type <= 0xCF) {
sprintf(retval, "paintingf%02X", type);
return retval;
} else if (0xD3 <= type && type <= 0xF8) {
sprintf(retval, "paintingb%02X", type);
return retval;
}
for (i = 0; i < DIM(terrain_table); i++) {
if (terrain_table[i].type == type) {
return terrain_table[i].name;
}
}
sprintf(retval, "%02X", type);
return retval;
}
int collision2obj(char *binfilename, unsigned int binoffset, char *objfilename, char *name, float scale)
{
unsigned char *data;
FILE *fobj;
long in_size;
unsigned vcount;
unsigned tcount;
unsigned cur_tcount;
unsigned terrain;
unsigned v_per_t;
unsigned processing;
unsigned offset;
unsigned i;
unsigned vidx[3];
short x, y, z;
int ret_len = 0;
fobj = fopen(objfilename, "w");
if (fobj == NULL) {
ERROR("Error opening \"%s\" for writing\n", objfilename);
exit(EXIT_FAILURE);
}
in_size = read_file(binfilename, &data);
if (in_size <= 0) {
ERROR("Error reading input file \"%s\"\n", binfilename);
exit(EXIT_FAILURE);
}
offset = binoffset;
if (data[offset] != 0x00 || data[offset+1] != 0x40) {
ERROR("Unknown collision data %s.%X: %08X\n", name, offset, read_u32_be(data));
return 0;
}
fprintf(fobj, "# collision model generated from n64split v%s\n"
"# level %s %05X\n"
"\n"
"mtllib collision.mtl\n\n", N64SPLIT_VERSION, name, binoffset);
vcount = read_u16_be(&data[offset+2]);
INFO("Loading %u vertices\n", vcount);
offset += 4;
for (i = 0; i < vcount; i++) {
x = read_s16_be(&data[offset + i*6]);
y = read_s16_be(&data[offset + i*6+2]);
z = read_s16_be(&data[offset + i*6+4]);
fprintf(fobj, "v %f %f %f\n", (float)x/scale, (float)y/scale, (float)z/scale);
}
offset += vcount*6;
tcount = 0;
processing = 1;
while (processing) {
terrain = read_u16_be(&data[offset]);
cur_tcount = read_u16_be(&data[offset+2]);
// 0041 indicates the end, followed by 0042 or 0043
if (terrain == 0x41 || terrain > 0xFF) {
processing = 0;
break;
}
switch (terrain) {
case 0x0E:
case 0x2C:
case 0x24:
case 0x25:
case 0x27:
case 0x2D:
v_per_t = 4;
break;
default:
v_per_t = 3;
break;
}
fprintf(fobj, "\ng %s_%05X_%s\n", name, binoffset, terrain2str(terrain));
fprintf(fobj, "usemtl %s\n", terrain2str(terrain));
INFO("Loading %u triangles of terrain %02X\n", cur_tcount, terrain);
offset += 4;
for (i = 0; i < cur_tcount; i++) {
vidx[0] = read_u16_be(&data[offset + i*v_per_t*2]);
vidx[1] = read_u16_be(&data[offset + i*v_per_t*2+2]);
vidx[2] = read_u16_be(&data[offset + i*v_per_t*2+4]);
fprintf(fobj, "f %d %d %d\n", vidx[0]+1, vidx[1]+1, vidx[2]+1);
}
tcount += cur_tcount;
offset += cur_tcount*v_per_t*2;
}
fclose(fobj);
free(data);
ret_len = offset - binoffset;
return ret_len;
}
static void split_file(unsigned char *data, unsigned int length, arg_config *args, rom_config *config, disasm_state *state)
{
#define BIN_SUBDIR "bin"
#define MIO0_SUBDIR "bin"
#define TEXTURE_SUBDIR "textures"
#define GEO_SUBDIR "geo"
#define LEVEL_SUBDIR "levels"
#define MODEL_SUBDIR "models"
#define BEHAVIOR_SUBDIR "."
char makefile_name[FILENAME_MAX];
char bin_dir[FILENAME_MAX];
char mio0_dir[FILENAME_MAX];
char texture_dir[FILENAME_MAX];
char geo_dir[FILENAME_MAX];
char level_dir[FILENAME_MAX];
char model_dir[FILENAME_MAX];
char behavior_dir[FILENAME_MAX];
char asmfilename[FILENAME_MAX];
char outfilename[FILENAME_MAX];
char outfilepath[FILENAME_MAX];
char mio0filename[FILENAME_MAX];
char start_label[256];
strbuf makeheader_mio0;
strbuf makeheader_level;
strbuf makeheader_music;
FILE *fasm;
FILE *fmake;
int s;
int i;
unsigned int a;
unsigned int w, h;
unsigned int prev_end = 0;
unsigned int ptr;
split_section *sections = config->sections;
// create directories
sprintf(makefile_name, "%s/Makefile.split", args->output_dir);
sprintf(bin_dir, "%s/%s", args->output_dir, BIN_SUBDIR);
sprintf(mio0_dir, "%s/%s", args->output_dir, MIO0_SUBDIR);
sprintf(texture_dir, "%s/%s", args->output_dir, TEXTURE_SUBDIR);
sprintf(geo_dir, "%s/%s", args->output_dir, GEO_SUBDIR);
sprintf(level_dir, "%s/%s", args->output_dir, LEVEL_SUBDIR);
sprintf(model_dir, "%s/%s", args->output_dir, MODEL_SUBDIR);
sprintf(behavior_dir, "%s/%s", args->output_dir, BEHAVIOR_SUBDIR);
make_dir(args->output_dir);
make_dir(bin_dir);
make_dir(mio0_dir);
make_dir(texture_dir);
make_dir(geo_dir);
make_dir(level_dir);
make_dir(model_dir);
make_dir(behavior_dir);
// open main assembly file and write header
sprintf(asmfilename, "%s/%s.s", args->output_dir, config->basename);
fasm = fopen(asmfilename, "w");
if (fasm == NULL) {
ERROR("Error opening %s\n", asmfilename);
exit(3);
}
fprintf(fasm, asm_header, config->name, N64SPLIT_VERSION);
// generate globals include file
generate_globals(args, config);
// generate common macros
generate_macros(args);
strbuf_alloc(&makeheader_music, 256);
strbuf_sprintf(&makeheader_music, "MUSIC_FILES =");
//Need both sfx sections to parse
split_section *sfxSec = NULL;
int currOvlNum = 0;
for (s = 0; s < config->section_count; s++) {
split_section *sec = §ions[s];
// error checking
if (sec->start >= length || sec->end > length) {
ERROR("Error: section past end: 0x%X, 0x%X (%s) > 0x%X\n",
sec->start, sec->end, sec->label ? sec->label : "", length);
exit(4);
}
// fill gaps between regions
if (sec->start != prev_end) {
int gap_len = sec->start - prev_end;
INFO("Filling gap before region %d (%d bytes)\n", s, gap_len);
fprintf(fasm, "# Unknown region %06X-%06X [%X]\n", prev_end, sec->start, gap_len);
// for small gaps, just output bytes
if (gap_len <= 0x80) {
unsigned int group_offset = prev_end;
while (gap_len > 0) {
int group_len = MIN(gap_len, 0x10);
fprintf(fasm, ".byte ");
fprint_hex_source(fasm, &data[group_offset], group_len);
fprintf(fasm, "\n");
gap_len -= group_len;
group_offset += group_len;
}
} else {
sprintf(outfilename, "%s/%s.%06X.bin", BIN_SUBDIR, config->basename, prev_end);
sprintf(outfilepath, "%s/%s", args->output_dir, outfilename);
write_file(outfilepath, &data[prev_end], gap_len);
fprintf(fasm, ".incbin \"%s\"\n", outfilename);
}
fprintf(fasm, "\n");
}
switch (sec->type)
{
case TYPE_HEADER:
INFO("Section header: %X-%X\n", sec->start, sec->end);
fprintf(fasm, ".section .header, \"a\"\n"
".byte 0x%02X", data[sec->start]);
for (i = 1; i < 4; i++) {
fprintf(fasm, ", 0x%02X", data[sec->start + i]);
}
fprintf(fasm, " # PI BSD Domain 1 register\n");
fprintf(fasm, ".word 0x%08X # clock rate setting\n", read_u32_be(&data[sec->start + 0x4]));
fprintf(fasm, ".word 0x%08X # entry point\n", read_u32_be(&data[sec->start + 0x8]));
fprintf(fasm, ".word 0x%08X # release\n", read_u32_be(&data[sec->start + 0xc]));
fprintf(fasm, ".word 0x%08X # checksum1\n", read_u32_be(&data[sec->start + 0x10]));
fprintf(fasm, ".word 0x%08X # checksum2\n", read_u32_be(&data[sec->start + 0x14]));
fprintf(fasm, ".word 0x%08X # unknown\n", read_u32_be(&data[sec->start + 0x18]));
fprintf(fasm, ".word 0x%08X # unknown\n", read_u32_be(&data[sec->start + 0x1C]));
fprintf(fasm, ".ascii \"");
fwrite(&data[sec->start + 0x20], 1, 20, fasm);
fprintf(fasm, "\" # ROM name: 20 bytes\n");
fprintf(fasm, ".word 0x%08X # unknown\n", read_u32_be(&data[sec->start + 0x34]));
fprintf(fasm, ".word 0x%08X # cartridge\n", read_u32_be(&data[sec->start + 0x38]));
fprintf(fasm, ".ascii \"");
fwrite(&data[sec->start + 0x3C], 1, 2, fasm);
fprintf(fasm, "\" # cartridge ID\n");
fprintf(fasm, ".ascii \"");
fwrite(&data[sec->start + 0x3E], 1, 1, fasm);
fprintf(fasm, "\" # country\n");
fprintf(fasm, ".byte 0x%02X # version\n\n", data[sec->start + 0x3F]);
break;
case TYPE_BIN:
if (sec->label == NULL || sec->label[0] == '\0') {
sprintf(outfilename, "%s/%s.%06X.bin", BIN_SUBDIR, config->basename, sec->start);
} else {
sprintf(outfilename, "%s/%s.%06X.%s.bin", BIN_SUBDIR, config->basename, sec->start, sec->label);
}
sprintf(outfilepath, "%s/%s", args->output_dir, outfilename);
write_file(outfilepath, &data[sec->start], sec->end - sec->start);
if (sec->label == NULL || sec->label[0] == '\0') {
sprintf(start_label, "L%06X", sec->start);
} else {
strcpy(start_label, sec->label);
}
fprintf(fasm, "%s:\n", start_label);
fprintf(fasm, ".incbin \"%s\"\n", outfilename);
fprintf(fasm, "%s_end:\n", start_label);
break;
case TYPE_BLAST:
case TYPE_MIO0:
case TYPE_GZIP:
case TYPE_SM64_GEO:
// fill previous geometry and MIO0 blocks
fprintf(fasm, ".space 0x%05x, 0x01 # %s\n", sec->end - sec->start, sec->label);
break;
case TYPE_PTR:
INFO("Section ptr: %X-%X\n", sec->start, sec->end);
if (sec->label == NULL || sec->label[0] == '\0') {
sprintf(start_label, "Ptr%06X", sec->start);
} else {
strcpy(start_label, sec->label);
}
fprintf(fasm, "%s:\n", start_label);
for (a = sec->start; a < sec->end; a += 4) {
ptr = read_u32_be(&data[a]);
disasm_label_lookup(state, ptr, start_label);
fprintf(fasm, ".word %s", start_label);
if (sec->child_count > 0) {
for (i = 1; i < sec->child_count; i++) {
a += 4;
ptr = read_u32_be(&data[a]);
disasm_label_lookup(state, ptr, start_label);
fprintf(fasm, ", %s", start_label);
}
}
fprintf(fasm, "\n");
}
fprintf(fasm, "\n");
break;
case TYPE_ASM:
INFO("Section asm: %X-%X\n", sec->start, sec->end);
fprintf(fasm, "\n.section .text%08X_ovl%d, \"ax\"\n\n", sec->vaddr,currOvlNum);
mipsdisasm_pass2(fasm, state, sec->start, currOvlNum);
currOvlNum++;
break;
case TYPE_SM64_LEVEL:
// relocate level scripts to .mio0 area
// TODO: these shouldn't need to be relocated if load offset can be computed
fprintf(fasm, ".space 0x%05x, 0x01 # %s\n", sec->end - sec->start, sec->label);
break;
case TYPE_SM64_BEHAVIOR:
// behaviors are done below
fprintf(fasm, ".space 0x%05x, 0x01 # %s\n", sec->end - sec->start, sec->label);
break;
case TYPE_M64:
parse_music_sequences(fasm, data, sec, args, &makeheader_music);
break;
case TYPE_SFX_CTL:
if (sfxSec == NULL)
sfxSec = sec;
else
parse_sound_banks(fasm, data, sec, sfxSec, args, &makeheader_music); //Fix header later
break;
case TYPE_SFX_TBL:
if (sfxSec == NULL)
sfxSec = sec;
else
parse_sound_banks(fasm, data, sfxSec, sec, args, &makeheader_music); //Fix header later
break;
case TYPE_INSTRUMENT_SET:
parse_instrument_set(fasm, data, sec);
break;
default:
ERROR("Don't know what to do with type %d\n", sec->type);
exit(1);
break;
}
prev_end = sec->end;
}
strbuf_alloc(&makeheader_mio0, 1024);
strbuf_sprintf(&makeheader_mio0, "MIO0_FILES =");
strbuf_alloc(&makeheader_level, 1024);
strbuf_sprintf(&makeheader_level, "LEVEL_FILES =");
fmake = fopen(makefile_name, "w");
fprintf(fmake, "TARGET = %s\n", config->basename);
fprintf(fmake, "LD_SCRIPT = $(TARGET).ld\n");
fprintf(fmake, "MIO0_DIR = %s\n", MIO0_SUBDIR);
fprintf(fmake, "TEXTURE_DIR = %s\n", TEXTURE_SUBDIR);
fprintf(fmake, "GEO_DIR = %s\n", GEO_SUBDIR);
fprintf(fmake, "LEVEL_DIR = %s\n\n", LEVEL_SUBDIR);
fprintf(fmake, "MUSIC_DIR = %s\n\n", MUSIC_SUBDIR);
fprintf(fasm, "\n.section .mio0\n");
for (s = 0; s < config->section_count; s++) {
split_section *sec = §ions[s];
switch (sec->type) {
case TYPE_SM64_GEO:
{
char geofilename[FILENAME_MAX];
FILE *fgeo;
if (sec->label == NULL || sec->label[0] == '\0') {
sprintf(geofilename, "%s.%06X.geo.s", config->basename, sec->start);
sprintf(start_label, "L%06X", sec->start);
} else {
sprintf(geofilename, "%s.geo.s", sec->label);
strcpy(start_label, sec->label);
}
sprintf(outfilename, "%s/%s", GEO_SUBDIR, geofilename);
sprintf(outfilepath, "%s/%s", args->output_dir, outfilename);
// decode and write level data out
fgeo = fopen(outfilepath, "w");
if (fgeo == NULL) {
perror(outfilepath);
exit(1);
}
write_geolayout(fgeo, &data[sec->start], 0, sec->end - sec->start, state);
fclose(fgeo);
fprintf(fasm, "\n.align 4, 0x01\n");
fprintf(fasm, ".global %s\n", start_label);
fprintf(fasm, "%s:\n", start_label);
fprintf(fasm, ".include \"%s\"\n", outfilename);
fprintf(fasm, "%s_end:\n", start_label);
// append to Makefile
strbuf_sprintf(&makeheader_level, " \\\n$(GEO_DIR)/%s", geofilename);
break;
}
case TYPE_BLAST:
case TYPE_GZIP:
case TYPE_MIO0:
{
char binfilename[FILENAME_MAX];
char extension[8] = {0};
unsigned char *lut;
char binasmfilename[FILENAME_MAX];
FILE *binasm;
unsigned char *binfilecontents = NULL;
long binfilelen = 0;
if (sec->label == NULL || sec->label[0] == '\0') {
sprintf(start_label, "L%06X", sec->start);
} else {
strcpy(start_label, sec->label);
}
sprintf(binfilename, "%s.s", start_label);
sprintf(binasmfilename, "%s/%s", bin_dir, binfilename);
// decode and write
binasm = fopen(binasmfilename, "w");
if (binasm == NULL) {
perror(binasmfilename);
exit(1);
}
fprintf(binasm, "# generated by n64split\n.section .rodata\n\n.include \"%s\"\n", MACROS_FILE);
switch (sec->type) {
case TYPE_BLAST:
INFO("Section Blast: %d %s %X-%X\n", sec->subtype, sec->label, sec->start, sec->end);
sprintf(extension, "bc%d", sec->subtype);
break;
case TYPE_MIO0:
INFO("Section MIO0: %s %X-%X\n", sec->label, sec->start, sec->end);
strcpy(extension, "mio0");
break;
case TYPE_GZIP:
INFO("Section GZIP: %s %X-%X\n", sec->label, sec->start, sec->end);
strcpy(extension, "gz");
break;
default:
break;
}
sprintf(outfilename, "%s.%s", start_label, extension);
sprintf(binfilename, "%s/%s.bin", bin_dir, start_label);
sprintf(mio0filename, "%s/%s", mio0_dir, outfilename);
write_file(mio0filename, &data[sec->start], sec->end - sec->start);
fprintf(fasm, "\n.align 4, 0x01\n");
fprintf(fasm, ".global %s\n", start_label);
fprintf(fasm, "%s:\n", start_label);
fprintf(fasm, ".incbin \"%s/%s\"\n", MIO0_SUBDIR, outfilename);
fprintf(fasm, "%s_end:\n", start_label);
// append to Makefile
strbuf_sprintf(&makeheader_mio0, " \\\n$(MIO0_DIR)/%s", outfilename);
// TODO: use in-memory decompression?
// extract compressed data
switch (sec->type) {
case TYPE_BLAST:
// TODO: make this configurable?
switch (sec->subtype) {
case 4: lut = &data[0x047480]; break;
case 5: lut = &data[0x0998E0]; break; // TODO: fix this
default: lut = data; break;
}
blast_decode_file(mio0filename, sec->subtype, binfilename, lut);
break;
case TYPE_MIO0:
mio0_decode_file(mio0filename, 0, binfilename);
break;
case TYPE_GZIP:
gzip_decode_file(mio0filename, 0, binfilename);
break;
default:
break;
}
binfilelen = read_file(binfilename, &binfilecontents);
// extract texture data
if (sec->children) {
unsigned int offset = 0;
unsigned int next_offset = 0;
// TODO: add segment base to config file
const unsigned int segment_base = 0x07000000;
unsigned int seg_address = segment_base + offset;
fprintf(fmake, "$(MIO0_DIR)/%s.bin:", start_label);
INFO("Extracting textures from %s\n", start_label);
for (int t = 0; t < sec->child_count; t++) {
split_section *child = &sec->children[t];
texture *tex = &child->tex;
w = tex->width;
h = tex->height;
if (next_offset > child->start) {
ERROR("Error section overlap region %d (%X > %X)\n", t, next_offset, child->start);
exit(1);
}
if (next_offset != child->start) {
unsigned gap_len = child->start - next_offset;
INFO("Filling gap before region %d (%d bytes)\n", t, gap_len);
fprintf(binasm, "# Unknown region %06X-%06X [%X]\n", next_offset, child->start, gap_len);
while (gap_len > 0) {
int group_len = MIN(gap_len, 0x10);
fprintf(binasm, ".byte ");
fprint_hex_source(binasm, &binfilecontents[next_offset], group_len);
fprintf(binasm, "\n");
gap_len -= group_len;
next_offset += group_len;
}
}
offset = tex->offset;
seg_address = segment_base + offset;
if (child->end) {
next_offset = child->end;
} else if (tex->format == TYPE_F3D_LIGHT) {
next_offset = child->start + 0x18;
} else { // assume texture
next_offset = child->start + w * h * tex->depth / 8;
}
fprintf(binasm, "\n");
switch (tex->format) {
case TYPE_TEX_IA:
{
sprintf(outfilename, "%s.%05X.ia%d", start_label, offset, tex->depth);
ia *img = raw2ia(&binfilecontents[offset], w, h, tex->depth);
if (img) {
sprintf(outfilepath, "%s/%s.png", texture_dir, outfilename);
ia2png(outfilepath, img, w, h);
free(img);
fprintf(fmake, " $(TEXTURE_DIR)/%s", outfilename);
}
if (args->raw_texture && binfilelen > 0) {
INFO("Saving raw texture for %s\n", start_label);
int len = w*h*tex->depth/8;
sprintf(outfilepath, "%s/%s", texture_dir, outfilename);
write_file(outfilepath, &binfilecontents[offset], len);
}
fprintf(binasm, "texture_%08X: # 0x%08X\n", seg_address, seg_address);
fprintf(binasm, ".incbin \"%s\"\n", outfilename);
break;
}
case TYPE_TEX_I:
{
sprintf(outfilename, "%s.%05X.i%d", start_label, offset, tex->depth);
ia *img = raw2i(&binfilecontents[offset], w, h, tex->depth);
if (img) {
sprintf(outfilepath, "%s/%s.png", texture_dir, outfilename);
ia2png(outfilepath, img, w, h);
free(img);
fprintf(fmake, " $(TEXTURE_DIR)/%s", outfilename);
}
if (args->raw_texture && binfilelen > 0) {
INFO("Saving raw texture for %s\n", start_label);
int len = w*h*tex->depth/8;
sprintf(outfilepath, "%s/%s", texture_dir, outfilename);
write_file(outfilepath, &binfilecontents[offset], len);
}
fprintf(binasm, "texture_%08X: # 0x%08X\n", seg_address, seg_address);
fprintf(binasm, ".incbin \"%s\"\n", outfilename);
break;
}
case TYPE_TEX_RGBA:
{
sprintf(outfilename, "%s.%05X.rgba%d", start_label, offset, tex->depth);
rgba *img = raw2rgba(&binfilecontents[offset], w, h, tex->depth);
if (img) {
sprintf(outfilepath, "%s/%s.png", texture_dir, outfilename);
rgba2png(outfilepath, img, w, h);
free(img);
fprintf(fmake, " $(TEXTURE_DIR)/%s", outfilename);
}
if (args->raw_texture && binfilelen > 0) {
INFO("Saving raw texture for %s\n", start_label);
int len = w*h*tex->depth/8;
sprintf(outfilepath, "%s/%s", texture_dir, outfilename);
write_file(outfilepath, &binfilecontents[offset], len);
}
fprintf(binasm, "texture_%08X: # 0x%08X\n", seg_address, seg_address);
fprintf(binasm, ".incbin \"%s\"\n", outfilename);
break;
}
case TYPE_TEX_SKYBOX:
{
// read in grid of MxN 32x32 tiles and save them as M*31xN*31 image
rgba *img;
unsigned int sky_offset = offset;
int m, n;
int tx, ty;
m = w/32;
n = h/32;
img = malloc(w*h*sizeof(rgba));
w -= m; // adjust for overlap
h -= n;
for (ty = 0; ty < n; ty++) {
for (tx = 0; tx < m; tx++) {
rgba *tile = raw2rgba(&binfilecontents[sky_offset], 32, 32, tex->depth);
int cx, cy;
for (cy = 0; cy < 31; cy++) {
for (cx = 0; cx < 31; cx++) {
int out_off = 31*w*ty + 31*tx + w*cy + cx;
int in_off = 32*cy+cx;
img[out_off] = tile[in_off];
}
}
free(tile);
sky_offset += 32*32*2;
}
}
sprintf(outfilename, "%s.%05X.skybox.png", start_label, offset);
sprintf(outfilepath, "%s/%s", texture_dir, outfilename);
rgba2png(outfilepath, img, w, h);
free(img);
fprintf(fmake, " $(TEXTURE_DIR)/%s", outfilename);
break;
}
case TYPE_F3D_DL:
{
int sec_len = child->end - child->start;
fprintf(binasm, "f3d_%08X: # 0x%08X\n", seg_address, seg_address);
for (int o = 0; o < sec_len; o += 8) {
unsigned char cmd = binfilecontents[offset + o];
unsigned int second = read_u32_be(&binfilecontents[offset + o + 4]);
fprintf(binasm, ".word 0x%08X, ", read_u32_be(&binfilecontents[offset + o]));
switch (cmd) {
case 0x03: // light
fprintf(binasm, "light_%08X\n", second);
break;
case 0x04: // vertex
fprintf(binasm, "vertex_%08X\n", second);
break;
case 0x06: // f3d
fprintf(binasm, "f3d_%08X\n", second);
break;
case 0xFD: // texture
fprintf(binasm, "texture_%08X\n", second);
break;
default:
fprintf(binasm, "0x%08X\n", second);
break;
}
}
break;
}
case TYPE_F3D_LIGHT:
{
fprintf(binasm, "light_%08X: # 0x%08X\n", seg_address, seg_address);
fprintf(binasm, ".byte ");
fprint_hex_source(binasm, &binfilecontents[offset], 8);
fprintf(binasm, "\n");
fprintf(binasm, "light_%08X: # 0x%08X\n", seg_address + 8, seg_address + 8);
fprintf(binasm, ".byte ");
fprint_hex_source(binasm, &binfilecontents[offset + 8], 8);
fprintf(binasm, "\n.byte ");
fprint_hex_source(binasm, &binfilecontents[offset + 16], 8);
fprintf(binasm, "\n");
break;
}
case TYPE_F3D_VERTEX:
{
int sec_len = child->end - child->start;
fprintf(binasm, "vertex_%08X: # 0x%08X\n", seg_address, seg_address);
for (int o = 0; o < sec_len; o += 16) {
fprintf(binasm, "vertex ");
for (int h = 0; h < 6; h++) {
// X, Y, Z, UNUSED, U, V
if (h != 3) {
fprintf(binasm, "%6d, ", read_s16_be(&binfilecontents[offset + o + h*2]));
}
}
// R, G, B, A
fprint_hex_source(binasm, &binfilecontents[offset + o + 12], 4);
fprintf(binasm, "\n");
}
break;
}
case TYPE_SM64_COLLISION:
{
int sec_len = 0;
sprintf(outfilename, "%s.%05X.collision", start_label, offset);
sprintf(outfilepath, "%s/%s.obj", model_dir, outfilename);
INFO("Generating collision model %s\n", outfilename);
sec_len = collision2obj(binfilename, offset, outfilepath, start_label, args->model_scale);
if (args->raw_texture && binfilelen > 0) {
INFO("Saving raw collision for %s\n", start_label);
sprintf(outfilepath, "%s/%s", texture_dir, outfilename);
write_file(outfilepath, &binfilecontents[offset], sec_len);
}
fprintf(binasm, "collision_%06X: # 0x%08X\n", seg_address, seg_address);
fprintf(binasm, ".incbin \"%s\"\n", outfilename);
break;
}
default:
ERROR("Don't know what to do with format %d\n", tex->format);
exit(1);
}
}
fprintf(fmake, "\n\t$(N64GRAPHICS) $@ $^\n\n");
}
// extract texture data
if (args->large_texture) {
INFO("Generating large texture for %s\n", start_label);
w = 32;
h = filesize(binfilename) / (w * (args->large_texture_depth / 8));
rgba *img = raw2rgba(binfilecontents, w, h, args->large_texture_depth);
if (img) {
sprintf(outfilename, "%s.ALL.png", start_label);
sprintf(outfilepath, "%s/%s", texture_dir, outfilename);
rgba2png(outfilepath, img, w, h);
free(img);
fprintf(fmake, " $(TEXTURE_DIR)/%s", outfilename);
img = NULL;
}
}
// TODO: write files in correct order to avoid this
// touch bin, then mio0 files so 'make' doesn't rebuild them right away
touch_file(binfilename);
touch_file(mio0filename);
fclose(binasm);
break;
}
case TYPE_SM64_LEVEL:
{
FILE *flevel;
char levelfilename[FILENAME_MAX];
if (sec->label == NULL || sec->label[0] == '\0') {
sprintf(start_label, "L%06X", sec->start);
} else {
strcpy(start_label, sec->label);
}
INFO("Section relocated level: %s %X-%X\n", start_label, sec->start, sec->end);
sprintf(levelfilename, "%s.s", start_label);
sprintf(outfilename, "%s/%s", LEVEL_SUBDIR, levelfilename);
sprintf(outfilepath, "%s/%s", args->output_dir, outfilename);
// decode and write level data out
flevel = fopen(outfilepath, "w");
if (flevel == NULL) {
perror(outfilepath);
exit(1);
}
fprintf(flevel, "# level script %s from %X-%X\n\n", start_label, sec->start, sec->end);
fprintf(flevel, ".section .mio0\n\n");
fprintf(flevel, ".global %s\n", start_label);
fprintf(flevel, ".align 4, 0x01\n");
fprintf(flevel, "%s:\n", start_label);
write_level(flevel, data, config, s, state);
fprintf(flevel, "%s_end:\n", start_label);
fclose(flevel);
if (sec->label == NULL || sec->label[0] == '\0') {
sprintf(start_label, "L%06X", sec->start);
} else {
strcpy(start_label, sec->label);
}
fprintf(fasm, "\n.include \"%s\"\n", outfilename);
// append to Makefile
strbuf_sprintf(&makeheader_level, " \\\n$(LEVEL_DIR)/%s", levelfilename);
break;
}
case TYPE_SM64_BEHAVIOR:
{
FILE *f_beh;
char beh_filename[FILENAME_MAX];
INFO("Section relocated behavior: %s %X-%X\n", sec->label, sec->start, sec->end);
if (sec->label == NULL || sec->label[0] == '\0') {
sprintf(beh_filename, "%06X.s", sec->start);
} else {
sprintf(beh_filename, "%s.s", sec->label);
}
sprintf(outfilename, "%s/%s", BEHAVIOR_SUBDIR, beh_filename);
sprintf(outfilepath, "%s/%s", args->output_dir, outfilename);
// decode and write level data out
f_beh = fopen(outfilepath, "w");
if (f_beh == NULL) {
perror(outfilepath);
exit(1);
}
write_behavior(f_beh, data, config, s, state);
fclose(f_beh);
fprintf(fasm, "\n.section .behavior, \"a\"\n");
fprintf(fasm, "\n.global %s\n", sec->label);
fprintf(fasm, ".global %s_end\n", sec->label);
fprintf(fasm, "%s:\n", sec->label);
fprintf(fasm, ".include \"%s\"\n", outfilename);
fprintf(fasm, "%s_end:\n", sec->label);
fprintf(fasm, "\n\n.section .mio0\n");
// append to Makefile
strbuf_sprintf(&makeheader_level, " \\\n%s/%s", BEHAVIOR_SUBDIR, beh_filename);
break;
}
default:
break;
}
}
fprintf(fmake, "\n\n%s", makeheader_mio0.buf);
fprintf(fmake, "\n\n%s", makeheader_level.buf);
fprintf(fmake, "\n\n%s", makeheader_music.buf);
// cleanup
strbuf_free(&makeheader_mio0);
strbuf_free(&makeheader_level);
strbuf_free(&makeheader_music);
fclose(fmake);
fclose(fasm);
// output top-level makefile
sprintf(makefile_name, "%s/Makefile", args->output_dir);
fmake = fopen(makefile_name, "w");
fprintf(fmake, makefile_data);
fclose(fmake);
// output collision model material file
sprintf(makefile_name, "%s/collision.mtl", model_dir);
fmake = fopen(makefile_name, "w");
fprintf(fmake, collision_mtl_data);
fclose(fmake);
generate_ld_script(args, config);
generate_geo_macros(args);
}
static void print_usage(void)
{
ERROR("Usage: n64split [-c CONFIG] [-k] [-m] [-o OUTPUT_DIR] [-s SCALE] [-t] [-v] [-V] ROM\n"
"\n"
"n64split v" N64SPLIT_VERSION ": N64 ROM splitter, resource ripper, disassembler\n"
"\n"
"Optional arguments:\n"
" -c CONFIG ROM configuration file (default: determine from checksum)\n"
" -k keep going as much as possible after error\n"
" -m merge related instructions in to pseudoinstructions\n"
" -o OUTPUT_DIR output directory (default: {CONFIG.basename}.split)\n"
" -r output raw texture binaries\n"
" -s SCALE amount to scale models by (default: %.1f)\n"
" -t generate large texture for MIO0 blocks\n"
" -v verbose progress output\n"
" -V print version information\n"
"\n"
"File arguments:\n"
" ROM input ROM file\n",
default_args.model_scale);
exit(1);
}
static void print_version(void)
{
ERROR("n64split v" N64SPLIT_VERSION ", using:\n"
" %s\n"
" %s\n"
" %s\n"
" %s\n",
disasm_get_version(), n64graphics_get_read_version(), n64graphics_get_write_version(), config_get_version());
}
// parse command line arguments
static void parse_arguments(int argc, char *argv[], arg_config *config)
{
int i;
int file_count = 0;
if (argc < 2) {
print_usage();
exit(1);
}
for (i = 1; i < argc; i++) {
if (argv[i][0] == '-') {
switch (argv[i][1]) {
case 'c':
if (++i >= argc) {
print_usage();
}
strcpy(config->config_file, argv[i]);
break;
case 'k':
config->keep_going = true;
break;
case 'm':
config->merge_pseudo = true;
break;
case 'o':
if (++i >= argc) {
print_usage();
}
strcpy(config->output_dir, argv[i]);
break;
case 'r':
config->raw_texture = true;
break;
case 's':
if (++i >= argc) {
print_usage();
}
config->model_scale = strtof(argv[i], NULL);
break;
case 't':
config->large_texture = true;
break;
case 'v':
g_verbosity = 1;
break;
case 'V':
print_version();
exit(0);
break;
default:
print_usage();
break;
}
} else {
if (file_count == 0) {
strcpy(config->input_file, argv[i]);
} else {
// too many
print_usage();
}
file_count++;
}
}
if (file_count < 1) {
print_usage();
}
}
static int detect_config_file(unsigned int c1, unsigned int c2, rom_config *config)
{
#define CONFIGS_DIR "configs"
dir_list list;
int config_ret;
int ret_val = 0;
int i;
dir_list_ext(CONFIGS_DIR, ".yaml", &list);
for (i = 0; i < list.count; i++) {
config_ret = config_parse_file(list.files[i], config);
INFO("Checking config file '%s' (%X, %X)\n", list.files[i], config->checksum1, config->checksum2);
if (config_ret == 0 && c1 == config->checksum1 && c2 == config->checksum2) {
ERROR("Using config file: %s\n", list.files[i]);
ret_val = 1;
break;
} else {
config_free(config);
}
}
dir_list_free(&list);
return ret_val;
}
int main(int argc, char *argv[])
{
arg_config args;
rom_config config;
disasm_state *state;
long len;
unsigned char *data;
int ret_val;
unsigned int size;
float percent;
int i;
n64_rom_format rom_type;
args = default_args;
parse_arguments(argc, argv, &args);
len = read_file(args.input_file, &data);
if (len <= 0) {
return 2;
}
// confirm valid N64 ROM
rom_type = n64_rom_type(data, len);
switch (rom_type) {
case N64_ROM_Z64:
break; // Z64 is expected format
case N64_ROM_V64:
// byte-swapped BADC format, swap to big-endian ABCD format for processing
INFO("Byte-swapping ROM\n");
swap_bytes(data, len);
break;
case N64_ROM_INVALID:
ERROR("This does not appear to be a valid N64 ROM\n");
if (!args.keep_going) {
exit(1);
}
break;
}
// if no config file supplied, find the right one
if (0 == strcmp(args.config_file, "")) {
ret_val = detect_config_file(read_u32_be(data+0x10), read_u32_be(data+0x14), &config);
if (!ret_val) {
ERROR("Error: could not find valid config file for '%s'\n", args.input_file);
return 1;
}
} else {
ret_val = config_parse_file(args.config_file, &config);
if (ret_val != 0) {
return 1;
}
}
if (config_validate(&config, len)) {
return 3;
}
// if no output directory specified, construct one from config file
if (0 == strcmp(args.output_dir, "")) {
sprintf(args.output_dir, "%s.split", config.basename);
printf("Splitting into \"%s\" directory\n", args.output_dir);
}
// add config labels to disasm state labels
state = disasm_state_init(ASM_GAS, 1);
for (i = 0; i < config.label_count; i++) {
disasm_label_add(state, config.labels[i].name, config.labels[i].ram_addr);
}
// first pass disassembler on each asm section
INFO("Running first pass disassembler...\n");
for (i = 0; i < config.section_count; i++) {
if (config.sections[i].type == TYPE_ASM) {
unsigned int start = config.sections[i].start;
unsigned int end = config.sections[i].end;
unsigned int vaddr = config.sections[i].vaddr;
if (end <= (unsigned int)len) {
mipsdisasm_pass1(data, start, end - start, vaddr, state);
} else {
ERROR("Trying to disassemble past end of file (%X > %X)\n", end, (unsigned int)len);
exit(1);
}
}
}
// split the ROM
INFO("Splitting ROM...\n");
split_file(data, len, &args, &config, state);
// print some stats
printf("\nROM split statistics:\n");
size = 0;
for (i = 0; i < config.section_count; i++) {
if (config.sections[i].type != TYPE_BIN) {
size += config.sections[i].end - config.sections[i].start;
}
}
percent = (float)(100 * size) / (float)(len);
printf("Total decoded section size: %X/%lX (%.2f%%)\n", size, len, percent);
size = 0;
return 0;
}
| 35.975 | 163 | 0.526118 | [
"geometry",
"render",
"object",
"model"
] |
f8196609a3ea6ced11e32ac1d0941035284a93d6 | 3,867 | h | C | pineapple/src/LYPineappleSeat.h | caiqingfeng/libpoker | a2c60884fc5c8e31455fb39e432c49e0df55956b | [
"Apache-2.0"
] | 1 | 2021-04-20T06:22:30.000Z | 2021-04-20T06:22:30.000Z | pineapple/src/LYPineappleSeat.h | caiqingfeng/libpoker | a2c60884fc5c8e31455fb39e432c49e0df55956b | [
"Apache-2.0"
] | null | null | null | pineapple/src/LYPineappleSeat.h | caiqingfeng/libpoker | a2c60884fc5c8e31455fb39e432c49e0df55956b | [
"Apache-2.0"
] | 2 | 2020-10-29T08:21:22.000Z | 2020-12-02T06:40:18.000Z | /*
* LYPineappleSeat.h
*
* Created on: 2013-7-5
* Author: caiqingfeng
*/
#ifndef LYPINEAPPLESEAT_H_
#define LYPINEAPPLESEAT_H_
#include <string>
#include "poker/src/LYSeat.h"
#include "poker/src/LYDeck.h"
#include "holdem/src/LYHandStrength.h"
#include "holdem/src/LYHoldemAlgorithmDelegate.h"
#include "LYPineappleBrick.h"
#include "LYPineappleRace.h"
/*
* 本类仅用于序列化
*/
const unsigned int LYNORMAL = 0;
const unsigned int LYFOUL = 1;
const unsigned int LYABORT = 2;
const unsigned int LYFANTASY = 3;
const unsigned int LYTOPLINE = 0;
const unsigned int LYMIDDLELINE = 1;
const unsigned int LYBOTTOMLINE = 2;
class LYPineappleSeatDynamics : public LYSeatDynamics { //只用到了seatNo, seatStatus
public:
unsigned int gameStatus; //LYNORMAL or LYFOUL
};
class LYPineappleSeat : public LYSeat{
public:
int score; //总得分
int score_race; //本局总得分情况
unsigned int gameStatus; //LYNORMAL or LYFOUL
std::vector<LYCard> topBricks;
std::vector<LYCard> middleBricks;
std::vector<LYCard> bottomBricks;
std::vector<LYCard> cardsOnHand;
bool voteNext;
public:
LYRanking rankingOfTop; //头道大小
LYRanking rankingOfMiddle; //中间道大小
LYRanking rankingOfBottom; //底道大小
LYHandStrengthPtr handStrengthOfTop;
LYHandStrengthPtr handStrengthOfMiddle;
LYHandStrengthPtr handStrengthOfBottom;
public:
//20150208 新增
void abortGame();
public:
std::string allBricksStr();
std::string cardsOnHandStr();
std::string topLineStr();
std::string middleLineStr();
std::string bottomLineStr();
public:
int raceAgainst(LYPineappleSeat& player, LYPineappleRace& race); //返回相对他的总得分,及每一道的得分
void prepareForRace(LYHoldemAlgorithmDelegate* had = NULL);
bool finishGame();
private:
LYHandStrengthPtr genHandStrength(unsigned int line, LYHoldemAlgorithmDelegate *had);
LYRanking getRanking(unsigned int line);
public:
LYHandStrengthPtr genHandStrengthOfTop(LYHoldemAlgorithmDelegate *had, LYHandStrength* capHs=NULL);
LYHandStrengthPtr genHandStrengthOfMiddle(LYHoldemAlgorithmDelegate *had, LYHandStrength* capHs=NULL);
LYHandStrengthPtr genHandStrengthOfBottom(LYHoldemAlgorithmDelegate *had, LYHandStrength* capHs=NULL);
/*
* 以下函数只操作Ranking
*/
LYRanking getRankingOfTop() {return getRanking(LYTOPLINE);};
LYRanking getRankingOfMiddle(){return getRanking(LYMIDDLELINE);};;
LYRanking getRankingOfBottom(){return getRanking(LYBOTTOMLINE);};;
void setRankingOfTop(enum LYRanking rk) { rankingOfTop = rk; };
void setRankingOfMiddle(enum LYRanking rk) { rankingOfBottom = rk; };
void setRankingOfBottom(enum LYRanking rk) { rankingOfBottom = rk; };
public:
unsigned int bonusOfTop();
unsigned int bonusOfMiddle();
unsigned int bonusOfBottom();
public:
LYPineappleSeat(LYApplicant seat_no);
LYPineappleSeat(LYPineappleSeatDynamics &seat_dyn);
virtual ~LYPineappleSeat();
virtual void reset();
virtual void resetForNewGame();
virtual std::string toString();
public:
//重载occupy,reset gameStatus
virtual void occupy(unsigned int buyin, const std::string &uid);
public:
//设定自己的牌,称之为砌墙,砌好了就不能挪动。
int pinup(LYPineappleBrick &pb); //0: OK, -1: 如果之前该Brick有牌则失败
int pinup(std::vector<LYPineappleBrick> &pb);
int blindPinup();
int issueCards(std::vector<LYPineappleBrick> &pb);
const LYCard& getCard(unsigned int &brick);
LYPineappleSeat& operator = (const LYPineappleSeat &right) {
*((LYSeat *)this) = (LYSeat)right;
this->score = right.score;
this->score_race = right.score;
this->rankingOfTop = right.rankingOfTop;
this->rankingOfMiddle = right.rankingOfMiddle;
this->rankingOfBottom = right.rankingOfBottom;
this->handStrengthOfTop = right.handStrengthOfTop;
this->handStrengthOfMiddle = right.handStrengthOfMiddle;
this->handStrengthOfBottom = right.handStrengthOfBottom;
return *this;
}
bool isInGame();
bool isFantasy();
};
typedef std::shared_ptr<LYPineappleSeat> LYPineappleSeatPtr;
#endif /* LYHOLDEMSEAT_H_ */
| 28.433824 | 103 | 0.772175 | [
"vector"
] |
f81f32e603a2c51b4361605b4b49bbe2d5de645e | 433 | h | C | Driver/MessageProcessing/Message.h | onderkruipsel/DAQ-Driver | 8e0b5f17ab0f1d4bdd9195c034a651158f255f33 | [
"BSD-3-Clause"
] | 2 | 2020-09-03T20:51:45.000Z | 2021-10-29T22:30:11.000Z | Driver/MessageProcessing/Message.h | onderkruipsel/DAQ-Driver | 8e0b5f17ab0f1d4bdd9195c034a651158f255f33 | [
"BSD-3-Clause"
] | 2 | 2020-09-02T09:18:59.000Z | 2020-09-16T10:16:55.000Z | Driver/MessageProcessing/Message.h | onderkruipsel/DAQ-Driver | 8e0b5f17ab0f1d4bdd9195c034a651158f255f33 | [
"BSD-3-Clause"
] | 5 | 2020-09-02T08:53:22.000Z | 2020-09-17T08:13:21.000Z | #ifndef MESSAGE_H
#define MESSAGE_H
#include <vector>
#include <stdint.h>
/**
* @brief The MessageHeader struct Defines the binary format of a message header
*/
typedef struct {
uint16_t messageHash;
uint32_t messageSize;
} MessageHeader;
/**
* @brief The Message struct Defines the binary format of a message
*/
typedef struct {
MessageHeader header;
std::vector<uint8_t> data;
} Message;
#endif // MESSAGE_H
| 18.826087 | 80 | 0.720554 | [
"vector"
] |
f84392967e6623e71012b124e93eaefa24180507 | 10,258 | c | C | v4_TMTDyn_MAMMOBOT_RAL2021_beta/eom/codegen/mex/rjtipF/rjtipF_data.c | smhadisadati/TMTDyn | 961213052fd8cda16d8db00ee1c676fe31fc5b66 | [
"BSD-4-Clause"
] | 9 | 2020-04-17T03:34:54.000Z | 2022-03-11T13:20:43.000Z | v4_TMTDyn_MAMMOBOT_RAL2021_beta/eom/codegen/mex/rjtipF/rjtipF_data.c | LenhartYang/TMTDyn | 134d89b156bdc078f6426561d1de76271f07259e | [
"BSD-4-Clause"
] | 2 | 2020-06-05T16:16:18.000Z | 2020-06-14T03:28:03.000Z | v4_TMTDyn_MAMMOBOT_RAL2021_beta/eom/codegen/mex/rjtipF/rjtipF_data.c | LenhartYang/TMTDyn | 134d89b156bdc078f6426561d1de76271f07259e | [
"BSD-4-Clause"
] | 6 | 2020-08-31T05:55:12.000Z | 2022-03-17T11:23:49.000Z | /*
* Academic License - for use in teaching, academic research, and meeting
* course requirements at degree granting institutions only. Not for
* government, commercial, or other organizational use.
*
* rjtipF_data.c
*
* Code generation for function 'rjtipF_data'
*
*/
/* Include files */
#include "rt_nonfinite.h"
#include "rjtipF.h"
#include "rjtipF_data.h"
/* Variable Definitions */
emlrtCTX emlrtRootTLSGlobal = NULL;
emlrtContext emlrtContextGlobal = { true,/* bFirstTime */
false, /* bInitialized */
131482U, /* fVersionInfo */
NULL, /* fErrorFunction */
"rjtipF", /* fFunctionName */
NULL, /* fRTCallStack */
false, /* bDebugMode */
{ 2045744189U, 2170104910U, 2743257031U, 4284093946U },/* fSigWrd */
NULL /* fSigMem */
};
emlrtRSInfo emlrtRSI = { 50, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo b_emlrtRSI = { 51, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo c_emlrtRSI = { 54, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo d_emlrtRSI = { 55, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo f_emlrtRSI = { 72, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo g_emlrtRSI = { 73, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo h_emlrtRSI = { 74, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo i_emlrtRSI = { 75, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo j_emlrtRSI = { 92, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo k_emlrtRSI = { 93, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo l_emlrtRSI = { 94, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo m_emlrtRSI = { 95, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo n_emlrtRSI = { 173, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo o_emlrtRSI = { 174, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo p_emlrtRSI = { 175, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo q_emlrtRSI = { 176, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo r_emlrtRSI = { 177, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo s_emlrtRSI = { 178, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo t_emlrtRSI = { 179, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo u_emlrtRSI = { 180, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo v_emlrtRSI = { 258, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo w_emlrtRSI = { 259, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo x_emlrtRSI = { 260, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo y_emlrtRSI = { 261, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo ab_emlrtRSI = { 262, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo bb_emlrtRSI = { 263, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo eb_emlrtRSI = { 332, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo fb_emlrtRSI = { 333, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo gb_emlrtRSI = { 334, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo hb_emlrtRSI = { 335, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo ib_emlrtRSI = { 336, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo jb_emlrtRSI = { 337, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo kb_emlrtRSI = { 342, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo lb_emlrtRSI = { 343, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo mb_emlrtRSI = { 344, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo nb_emlrtRSI = { 345, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo ob_emlrtRSI = { 346, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo pb_emlrtRSI = { 347, /* lineNo */
"rjtipF", /* fcnName */
"C:\\Users\\customer\\MEGAsync\\Hadi\\Postdoc\\2_KCL\\2_Research\\1. Model\\MOMOBOT TMTDyn\\eom\\rjtipF.m"/* pathName */
};
emlrtRSInfo bc_emlrtRSI = { 55, /* lineNo */
"power", /* fcnName */
"C:\\Program Files\\MATLAB\\R2019a\\toolbox\\eml\\lib\\matlab\\ops\\power.m"/* pathName */
};
/* End of code generation (rjtipF_data.c) */
| 45.389381 | 123 | 0.538799 | [
"model"
] |
f858c69cbb009245157050973dca2c197d444495 | 3,290 | h | C | src/FeatureHandling/include/Vocpp_FeatureHandling/OrFastDetector.h | makra89/Visual-Odometry-Cpp | fc1cb8741430f6bf16185d8416eb421422e54ad5 | [
"BSD-3-Clause"
] | 7 | 2021-03-08T13:18:52.000Z | 2022-01-15T13:39:49.000Z | src/FeatureHandling/include/Vocpp_FeatureHandling/OrFastDetector.h | makra89/Visual-Odometry-Cpp | fc1cb8741430f6bf16185d8416eb421422e54ad5 | [
"BSD-3-Clause"
] | 17 | 2020-01-21T23:11:31.000Z | 2021-03-03T19:49:05.000Z | src/FeatureHandling/include/Vocpp_FeatureHandling/OrFastDetector.h | makra89/Visual-Odometry-Cpp | fc1cb8741430f6bf16185d8416eb421422e54ad5 | [
"BSD-3-Clause"
] | 3 | 2020-05-26T06:52:53.000Z | 2021-09-12T22:41:16.000Z | /* This file is part of the Visual-Odometry-Cpp project.
* It is subject to the license terms in the LICENSE file
* found in the top-level directory of this distribution.
*
* Copyright (C) 2020 Manuel Kraus
*/
#ifndef VOCPP_ORIENTED_FAST_DETECTOR_H
#define VOCPP_ORIENTED_FAST_DETECTOR_H
#include <Vocpp_Interface/Frame.h>
#include <Vocpp_FeatureHandling/Common.h>
#include <Vocpp_FeatureHandling/HarrisEdgeDetector.h>
namespace VOCPP
{
namespace FeatureHandling
{
/**
* /brief Oriented Fast Detector which is part of an ORB detector/descriptor
* This detector searches edges in an image, computes the Harris score for each of them
* and calculates the feature orientation using the intensity centroid in a patch around the image
*/
class OrientedFastDetector
{
public:
/**
* /brief Constructor
*/
OrientedFastDetector(const double& in_intDiffTresh=10/255., const uint32_t& in_numPixelsAboveThresh=12U,
const uint32_t& in_harrisBlockSize=3U, const uint32_t& in_distToEdges=18U);
/**
* /brief Extract features from a provided grayscale image frame.
*
* \param[in] in_frame image frame from which features shall be extracted
* \param[in] in_maxNumFeatures maximum number of features returned
* \param[out] out_features features extracted from the frame
* \return True if at least one feature has been detected, false otherwise
*/
bool ExtractFeatures(const Frame& in_frame, const uint32_t& in_maxNumFeatures, std::vector<Feature>& out_features);
private:
// It is not allowed to copy the detector directly
OrientedFastDetector& operator=(const OrientedFastDetector&);
OrientedFastDetector(const OrientedFastDetector&);
/**
* /brief Compute the FAST score for the current pixel (in_coordX / in_coordY), this score can be used in the following way:
* The score of an edge should be higher than m_numPixelsAboveThresh
* Internally first 4 edge pixels are checked and then CheckAll() is called
* \return score, can be compared against m_numPixelsAboveThresh
*/
int32_t CheckIntensities(const cv::Mat1d& in_image, const int32_t& in_coordX, const int32_t& in_coordY, const int32_t& in_imgWidth, const int32_t& in_imgHeight);
/**
* /brief Called by CheckIntensities()
*/
int32_t CheckAll(const cv::Mat1d& in_image, const int32_t& in_coordX, const int32_t& in_coordY, const int32_t& in_passLower, const int32_t& in_passHigher);
const double m_intDiffTresh; ///< intensity treshold for pixel intensity comparison (intensity value given for 8 bit image)
const uint32_t m_numPixelsAboveThresh; ///< necessary number of pixels above or below threshold for a detection
const uint32_t m_harrisBlockSize; ///< size of patch over which harris detector averages gradients (has to be odd number)
const uint32_t m_distToEdges; /// minimum distance to edges of reported features [pixels]
HarrisEdgeDetector m_harrisDetector; ///< Harris Edge detector, used to compute feature scores
static const uint32_t s_featureSize; ///< path size which is taken into account during feature detection and orientation determination
};
} //namespace FeatureHandling
} //namespace VOCPP
#endif /* VOCPP_ORIENTED_FAST_DETECTOR_H */
| 43.866667 | 165 | 0.751672 | [
"vector"
] |
f85c7027d7155bbb5c9c6f7c02c0a609480e5b1e | 167,637 | h | C | Include/10.0.15063.0/winrt/windows.ui.input.preview.injection.h | sezero/windows-sdk-headers | e8e9d4d50769ded01a2df905c6bf4355eb3fa8b5 | [
"MIT"
] | 5 | 2020-05-29T06:22:17.000Z | 2021-11-28T08:21:38.000Z | Include/10.0.15063.0/winrt/windows.ui.input.preview.injection.h | sezero/windows-sdk-headers | e8e9d4d50769ded01a2df905c6bf4355eb3fa8b5 | [
"MIT"
] | null | null | null | Include/10.0.15063.0/winrt/windows.ui.input.preview.injection.h | sezero/windows-sdk-headers | e8e9d4d50769ded01a2df905c6bf4355eb3fa8b5 | [
"MIT"
] | 5 | 2020-05-30T04:15:11.000Z | 2021-11-28T08:48:56.000Z |
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.01.0622 */
/* @@MIDL_FILE_HEADING( ) */
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 500
#endif
/* verify that the <rpcsal.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCSAL_H_VERSION__
#define __REQUIRED_RPCSAL_H_VERSION__ 100
#endif
#include "rpc.h"
#include "rpcndr.h"
#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif /* __RPCNDR_H_VERSION__ */
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
#ifndef __windows2Eui2Einput2Epreview2Einjection_h__
#define __windows2Eui2Einput2Epreview2Einjection_h__
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
/* Forward Declarations */
#ifndef ____FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_FWD_DEFINED__
#define ____FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_FWD_DEFINED__
typedef interface __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo;
#endif /* ____FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_FWD_DEFINED__ */
#ifndef ____FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_FWD_DEFINED__
#define ____FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_FWD_DEFINED__
typedef interface __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo;
#endif /* ____FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_FWD_DEFINED__ */
#ifndef ____FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_FWD_DEFINED__
#define ____FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_FWD_DEFINED__
typedef interface __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo;
#endif /* ____FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_FWD_DEFINED__ */
#ifndef ____FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_FWD_DEFINED__
#define ____FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_FWD_DEFINED__
typedef interface __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo;
#endif /* ____FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_FWD_DEFINED__ */
#ifndef ____FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_FWD_DEFINED__
#define ____FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_FWD_DEFINED__
typedef interface __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo;
#endif /* ____FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_FWD_DEFINED__ */
#ifndef ____FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_FWD_DEFINED__
#define ____FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_FWD_DEFINED__
typedef interface __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo;
#endif /* ____FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_FWD_DEFINED__ */
#ifndef ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo_FWD_DEFINED__
#define ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo_FWD_DEFINED__
typedef interface __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo;
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
interface IInjectedInputKeyboardInfo;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
#endif /* __cplusplus */
#endif /* ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo_FWD_DEFINED__ */
#ifndef ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_FWD_DEFINED__
#define ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_FWD_DEFINED__
typedef interface __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo;
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
interface IInjectedInputMouseInfo;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
#endif /* __cplusplus */
#endif /* ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_FWD_DEFINED__ */
#ifndef ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_FWD_DEFINED__
#define ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_FWD_DEFINED__
typedef interface __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo;
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
interface IInjectedInputPenInfo;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
#endif /* __cplusplus */
#endif /* ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_FWD_DEFINED__ */
#ifndef ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_FWD_DEFINED__
#define ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_FWD_DEFINED__
typedef interface __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo;
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
interface IInjectedInputTouchInfo;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
#endif /* __cplusplus */
#endif /* ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_FWD_DEFINED__ */
#ifndef ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_FWD_DEFINED__
#define ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_FWD_DEFINED__
typedef interface __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector;
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
interface IInputInjector;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
#endif /* __cplusplus */
#endif /* ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_FWD_DEFINED__ */
#ifndef ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics_FWD_DEFINED__
#define ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics_FWD_DEFINED__
typedef interface __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics;
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
interface IInputInjectorStatics;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
#endif /* __cplusplus */
#endif /* ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics_FWD_DEFINED__ */
/* header files for imported files */
#include "inspectable.h"
#include "AsyncInfo.h"
#include "EventToken.h"
#include "Windows.Foundation.h"
#ifdef __cplusplus
extern "C"{
#endif
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0000 */
/* [local] */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#include <windows.foundation.collections.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
class InjectedInputKeyboardInfo;
} /*Injection*/
} /*Preview*/
} /*Input*/
} /*UI*/
} /*Windows*/
}
#endif
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
interface IInjectedInputKeyboardInfo;
} /*Injection*/
} /*Preview*/
} /*Input*/
} /*UI*/
} /*Windows*/
}
#endif
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0000 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0000_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0000_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0331 */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0331 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0331_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0331_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0001 */
/* [local] */
#ifndef DEF___FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_USE
#define DEF___FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation { namespace Collections {
template <>
struct __declspec(uuid("500e5efe-3bc1-5d9b-bcfc-c1f439505f12"))
IIterator<ABI::Windows::UI::Input::Preview::Injection::InjectedInputKeyboardInfo*> : IIterator_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::UI::Input::Preview::Injection::InjectedInputKeyboardInfo*, ABI::Windows::UI::Input::Preview::Injection::IInjectedInputKeyboardInfo*>> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.Collections.IIterator`1<Windows.UI.Input.Preview.Injection.InjectedInputKeyboardInfo>"; }
};
typedef IIterator<ABI::Windows::UI::Input::Preview::Injection::InjectedInputKeyboardInfo*> __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_t;
#define ____FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_FWD_DEFINED__
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo ABI::Windows::Foundation::Collections::__FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_t
/* ABI */ } /* Windows */ } /* Foundation */ } /* Collections */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_USE */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0001 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0001_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0001_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0332 */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0332 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0332_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0332_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0002 */
/* [local] */
#ifndef DEF___FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_USE
#define DEF___FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation { namespace Collections {
template <>
struct __declspec(uuid("15d6330f-9c97-5705-b677-872585664fb5"))
IIterable<ABI::Windows::UI::Input::Preview::Injection::InjectedInputKeyboardInfo*> : IIterable_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::UI::Input::Preview::Injection::InjectedInputKeyboardInfo*, ABI::Windows::UI::Input::Preview::Injection::IInjectedInputKeyboardInfo*>> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.Collections.IIterable`1<Windows.UI.Input.Preview.Injection.InjectedInputKeyboardInfo>"; }
};
typedef IIterable<ABI::Windows::UI::Input::Preview::Injection::InjectedInputKeyboardInfo*> __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_t;
#define ____FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_FWD_DEFINED__
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo ABI::Windows::Foundation::Collections::__FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_t
/* ABI */ } /* Windows */ } /* Foundation */ } /* Collections */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_USE */
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
class InjectedInputMouseInfo;
} /*Injection*/
} /*Preview*/
} /*Input*/
} /*UI*/
} /*Windows*/
}
#endif
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
interface IInjectedInputMouseInfo;
} /*Injection*/
} /*Preview*/
} /*Input*/
} /*UI*/
} /*Windows*/
}
#endif
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0002 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0002_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0002_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0333 */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0333 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0333_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0333_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0003 */
/* [local] */
#ifndef DEF___FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_USE
#define DEF___FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation { namespace Collections {
template <>
struct __declspec(uuid("9604d1d9-1744-5bd3-b5b9-d47b9434facb"))
IIterator<ABI::Windows::UI::Input::Preview::Injection::InjectedInputMouseInfo*> : IIterator_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::UI::Input::Preview::Injection::InjectedInputMouseInfo*, ABI::Windows::UI::Input::Preview::Injection::IInjectedInputMouseInfo*>> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.Collections.IIterator`1<Windows.UI.Input.Preview.Injection.InjectedInputMouseInfo>"; }
};
typedef IIterator<ABI::Windows::UI::Input::Preview::Injection::InjectedInputMouseInfo*> __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_t;
#define ____FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_FWD_DEFINED__
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo ABI::Windows::Foundation::Collections::__FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_t
/* ABI */ } /* Windows */ } /* Foundation */ } /* Collections */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_USE */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0003 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0003_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0003_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0334 */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0334 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0334_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0334_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0004 */
/* [local] */
#ifndef DEF___FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_USE
#define DEF___FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation { namespace Collections {
template <>
struct __declspec(uuid("6c34e5bd-0fa4-5244-89fb-04bfd480ecd8"))
IIterable<ABI::Windows::UI::Input::Preview::Injection::InjectedInputMouseInfo*> : IIterable_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::UI::Input::Preview::Injection::InjectedInputMouseInfo*, ABI::Windows::UI::Input::Preview::Injection::IInjectedInputMouseInfo*>> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.Collections.IIterable`1<Windows.UI.Input.Preview.Injection.InjectedInputMouseInfo>"; }
};
typedef IIterable<ABI::Windows::UI::Input::Preview::Injection::InjectedInputMouseInfo*> __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_t;
#define ____FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_FWD_DEFINED__
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo ABI::Windows::Foundation::Collections::__FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_t
/* ABI */ } /* Windows */ } /* Foundation */ } /* Collections */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_USE */
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
class InjectedInputTouchInfo;
} /*Injection*/
} /*Preview*/
} /*Input*/
} /*UI*/
} /*Windows*/
}
#endif
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
interface IInjectedInputTouchInfo;
} /*Injection*/
} /*Preview*/
} /*Input*/
} /*UI*/
} /*Windows*/
}
#endif
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0004 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0004_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0004_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0335 */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0335 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0335_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0335_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0005 */
/* [local] */
#ifndef DEF___FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_USE
#define DEF___FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation { namespace Collections {
template <>
struct __declspec(uuid("4bc92e92-d32e-597a-ae24-b38861c5fb08"))
IIterator<ABI::Windows::UI::Input::Preview::Injection::InjectedInputTouchInfo*> : IIterator_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::UI::Input::Preview::Injection::InjectedInputTouchInfo*, ABI::Windows::UI::Input::Preview::Injection::IInjectedInputTouchInfo*>> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.Collections.IIterator`1<Windows.UI.Input.Preview.Injection.InjectedInputTouchInfo>"; }
};
typedef IIterator<ABI::Windows::UI::Input::Preview::Injection::InjectedInputTouchInfo*> __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_t;
#define ____FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_FWD_DEFINED__
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo ABI::Windows::Foundation::Collections::__FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_t
/* ABI */ } /* Windows */ } /* Foundation */ } /* Collections */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_USE */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0005 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0005_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0005_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0336 */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0336 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0336_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0336_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0006 */
/* [local] */
#ifndef DEF___FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_USE
#define DEF___FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_USE
#if defined(__cplusplus) && !defined(RO_NO_TEMPLATE_NAME)
} /*extern "C"*/
namespace ABI { namespace Windows { namespace Foundation { namespace Collections {
template <>
struct __declspec(uuid("ac5fac0b-82a0-5436-9284-e7db0bf4e615"))
IIterable<ABI::Windows::UI::Input::Preview::Injection::InjectedInputTouchInfo*> : IIterable_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Windows::UI::Input::Preview::Injection::InjectedInputTouchInfo*, ABI::Windows::UI::Input::Preview::Injection::IInjectedInputTouchInfo*>> {
static const wchar_t* z_get_rc_name_impl() {
return L"Windows.Foundation.Collections.IIterable`1<Windows.UI.Input.Preview.Injection.InjectedInputTouchInfo>"; }
};
typedef IIterable<ABI::Windows::UI::Input::Preview::Injection::InjectedInputTouchInfo*> __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_t;
#define ____FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_FWD_DEFINED__
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo ABI::Windows::Foundation::Collections::__FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_t
/* ABI */ } /* Windows */ } /* Foundation */ } /* Collections */ }
extern "C" {
#endif //__cplusplus
#endif /* DEF___FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_USE */
#if defined(__cplusplus)
}
#endif // defined(__cplusplus)
#include <Windows.Foundation.h>
#if defined(__cplusplus)
extern "C" {
#endif // defined(__cplusplus)
#if !defined(__cplusplus)
#if !defined(__cplusplus)
typedef enum __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputButtonChangeKind __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputButtonChangeKind;
#endif /* end if !defined(__cplusplus) */
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
typedef enum __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputKeyOptions __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputKeyOptions;
#endif /* end if !defined(__cplusplus) */
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
typedef enum __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputMouseOptions __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputMouseOptions;
#endif /* end if !defined(__cplusplus) */
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
typedef enum __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPenButtons __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPenButtons;
#endif /* end if !defined(__cplusplus) */
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
typedef enum __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPenParameters __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPenParameters;
#endif /* end if !defined(__cplusplus) */
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
typedef enum __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPointerOptions __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPointerOptions;
#endif /* end if !defined(__cplusplus) */
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
typedef enum __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputShortcut __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputShortcut;
#endif /* end if !defined(__cplusplus) */
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
typedef enum __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputTouchParameters __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputTouchParameters;
#endif /* end if !defined(__cplusplus) */
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
typedef enum __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputVisualizationMode __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputVisualizationMode;
#endif /* end if !defined(__cplusplus) */
#endif
#if !defined(__cplusplus)
typedef struct __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPoint __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPoint;
#endif
#if !defined(__cplusplus)
typedef struct __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPointerInfo __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPointerInfo;
#endif
#if !defined(__cplusplus)
typedef struct __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputRectangle __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputRectangle;
#endif
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
class InjectedInputPenInfo;
} /*Injection*/
} /*Preview*/
} /*Input*/
} /*UI*/
} /*Windows*/
}
#endif
#ifdef __cplusplus
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
class InputInjector;
} /*Injection*/
} /*Preview*/
} /*Input*/
} /*UI*/
} /*Windows*/
}
#endif
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0006 */
/* [local] */
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
typedef enum InjectedInputButtonChangeKind InjectedInputButtonChangeKind;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
typedef enum InjectedInputKeyOptions InjectedInputKeyOptions;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
typedef enum InjectedInputMouseOptions InjectedInputMouseOptions;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
typedef enum InjectedInputPenButtons InjectedInputPenButtons;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
typedef enum InjectedInputPenParameters InjectedInputPenParameters;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
typedef enum InjectedInputPointerOptions InjectedInputPointerOptions;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
typedef enum InjectedInputShortcut InjectedInputShortcut;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
typedef enum InjectedInputTouchParameters InjectedInputTouchParameters;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
typedef enum InjectedInputVisualizationMode InjectedInputVisualizationMode;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
typedef struct InjectedInputPoint InjectedInputPoint;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
typedef struct InjectedInputPointerInfo InjectedInputPointerInfo;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
typedef struct InjectedInputRectangle InjectedInputRectangle;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0006_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0006_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0337 */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0337 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0337_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0337_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0007 */
/* [local] */
#ifndef DEF___FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo
#define DEF___FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0007 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0007_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0007_v0_0_s_ifspec;
#ifndef ____FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_INTERFACE_DEFINED__
#define ____FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_INTERFACE_DEFINED__
/* interface __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo */
/* [unique][uuid][object] */
/* interface __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("500e5efe-3bc1-5d9b-bcfc-c1f439505f12")
__FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo : public IInspectable
{
public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Current(
/* [retval][out] */ __RPC__deref_out_opt ABI::Windows::UI::Input::Preview::Injection::IInjectedInputKeyboardInfo **current) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HasCurrent(
/* [retval][out] */ __RPC__out boolean *hasCurrent) = 0;
virtual HRESULT STDMETHODCALLTYPE MoveNext(
/* [retval][out] */ __RPC__out boolean *hasCurrent) = 0;
virtual HRESULT STDMETHODCALLTYPE GetMany(
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) ABI::Windows::UI::Input::Preview::Injection::IInjectedInputKeyboardInfo **items,
/* [retval][out] */ __RPC__out unsigned int *actual) = 0;
};
#else /* C style interface */
typedef struct __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfoVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Current )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo * This,
/* [retval][out] */ __RPC__deref_out_opt __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo **current);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HasCurrent )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo * This,
/* [retval][out] */ __RPC__out boolean *hasCurrent);
HRESULT ( STDMETHODCALLTYPE *MoveNext )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo * This,
/* [retval][out] */ __RPC__out boolean *hasCurrent);
HRESULT ( STDMETHODCALLTYPE *GetMany )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo * This,
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo **items,
/* [retval][out] */ __RPC__out unsigned int *actual);
END_INTERFACE
} __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfoVtbl;
interface __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo
{
CONST_VTBL struct __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfoVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_get_Current(This,current) \
( (This)->lpVtbl -> get_Current(This,current) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_get_HasCurrent(This,hasCurrent) \
( (This)->lpVtbl -> get_HasCurrent(This,hasCurrent) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_MoveNext(This,hasCurrent) \
( (This)->lpVtbl -> MoveNext(This,hasCurrent) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_GetMany(This,capacity,items,actual) \
( (This)->lpVtbl -> GetMany(This,capacity,items,actual) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0008 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0008 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0008_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0008_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0338 */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0338 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0338_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0338_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0009 */
/* [local] */
#ifndef DEF___FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo
#define DEF___FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0009 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0009_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0009_v0_0_s_ifspec;
#ifndef ____FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_INTERFACE_DEFINED__
#define ____FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_INTERFACE_DEFINED__
/* interface __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo */
/* [unique][uuid][object] */
/* interface __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("15d6330f-9c97-5705-b677-872585664fb5")
__FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo : public IInspectable
{
public:
virtual HRESULT STDMETHODCALLTYPE First(
/* [retval][out] */ __RPC__deref_out_opt __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo **first) = 0;
};
#else /* C style interface */
typedef struct __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfoVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
HRESULT ( STDMETHODCALLTYPE *First )(
__RPC__in __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo * This,
/* [retval][out] */ __RPC__deref_out_opt __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo **first);
END_INTERFACE
} __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfoVtbl;
interface __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo
{
CONST_VTBL struct __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfoVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_First(This,first) \
( (This)->lpVtbl -> First(This,first) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0010 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0010 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0010_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0010_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0339 */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0339 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0339_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0339_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0011 */
/* [local] */
#ifndef DEF___FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo
#define DEF___FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0011 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0011_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0011_v0_0_s_ifspec;
#ifndef ____FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_INTERFACE_DEFINED__
#define ____FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_INTERFACE_DEFINED__
/* interface __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo */
/* [unique][uuid][object] */
/* interface __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("9604d1d9-1744-5bd3-b5b9-d47b9434facb")
__FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo : public IInspectable
{
public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Current(
/* [retval][out] */ __RPC__deref_out_opt ABI::Windows::UI::Input::Preview::Injection::IInjectedInputMouseInfo **current) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HasCurrent(
/* [retval][out] */ __RPC__out boolean *hasCurrent) = 0;
virtual HRESULT STDMETHODCALLTYPE MoveNext(
/* [retval][out] */ __RPC__out boolean *hasCurrent) = 0;
virtual HRESULT STDMETHODCALLTYPE GetMany(
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) ABI::Windows::UI::Input::Preview::Injection::IInjectedInputMouseInfo **items,
/* [retval][out] */ __RPC__out unsigned int *actual) = 0;
};
#else /* C style interface */
typedef struct __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfoVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Current )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo * This,
/* [retval][out] */ __RPC__deref_out_opt __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo **current);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HasCurrent )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo * This,
/* [retval][out] */ __RPC__out boolean *hasCurrent);
HRESULT ( STDMETHODCALLTYPE *MoveNext )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo * This,
/* [retval][out] */ __RPC__out boolean *hasCurrent);
HRESULT ( STDMETHODCALLTYPE *GetMany )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo * This,
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo **items,
/* [retval][out] */ __RPC__out unsigned int *actual);
END_INTERFACE
} __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfoVtbl;
interface __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo
{
CONST_VTBL struct __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfoVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_get_Current(This,current) \
( (This)->lpVtbl -> get_Current(This,current) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_get_HasCurrent(This,hasCurrent) \
( (This)->lpVtbl -> get_HasCurrent(This,hasCurrent) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_MoveNext(This,hasCurrent) \
( (This)->lpVtbl -> MoveNext(This,hasCurrent) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_GetMany(This,capacity,items,actual) \
( (This)->lpVtbl -> GetMany(This,capacity,items,actual) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0012 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0012 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0012_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0012_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0340 */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0340 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0340_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0340_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0013 */
/* [local] */
#ifndef DEF___FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo
#define DEF___FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0013 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0013_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0013_v0_0_s_ifspec;
#ifndef ____FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_INTERFACE_DEFINED__
#define ____FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_INTERFACE_DEFINED__
/* interface __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo */
/* [unique][uuid][object] */
/* interface __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("6c34e5bd-0fa4-5244-89fb-04bfd480ecd8")
__FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo : public IInspectable
{
public:
virtual HRESULT STDMETHODCALLTYPE First(
/* [retval][out] */ __RPC__deref_out_opt __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo **first) = 0;
};
#else /* C style interface */
typedef struct __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfoVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
HRESULT ( STDMETHODCALLTYPE *First )(
__RPC__in __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo * This,
/* [retval][out] */ __RPC__deref_out_opt __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo **first);
END_INTERFACE
} __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfoVtbl;
interface __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo
{
CONST_VTBL struct __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfoVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_First(This,first) \
( (This)->lpVtbl -> First(This,first) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0014 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0014 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0014_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0014_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0341 */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0341 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0341_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0341_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0015 */
/* [local] */
#ifndef DEF___FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo
#define DEF___FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0015 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0015_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0015_v0_0_s_ifspec;
#ifndef ____FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_INTERFACE_DEFINED__
#define ____FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_INTERFACE_DEFINED__
/* interface __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo */
/* [unique][uuid][object] */
/* interface __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("4bc92e92-d32e-597a-ae24-b38861c5fb08")
__FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo : public IInspectable
{
public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Current(
/* [retval][out] */ __RPC__deref_out_opt ABI::Windows::UI::Input::Preview::Injection::IInjectedInputTouchInfo **current) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HasCurrent(
/* [retval][out] */ __RPC__out boolean *hasCurrent) = 0;
virtual HRESULT STDMETHODCALLTYPE MoveNext(
/* [retval][out] */ __RPC__out boolean *hasCurrent) = 0;
virtual HRESULT STDMETHODCALLTYPE GetMany(
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) ABI::Windows::UI::Input::Preview::Injection::IInjectedInputTouchInfo **items,
/* [retval][out] */ __RPC__out unsigned int *actual) = 0;
};
#else /* C style interface */
typedef struct __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfoVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Current )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo * This,
/* [retval][out] */ __RPC__deref_out_opt __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo **current);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HasCurrent )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo * This,
/* [retval][out] */ __RPC__out boolean *hasCurrent);
HRESULT ( STDMETHODCALLTYPE *MoveNext )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo * This,
/* [retval][out] */ __RPC__out boolean *hasCurrent);
HRESULT ( STDMETHODCALLTYPE *GetMany )(
__RPC__in __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo * This,
/* [in] */ unsigned int capacity,
/* [size_is][length_is][out] */ __RPC__out_ecount_part(capacity, *actual) __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo **items,
/* [retval][out] */ __RPC__out unsigned int *actual);
END_INTERFACE
} __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfoVtbl;
interface __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo
{
CONST_VTBL struct __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfoVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_get_Current(This,current) \
( (This)->lpVtbl -> get_Current(This,current) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_get_HasCurrent(This,hasCurrent) \
( (This)->lpVtbl -> get_HasCurrent(This,hasCurrent) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_MoveNext(This,hasCurrent) \
( (This)->lpVtbl -> MoveNext(This,hasCurrent) )
#define __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_GetMany(This,capacity,items,actual) \
( (This)->lpVtbl -> GetMany(This,capacity,items,actual) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0016 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0016 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0016_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0016_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0342 */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0342 */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0342_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection2Eidl_0000_0342_v0_0_s_ifspec;
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0017 */
/* [local] */
#ifndef DEF___FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo
#define DEF___FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo
#if !defined(__cplusplus) || defined(RO_NO_TEMPLATE_NAME)
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0017 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0017_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0017_v0_0_s_ifspec;
#ifndef ____FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_INTERFACE_DEFINED__
#define ____FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_INTERFACE_DEFINED__
/* interface __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo */
/* [unique][uuid][object] */
/* interface __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo */
/* [unique][uuid][object] */
EXTERN_C const IID IID___FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("ac5fac0b-82a0-5436-9284-e7db0bf4e615")
__FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo : public IInspectable
{
public:
virtual HRESULT STDMETHODCALLTYPE First(
/* [retval][out] */ __RPC__deref_out_opt __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo **first) = 0;
};
#else /* C style interface */
typedef struct __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfoVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
HRESULT ( STDMETHODCALLTYPE *First )(
__RPC__in __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo * This,
/* [retval][out] */ __RPC__deref_out_opt __FIIterator_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo **first);
END_INTERFACE
} __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfoVtbl;
interface __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo
{
CONST_VTBL struct __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfoVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_First(This,first) \
( (This)->lpVtbl -> First(This,first) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0018 */
/* [local] */
#endif /* pinterface */
#endif /* DEF___FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo */
#if !defined(__cplusplus)
#if !defined(__cplusplus)
/* [v1_enum] */
enum __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputButtonChangeKind
{
InjectedInputButtonChangeKind_None = 0,
InjectedInputButtonChangeKind_FirstButtonDown = 1,
InjectedInputButtonChangeKind_FirstButtonUp = 2,
InjectedInputButtonChangeKind_SecondButtonDown = 3,
InjectedInputButtonChangeKind_SecondButtonUp = 4,
InjectedInputButtonChangeKind_ThirdButtonDown = 5,
InjectedInputButtonChangeKind_ThirdButtonUp = 6,
InjectedInputButtonChangeKind_FourthButtonDown = 7,
InjectedInputButtonChangeKind_FourthButtonUp = 8,
InjectedInputButtonChangeKind_FifthButtonDown = 9,
InjectedInputButtonChangeKind_FifthButtonUp = 10
} ;
#endif /* end if !defined(__cplusplus) */
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
/* [v1_enum] */
enum __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputKeyOptions
{
InjectedInputKeyOptions_None = 0,
InjectedInputKeyOptions_ExtendedKey = 0x1,
InjectedInputKeyOptions_KeyUp = 0x2,
InjectedInputKeyOptions_ScanCode = 0x8,
InjectedInputKeyOptions_Unicode = 0x4
} ;
#endif /* end if !defined(__cplusplus) */
#else
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
enum InjectedInputKeyOptions;
DEFINE_ENUM_FLAG_OPERATORS(InjectedInputKeyOptions)
} /*Injection*/
} /*Preview*/
} /*Input*/
} /*UI*/
} /*Windows*/
}
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
/* [v1_enum] */
enum __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputMouseOptions
{
InjectedInputMouseOptions_None = 0,
InjectedInputMouseOptions_Move = 0x1,
InjectedInputMouseOptions_LeftDown = 0x2,
InjectedInputMouseOptions_LeftUp = 0x4,
InjectedInputMouseOptions_RightDown = 0x8,
InjectedInputMouseOptions_RightUp = 0x10,
InjectedInputMouseOptions_MiddleDown = 0x20,
InjectedInputMouseOptions_MiddleUp = 0x40,
InjectedInputMouseOptions_XDown = 0x80,
InjectedInputMouseOptions_XUp = 0x100,
InjectedInputMouseOptions_Wheel = 0x800,
InjectedInputMouseOptions_HWheel = 0x1000,
InjectedInputMouseOptions_MoveNoCoalesce = 0x2000,
InjectedInputMouseOptions_VirtualDesk = 0x4000,
InjectedInputMouseOptions_Absolute = 0x8000
} ;
#endif /* end if !defined(__cplusplus) */
#else
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
enum InjectedInputMouseOptions;
DEFINE_ENUM_FLAG_OPERATORS(InjectedInputMouseOptions)
} /*Injection*/
} /*Preview*/
} /*Input*/
} /*UI*/
} /*Windows*/
}
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
/* [v1_enum] */
enum __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPenButtons
{
InjectedInputPenButtons_None = 0,
InjectedInputPenButtons_Barrel = 0x1,
InjectedInputPenButtons_Inverted = 0x2,
InjectedInputPenButtons_Eraser = 0x4
} ;
#endif /* end if !defined(__cplusplus) */
#else
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
enum InjectedInputPenButtons;
DEFINE_ENUM_FLAG_OPERATORS(InjectedInputPenButtons)
} /*Injection*/
} /*Preview*/
} /*Input*/
} /*UI*/
} /*Windows*/
}
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
/* [v1_enum] */
enum __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPenParameters
{
InjectedInputPenParameters_None = 0,
InjectedInputPenParameters_Pressure = 0x1,
InjectedInputPenParameters_Rotation = 0x2,
InjectedInputPenParameters_TiltX = 0x4,
InjectedInputPenParameters_TiltY = 0x8
} ;
#endif /* end if !defined(__cplusplus) */
#else
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
enum InjectedInputPenParameters;
DEFINE_ENUM_FLAG_OPERATORS(InjectedInputPenParameters)
} /*Injection*/
} /*Preview*/
} /*Input*/
} /*UI*/
} /*Windows*/
}
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
/* [v1_enum] */
enum __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPointerOptions
{
InjectedInputPointerOptions_None = 0,
InjectedInputPointerOptions_New = 0x1,
InjectedInputPointerOptions_InRange = 0x2,
InjectedInputPointerOptions_InContact = 0x4,
InjectedInputPointerOptions_FirstButton = 0x10,
InjectedInputPointerOptions_SecondButton = 0x20,
InjectedInputPointerOptions_Primary = 0x2000,
InjectedInputPointerOptions_Confidence = 0x4000,
InjectedInputPointerOptions_Canceled = 0x8000,
InjectedInputPointerOptions_PointerDown = 0x10000,
InjectedInputPointerOptions_Update = 0x20000,
InjectedInputPointerOptions_PointerUp = 0x40000,
InjectedInputPointerOptions_CaptureChanged = 0x200000
} ;
#endif /* end if !defined(__cplusplus) */
#else
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
enum InjectedInputPointerOptions;
DEFINE_ENUM_FLAG_OPERATORS(InjectedInputPointerOptions)
} /*Injection*/
} /*Preview*/
} /*Input*/
} /*UI*/
} /*Windows*/
}
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
/* [v1_enum] */
enum __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputShortcut
{
InjectedInputShortcut_Back = 0,
InjectedInputShortcut_Start = 1,
InjectedInputShortcut_Search = 2
} ;
#endif /* end if !defined(__cplusplus) */
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
/* [v1_enum] */
enum __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputTouchParameters
{
InjectedInputTouchParameters_None = 0,
InjectedInputTouchParameters_Contact = 0x1,
InjectedInputTouchParameters_Orientation = 0x2,
InjectedInputTouchParameters_Pressure = 0x4
} ;
#endif /* end if !defined(__cplusplus) */
#else
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
enum InjectedInputTouchParameters;
DEFINE_ENUM_FLAG_OPERATORS(InjectedInputTouchParameters)
} /*Injection*/
} /*Preview*/
} /*Input*/
} /*UI*/
} /*Windows*/
}
#endif
#if !defined(__cplusplus)
#if !defined(__cplusplus)
/* [v1_enum] */
enum __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputVisualizationMode
{
InjectedInputVisualizationMode_None = 0,
InjectedInputVisualizationMode_Default = 1,
InjectedInputVisualizationMode_Indirect = 2
} ;
#endif /* end if !defined(__cplusplus) */
#endif
#if !defined(__cplusplus)
struct __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPoint
{
INT32 PositionX;
INT32 PositionY;
} ;
#endif
#if !defined(__cplusplus)
struct __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPointerInfo
{
UINT32 PointerId;
__x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPointerOptions PointerOptions;
__x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPoint PixelLocation;
UINT32 TimeOffsetInMilliseconds;
UINT64 PerformanceCount;
} ;
#endif
#if !defined(__cplusplus)
struct __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputRectangle
{
INT32 Left;
INT32 Top;
INT32 Bottom;
INT32 Right;
} ;
#endif
#if !defined(____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo_INTERFACE_DEFINED__)
extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_Windows_UI_Input_Preview_Injection_IInjectedInputKeyboardInfo[] = L"Windows.UI.Input.Preview.Injection.IInjectedInputKeyboardInfo";
#endif /* !defined(____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo_INTERFACE_DEFINED__) */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0018 */
/* [local] */
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
/* [v1_enum] */
enum InjectedInputButtonChangeKind
{
InjectedInputButtonChangeKind_None = 0,
InjectedInputButtonChangeKind_FirstButtonDown = 1,
InjectedInputButtonChangeKind_FirstButtonUp = 2,
InjectedInputButtonChangeKind_SecondButtonDown = 3,
InjectedInputButtonChangeKind_SecondButtonUp = 4,
InjectedInputButtonChangeKind_ThirdButtonDown = 5,
InjectedInputButtonChangeKind_ThirdButtonUp = 6,
InjectedInputButtonChangeKind_FourthButtonDown = 7,
InjectedInputButtonChangeKind_FourthButtonUp = 8,
InjectedInputButtonChangeKind_FifthButtonDown = 9,
InjectedInputButtonChangeKind_FifthButtonUp = 10
} ;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
/* [v1_enum] */
enum InjectedInputKeyOptions
{
InjectedInputKeyOptions_None = 0,
InjectedInputKeyOptions_ExtendedKey = 0x1,
InjectedInputKeyOptions_KeyUp = 0x2,
InjectedInputKeyOptions_ScanCode = 0x8,
InjectedInputKeyOptions_Unicode = 0x4
} ;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
/* [v1_enum] */
enum InjectedInputMouseOptions
{
InjectedInputMouseOptions_None = 0,
InjectedInputMouseOptions_Move = 0x1,
InjectedInputMouseOptions_LeftDown = 0x2,
InjectedInputMouseOptions_LeftUp = 0x4,
InjectedInputMouseOptions_RightDown = 0x8,
InjectedInputMouseOptions_RightUp = 0x10,
InjectedInputMouseOptions_MiddleDown = 0x20,
InjectedInputMouseOptions_MiddleUp = 0x40,
InjectedInputMouseOptions_XDown = 0x80,
InjectedInputMouseOptions_XUp = 0x100,
InjectedInputMouseOptions_Wheel = 0x800,
InjectedInputMouseOptions_HWheel = 0x1000,
InjectedInputMouseOptions_MoveNoCoalesce = 0x2000,
InjectedInputMouseOptions_VirtualDesk = 0x4000,
InjectedInputMouseOptions_Absolute = 0x8000
} ;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
/* [v1_enum] */
enum InjectedInputPenButtons
{
InjectedInputPenButtons_None = 0,
InjectedInputPenButtons_Barrel = 0x1,
InjectedInputPenButtons_Inverted = 0x2,
InjectedInputPenButtons_Eraser = 0x4
} ;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
/* [v1_enum] */
enum InjectedInputPenParameters
{
InjectedInputPenParameters_None = 0,
InjectedInputPenParameters_Pressure = 0x1,
InjectedInputPenParameters_Rotation = 0x2,
InjectedInputPenParameters_TiltX = 0x4,
InjectedInputPenParameters_TiltY = 0x8
} ;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
/* [v1_enum] */
enum InjectedInputPointerOptions
{
InjectedInputPointerOptions_None = 0,
InjectedInputPointerOptions_New = 0x1,
InjectedInputPointerOptions_InRange = 0x2,
InjectedInputPointerOptions_InContact = 0x4,
InjectedInputPointerOptions_FirstButton = 0x10,
InjectedInputPointerOptions_SecondButton = 0x20,
InjectedInputPointerOptions_Primary = 0x2000,
InjectedInputPointerOptions_Confidence = 0x4000,
InjectedInputPointerOptions_Canceled = 0x8000,
InjectedInputPointerOptions_PointerDown = 0x10000,
InjectedInputPointerOptions_Update = 0x20000,
InjectedInputPointerOptions_PointerUp = 0x40000,
InjectedInputPointerOptions_CaptureChanged = 0x200000
} ;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
/* [v1_enum] */
enum InjectedInputShortcut
{
InjectedInputShortcut_Back = 0,
InjectedInputShortcut_Start = 1,
InjectedInputShortcut_Search = 2
} ;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
/* [v1_enum] */
enum InjectedInputTouchParameters
{
InjectedInputTouchParameters_None = 0,
InjectedInputTouchParameters_Contact = 0x1,
InjectedInputTouchParameters_Orientation = 0x2,
InjectedInputTouchParameters_Pressure = 0x4
} ;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
/* [v1_enum] */
enum InjectedInputVisualizationMode
{
InjectedInputVisualizationMode_None = 0,
InjectedInputVisualizationMode_Default = 1,
InjectedInputVisualizationMode_Indirect = 2
} ;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
struct InjectedInputPoint
{
INT32 PositionX;
INT32 PositionY;
} ;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
struct InjectedInputPointerInfo
{
UINT32 PointerId;
InjectedInputPointerOptions PointerOptions;
InjectedInputPoint PixelLocation;
UINT32 TimeOffsetInMilliseconds;
UINT64 PerformanceCount;
} ;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
struct InjectedInputRectangle
{
INT32 Left;
INT32 Top;
INT32 Bottom;
INT32 Right;
} ;
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#endif
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0018_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0018_v0_0_s_ifspec;
#ifndef ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo_INTERFACE_DEFINED__
#define ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo_INTERFACE_DEFINED__
/* interface __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo */
/* [uuid][object] */
/* interface ABI::Windows::UI::Input::Preview::Injection::IInjectedInputKeyboardInfo */
/* [uuid][object] */
EXTERN_C const IID IID___x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo;
#if defined(__cplusplus) && !defined(CINTERFACE)
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
MIDL_INTERFACE("4B46D140-2B6A-5FFA-7EAE-BD077B052ACD")
IInjectedInputKeyboardInfo : public IInspectable
{
public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_KeyOptions(
/* [out][retval] */ __RPC__out ABI::Windows::UI::Input::Preview::Injection::InjectedInputKeyOptions *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_KeyOptions(
/* [in] */ ABI::Windows::UI::Input::Preview::Injection::InjectedInputKeyOptions value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ScanCode(
/* [out][retval] */ __RPC__out UINT16 *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_ScanCode(
/* [in] */ UINT16 value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_VirtualKey(
/* [out][retval] */ __RPC__out UINT16 *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_VirtualKey(
/* [in] */ UINT16 value) = 0;
};
extern const __declspec(selectany) IID & IID_IInjectedInputKeyboardInfo = __uuidof(IInjectedInputKeyboardInfo);
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#else /* C style interface */
typedef struct __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfoVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_KeyOptions )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo * This,
/* [out][retval] */ __RPC__out __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputKeyOptions *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_KeyOptions )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo * This,
/* [in] */ __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputKeyOptions value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ScanCode )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo * This,
/* [out][retval] */ __RPC__out UINT16 *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_ScanCode )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo * This,
/* [in] */ UINT16 value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_VirtualKey )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo * This,
/* [out][retval] */ __RPC__out UINT16 *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_VirtualKey )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo * This,
/* [in] */ UINT16 value);
END_INTERFACE
} __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfoVtbl;
interface __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo
{
CONST_VTBL struct __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfoVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo_get_KeyOptions(This,value) \
( (This)->lpVtbl -> get_KeyOptions(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo_put_KeyOptions(This,value) \
( (This)->lpVtbl -> put_KeyOptions(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo_get_ScanCode(This,value) \
( (This)->lpVtbl -> get_ScanCode(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo_put_ScanCode(This,value) \
( (This)->lpVtbl -> put_ScanCode(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo_get_VirtualKey(This,value) \
( (This)->lpVtbl -> get_VirtualKey(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo_put_VirtualKey(This,value) \
( (This)->lpVtbl -> put_VirtualKey(This,value) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputKeyboardInfo_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0019 */
/* [local] */
#if !defined(____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_INTERFACE_DEFINED__)
extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_Windows_UI_Input_Preview_Injection_IInjectedInputMouseInfo[] = L"Windows.UI.Input.Preview.Injection.IInjectedInputMouseInfo";
#endif /* !defined(____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_INTERFACE_DEFINED__) */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0019 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0019_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0019_v0_0_s_ifspec;
#ifndef ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_INTERFACE_DEFINED__
#define ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_INTERFACE_DEFINED__
/* interface __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo */
/* [uuid][object] */
/* interface ABI::Windows::UI::Input::Preview::Injection::IInjectedInputMouseInfo */
/* [uuid][object] */
EXTERN_C const IID IID___x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo;
#if defined(__cplusplus) && !defined(CINTERFACE)
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
MIDL_INTERFACE("96F56E6B-E47A-5CF4-418D-8A5FB9670C7D")
IInjectedInputMouseInfo : public IInspectable
{
public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MouseOptions(
/* [out][retval] */ __RPC__out ABI::Windows::UI::Input::Preview::Injection::InjectedInputMouseOptions *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_MouseOptions(
/* [in] */ ABI::Windows::UI::Input::Preview::Injection::InjectedInputMouseOptions value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MouseData(
/* [out][retval] */ __RPC__out UINT32 *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_MouseData(
/* [in] */ UINT32 value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DeltaY(
/* [out][retval] */ __RPC__out INT32 *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_DeltaY(
/* [in] */ INT32 value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DeltaX(
/* [out][retval] */ __RPC__out INT32 *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_DeltaX(
/* [in] */ INT32 value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TimeOffsetInMilliseconds(
/* [out][retval] */ __RPC__out UINT32 *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_TimeOffsetInMilliseconds(
/* [in] */ UINT32 value) = 0;
};
extern const __declspec(selectany) IID & IID_IInjectedInputMouseInfo = __uuidof(IInjectedInputMouseInfo);
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#else /* C style interface */
typedef struct __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfoVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MouseOptions )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo * This,
/* [out][retval] */ __RPC__out __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputMouseOptions *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_MouseOptions )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo * This,
/* [in] */ __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputMouseOptions value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MouseData )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo * This,
/* [out][retval] */ __RPC__out UINT32 *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_MouseData )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo * This,
/* [in] */ UINT32 value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DeltaY )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo * This,
/* [out][retval] */ __RPC__out INT32 *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_DeltaY )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo * This,
/* [in] */ INT32 value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DeltaX )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo * This,
/* [out][retval] */ __RPC__out INT32 *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_DeltaX )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo * This,
/* [in] */ INT32 value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TimeOffsetInMilliseconds )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo * This,
/* [out][retval] */ __RPC__out UINT32 *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_TimeOffsetInMilliseconds )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo * This,
/* [in] */ UINT32 value);
END_INTERFACE
} __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfoVtbl;
interface __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo
{
CONST_VTBL struct __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfoVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_get_MouseOptions(This,value) \
( (This)->lpVtbl -> get_MouseOptions(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_put_MouseOptions(This,value) \
( (This)->lpVtbl -> put_MouseOptions(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_get_MouseData(This,value) \
( (This)->lpVtbl -> get_MouseData(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_put_MouseData(This,value) \
( (This)->lpVtbl -> put_MouseData(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_get_DeltaY(This,value) \
( (This)->lpVtbl -> get_DeltaY(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_put_DeltaY(This,value) \
( (This)->lpVtbl -> put_DeltaY(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_get_DeltaX(This,value) \
( (This)->lpVtbl -> get_DeltaX(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_put_DeltaX(This,value) \
( (This)->lpVtbl -> put_DeltaX(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_get_TimeOffsetInMilliseconds(This,value) \
( (This)->lpVtbl -> get_TimeOffsetInMilliseconds(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_put_TimeOffsetInMilliseconds(This,value) \
( (This)->lpVtbl -> put_TimeOffsetInMilliseconds(This,value) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputMouseInfo_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0020 */
/* [local] */
#if !defined(____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_INTERFACE_DEFINED__)
extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_Windows_UI_Input_Preview_Injection_IInjectedInputPenInfo[] = L"Windows.UI.Input.Preview.Injection.IInjectedInputPenInfo";
#endif /* !defined(____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_INTERFACE_DEFINED__) */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0020 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0020_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0020_v0_0_s_ifspec;
#ifndef ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_INTERFACE_DEFINED__
#define ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_INTERFACE_DEFINED__
/* interface __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo */
/* [uuid][object] */
/* interface ABI::Windows::UI::Input::Preview::Injection::IInjectedInputPenInfo */
/* [uuid][object] */
EXTERN_C const IID IID___x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo;
#if defined(__cplusplus) && !defined(CINTERFACE)
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
MIDL_INTERFACE("6B40AD03-CA1E-5527-7E02-2828540BB1D4")
IInjectedInputPenInfo : public IInspectable
{
public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PointerInfo(
/* [out][retval] */ __RPC__out ABI::Windows::UI::Input::Preview::Injection::InjectedInputPointerInfo *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_PointerInfo(
/* [in] */ ABI::Windows::UI::Input::Preview::Injection::InjectedInputPointerInfo value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PenButtons(
/* [out][retval] */ __RPC__out ABI::Windows::UI::Input::Preview::Injection::InjectedInputPenButtons *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_PenButtons(
/* [in] */ ABI::Windows::UI::Input::Preview::Injection::InjectedInputPenButtons value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PenParameters(
/* [out][retval] */ __RPC__out ABI::Windows::UI::Input::Preview::Injection::InjectedInputPenParameters *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_PenParameters(
/* [in] */ ABI::Windows::UI::Input::Preview::Injection::InjectedInputPenParameters value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Pressure(
/* [out][retval] */ __RPC__out DOUBLE *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Pressure(
/* [in] */ DOUBLE value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Rotation(
/* [out][retval] */ __RPC__out DOUBLE *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Rotation(
/* [in] */ DOUBLE value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TiltX(
/* [out][retval] */ __RPC__out INT32 *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_TiltX(
/* [in] */ INT32 value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TiltY(
/* [out][retval] */ __RPC__out INT32 *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_TiltY(
/* [in] */ INT32 value) = 0;
};
extern const __declspec(selectany) IID & IID_IInjectedInputPenInfo = __uuidof(IInjectedInputPenInfo);
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#else /* C style interface */
typedef struct __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfoVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PointerInfo )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo * This,
/* [out][retval] */ __RPC__out __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPointerInfo *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_PointerInfo )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo * This,
/* [in] */ __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPointerInfo value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PenButtons )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo * This,
/* [out][retval] */ __RPC__out __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPenButtons *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_PenButtons )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo * This,
/* [in] */ __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPenButtons value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PenParameters )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo * This,
/* [out][retval] */ __RPC__out __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPenParameters *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_PenParameters )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo * This,
/* [in] */ __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPenParameters value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Pressure )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo * This,
/* [out][retval] */ __RPC__out DOUBLE *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Pressure )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo * This,
/* [in] */ DOUBLE value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Rotation )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo * This,
/* [out][retval] */ __RPC__out DOUBLE *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Rotation )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo * This,
/* [in] */ DOUBLE value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TiltX )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo * This,
/* [out][retval] */ __RPC__out INT32 *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_TiltX )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo * This,
/* [in] */ INT32 value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TiltY )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo * This,
/* [out][retval] */ __RPC__out INT32 *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_TiltY )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo * This,
/* [in] */ INT32 value);
END_INTERFACE
} __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfoVtbl;
interface __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo
{
CONST_VTBL struct __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfoVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_get_PointerInfo(This,value) \
( (This)->lpVtbl -> get_PointerInfo(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_put_PointerInfo(This,value) \
( (This)->lpVtbl -> put_PointerInfo(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_get_PenButtons(This,value) \
( (This)->lpVtbl -> get_PenButtons(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_put_PenButtons(This,value) \
( (This)->lpVtbl -> put_PenButtons(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_get_PenParameters(This,value) \
( (This)->lpVtbl -> get_PenParameters(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_put_PenParameters(This,value) \
( (This)->lpVtbl -> put_PenParameters(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_get_Pressure(This,value) \
( (This)->lpVtbl -> get_Pressure(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_put_Pressure(This,value) \
( (This)->lpVtbl -> put_Pressure(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_get_Rotation(This,value) \
( (This)->lpVtbl -> get_Rotation(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_put_Rotation(This,value) \
( (This)->lpVtbl -> put_Rotation(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_get_TiltX(This,value) \
( (This)->lpVtbl -> get_TiltX(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_put_TiltX(This,value) \
( (This)->lpVtbl -> put_TiltX(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_get_TiltY(This,value) \
( (This)->lpVtbl -> get_TiltY(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_put_TiltY(This,value) \
( (This)->lpVtbl -> put_TiltY(This,value) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0021 */
/* [local] */
#if !defined(____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_INTERFACE_DEFINED__)
extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_Windows_UI_Input_Preview_Injection_IInjectedInputTouchInfo[] = L"Windows.UI.Input.Preview.Injection.IInjectedInputTouchInfo";
#endif /* !defined(____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_INTERFACE_DEFINED__) */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0021 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0021_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0021_v0_0_s_ifspec;
#ifndef ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_INTERFACE_DEFINED__
#define ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_INTERFACE_DEFINED__
/* interface __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo */
/* [uuid][object] */
/* interface ABI::Windows::UI::Input::Preview::Injection::IInjectedInputTouchInfo */
/* [uuid][object] */
EXTERN_C const IID IID___x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo;
#if defined(__cplusplus) && !defined(CINTERFACE)
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
MIDL_INTERFACE("224FD1DF-43E8-5EF5-510A-69CA8C9B4C28")
IInjectedInputTouchInfo : public IInspectable
{
public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Contact(
/* [out][retval] */ __RPC__out ABI::Windows::UI::Input::Preview::Injection::InjectedInputRectangle *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Contact(
/* [in] */ ABI::Windows::UI::Input::Preview::Injection::InjectedInputRectangle value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Orientation(
/* [out][retval] */ __RPC__out INT32 *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Orientation(
/* [in] */ INT32 value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PointerInfo(
/* [out][retval] */ __RPC__out ABI::Windows::UI::Input::Preview::Injection::InjectedInputPointerInfo *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_PointerInfo(
/* [in] */ ABI::Windows::UI::Input::Preview::Injection::InjectedInputPointerInfo value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Pressure(
/* [out][retval] */ __RPC__out DOUBLE *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Pressure(
/* [in] */ DOUBLE value) = 0;
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TouchParameters(
/* [out][retval] */ __RPC__out ABI::Windows::UI::Input::Preview::Injection::InjectedInputTouchParameters *value) = 0;
virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_TouchParameters(
/* [in] */ ABI::Windows::UI::Input::Preview::Injection::InjectedInputTouchParameters value) = 0;
};
extern const __declspec(selectany) IID & IID_IInjectedInputTouchInfo = __uuidof(IInjectedInputTouchInfo);
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#else /* C style interface */
typedef struct __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfoVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Contact )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo * This,
/* [out][retval] */ __RPC__out __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputRectangle *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Contact )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo * This,
/* [in] */ __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputRectangle value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Orientation )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo * This,
/* [out][retval] */ __RPC__out INT32 *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Orientation )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo * This,
/* [in] */ INT32 value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PointerInfo )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo * This,
/* [out][retval] */ __RPC__out __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPointerInfo *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_PointerInfo )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo * This,
/* [in] */ __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputPointerInfo value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Pressure )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo * This,
/* [out][retval] */ __RPC__out DOUBLE *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Pressure )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo * This,
/* [in] */ DOUBLE value);
/* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TouchParameters )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo * This,
/* [out][retval] */ __RPC__out __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputTouchParameters *value);
/* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_TouchParameters )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo * This,
/* [in] */ __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputTouchParameters value);
END_INTERFACE
} __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfoVtbl;
interface __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo
{
CONST_VTBL struct __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfoVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_get_Contact(This,value) \
( (This)->lpVtbl -> get_Contact(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_put_Contact(This,value) \
( (This)->lpVtbl -> put_Contact(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_get_Orientation(This,value) \
( (This)->lpVtbl -> get_Orientation(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_put_Orientation(This,value) \
( (This)->lpVtbl -> put_Orientation(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_get_PointerInfo(This,value) \
( (This)->lpVtbl -> get_PointerInfo(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_put_PointerInfo(This,value) \
( (This)->lpVtbl -> put_PointerInfo(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_get_Pressure(This,value) \
( (This)->lpVtbl -> get_Pressure(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_put_Pressure(This,value) \
( (This)->lpVtbl -> put_Pressure(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_get_TouchParameters(This,value) \
( (This)->lpVtbl -> get_TouchParameters(This,value) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_put_TouchParameters(This,value) \
( (This)->lpVtbl -> put_TouchParameters(This,value) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputTouchInfo_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0022 */
/* [local] */
#if !defined(____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_INTERFACE_DEFINED__)
extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_Windows_UI_Input_Preview_Injection_IInputInjector[] = L"Windows.UI.Input.Preview.Injection.IInputInjector";
#endif /* !defined(____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_INTERFACE_DEFINED__) */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0022 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0022_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0022_v0_0_s_ifspec;
#ifndef ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_INTERFACE_DEFINED__
#define ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_INTERFACE_DEFINED__
/* interface __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector */
/* [uuid][object] */
/* interface ABI::Windows::UI::Input::Preview::Injection::IInputInjector */
/* [uuid][object] */
EXTERN_C const IID IID___x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector;
#if defined(__cplusplus) && !defined(CINTERFACE)
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
MIDL_INTERFACE("8EC26F84-0B02-4BD2-AD7A-3D4658BE3E18")
IInputInjector : public IInspectable
{
public:
virtual HRESULT STDMETHODCALLTYPE InjectKeyboardInput(
/* [in] */ __RPC__in_opt __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo *input) = 0;
virtual HRESULT STDMETHODCALLTYPE InjectMouseInput(
/* [in] */ __RPC__in_opt __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo *input) = 0;
virtual HRESULT STDMETHODCALLTYPE InitializeTouchInjection(
/* [in] */ ABI::Windows::UI::Input::Preview::Injection::InjectedInputVisualizationMode visualMode) = 0;
virtual HRESULT STDMETHODCALLTYPE InjectTouchInput(
/* [in] */ __RPC__in_opt __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo *input) = 0;
virtual HRESULT STDMETHODCALLTYPE UninitializeTouchInjection( void) = 0;
virtual HRESULT STDMETHODCALLTYPE InitializePenInjection(
/* [in] */ ABI::Windows::UI::Input::Preview::Injection::InjectedInputVisualizationMode visualMode) = 0;
virtual HRESULT STDMETHODCALLTYPE InjectPenInput(
/* [in] */ __RPC__in_opt ABI::Windows::UI::Input::Preview::Injection::IInjectedInputPenInfo *input) = 0;
virtual HRESULT STDMETHODCALLTYPE UninitializePenInjection( void) = 0;
virtual HRESULT STDMETHODCALLTYPE InjectShortcut(
/* [in] */ ABI::Windows::UI::Input::Preview::Injection::InjectedInputShortcut shortcut) = 0;
};
extern const __declspec(selectany) IID & IID_IInputInjector = __uuidof(IInputInjector);
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#else /* C style interface */
typedef struct __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
HRESULT ( STDMETHODCALLTYPE *InjectKeyboardInput )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector * This,
/* [in] */ __RPC__in_opt __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputKeyboardInfo *input);
HRESULT ( STDMETHODCALLTYPE *InjectMouseInput )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector * This,
/* [in] */ __RPC__in_opt __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputMouseInfo *input);
HRESULT ( STDMETHODCALLTYPE *InitializeTouchInjection )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector * This,
/* [in] */ __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputVisualizationMode visualMode);
HRESULT ( STDMETHODCALLTYPE *InjectTouchInput )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector * This,
/* [in] */ __RPC__in_opt __FIIterable_1_Windows__CUI__CInput__CPreview__CInjection__CInjectedInputTouchInfo *input);
HRESULT ( STDMETHODCALLTYPE *UninitializeTouchInjection )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector * This);
HRESULT ( STDMETHODCALLTYPE *InitializePenInjection )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector * This,
/* [in] */ __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputVisualizationMode visualMode);
HRESULT ( STDMETHODCALLTYPE *InjectPenInput )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector * This,
/* [in] */ __RPC__in_opt __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInjectedInputPenInfo *input);
HRESULT ( STDMETHODCALLTYPE *UninitializePenInjection )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector * This);
HRESULT ( STDMETHODCALLTYPE *InjectShortcut )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector * This,
/* [in] */ __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CInjectedInputShortcut shortcut);
END_INTERFACE
} __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorVtbl;
interface __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector
{
CONST_VTBL struct __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_InjectKeyboardInput(This,input) \
( (This)->lpVtbl -> InjectKeyboardInput(This,input) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_InjectMouseInput(This,input) \
( (This)->lpVtbl -> InjectMouseInput(This,input) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_InitializeTouchInjection(This,visualMode) \
( (This)->lpVtbl -> InitializeTouchInjection(This,visualMode) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_InjectTouchInput(This,input) \
( (This)->lpVtbl -> InjectTouchInput(This,input) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_UninitializeTouchInjection(This) \
( (This)->lpVtbl -> UninitializeTouchInjection(This) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_InitializePenInjection(This,visualMode) \
( (This)->lpVtbl -> InitializePenInjection(This,visualMode) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_InjectPenInput(This,input) \
( (This)->lpVtbl -> InjectPenInput(This,input) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_UninitializePenInjection(This) \
( (This)->lpVtbl -> UninitializePenInjection(This) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_InjectShortcut(This,shortcut) \
( (This)->lpVtbl -> InjectShortcut(This,shortcut) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0023 */
/* [local] */
#if !defined(____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics_INTERFACE_DEFINED__)
extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_Windows_UI_Input_Preview_Injection_IInputInjectorStatics[] = L"Windows.UI.Input.Preview.Injection.IInputInjectorStatics";
#endif /* !defined(____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics_INTERFACE_DEFINED__) */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0023 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0023_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0023_v0_0_s_ifspec;
#ifndef ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics_INTERFACE_DEFINED__
#define ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics_INTERFACE_DEFINED__
/* interface __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics */
/* [uuid][object] */
/* interface ABI::Windows::UI::Input::Preview::Injection::IInputInjectorStatics */
/* [uuid][object] */
EXTERN_C const IID IID___x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics;
#if defined(__cplusplus) && !defined(CINTERFACE)
} /* end extern "C" */
namespace ABI {
namespace Windows {
namespace UI {
namespace Input {
namespace Preview {
namespace Injection {
MIDL_INTERFACE("DEAE6943-7402-4141-A5C6-0C01AA57B16A")
IInputInjectorStatics : public IInspectable
{
public:
virtual HRESULT STDMETHODCALLTYPE TryCreate(
/* [out][retval] */ __RPC__deref_out_opt ABI::Windows::UI::Input::Preview::Injection::IInputInjector **instance) = 0;
};
extern const __declspec(selectany) IID & IID_IInputInjectorStatics = __uuidof(IInputInjectorStatics);
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
} /* end namespace */
extern "C" {
#else /* C style interface */
typedef struct __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStaticsVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics * This);
HRESULT ( STDMETHODCALLTYPE *GetIids )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics * This,
/* [out] */ __RPC__out ULONG *iidCount,
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID **iids);
HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics * This,
/* [out] */ __RPC__deref_out_opt HSTRING *className);
HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics * This,
/* [out] */ __RPC__out TrustLevel *trustLevel);
HRESULT ( STDMETHODCALLTYPE *TryCreate )(
__RPC__in __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics * This,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjector **instance);
END_INTERFACE
} __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStaticsVtbl;
interface __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics
{
CONST_VTBL struct __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStaticsVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics_GetIids(This,iidCount,iids) \
( (This)->lpVtbl -> GetIids(This,iidCount,iids) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics_GetRuntimeClassName(This,className) \
( (This)->lpVtbl -> GetRuntimeClassName(This,className) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics_GetTrustLevel(This,trustLevel) \
( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) )
#define __x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics_TryCreate(This,instance) \
( (This)->lpVtbl -> TryCreate(This,instance) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* ____x_ABI_CWindows_CUI_CInput_CPreview_CInjection_CIInputInjectorStatics_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0024 */
/* [local] */
#ifndef RUNTIMECLASS_Windows_UI_Input_Preview_Injection_InjectedInputKeyboardInfo_DEFINED
#define RUNTIMECLASS_Windows_UI_Input_Preview_Injection_InjectedInputKeyboardInfo_DEFINED
extern const __declspec(selectany) _Null_terminated_ WCHAR RuntimeClass_Windows_UI_Input_Preview_Injection_InjectedInputKeyboardInfo[] = L"Windows.UI.Input.Preview.Injection.InjectedInputKeyboardInfo";
#endif
#ifndef RUNTIMECLASS_Windows_UI_Input_Preview_Injection_InjectedInputMouseInfo_DEFINED
#define RUNTIMECLASS_Windows_UI_Input_Preview_Injection_InjectedInputMouseInfo_DEFINED
extern const __declspec(selectany) _Null_terminated_ WCHAR RuntimeClass_Windows_UI_Input_Preview_Injection_InjectedInputMouseInfo[] = L"Windows.UI.Input.Preview.Injection.InjectedInputMouseInfo";
#endif
#ifndef RUNTIMECLASS_Windows_UI_Input_Preview_Injection_InjectedInputPenInfo_DEFINED
#define RUNTIMECLASS_Windows_UI_Input_Preview_Injection_InjectedInputPenInfo_DEFINED
extern const __declspec(selectany) _Null_terminated_ WCHAR RuntimeClass_Windows_UI_Input_Preview_Injection_InjectedInputPenInfo[] = L"Windows.UI.Input.Preview.Injection.InjectedInputPenInfo";
#endif
#ifndef RUNTIMECLASS_Windows_UI_Input_Preview_Injection_InjectedInputTouchInfo_DEFINED
#define RUNTIMECLASS_Windows_UI_Input_Preview_Injection_InjectedInputTouchInfo_DEFINED
extern const __declspec(selectany) _Null_terminated_ WCHAR RuntimeClass_Windows_UI_Input_Preview_Injection_InjectedInputTouchInfo[] = L"Windows.UI.Input.Preview.Injection.InjectedInputTouchInfo";
#endif
#ifndef RUNTIMECLASS_Windows_UI_Input_Preview_Injection_InputInjector_DEFINED
#define RUNTIMECLASS_Windows_UI_Input_Preview_Injection_InputInjector_DEFINED
extern const __declspec(selectany) _Null_terminated_ WCHAR RuntimeClass_Windows_UI_Input_Preview_Injection_InputInjector[] = L"Windows.UI.Input.Preview.Injection.InputInjector";
#endif
/* interface __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0024 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0024_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_windows2Eui2Einput2Epreview2Einjection_0000_0024_v0_0_s_ifspec;
/* Additional Prototypes for ALL interfaces */
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif
| 42.088125 | 299 | 0.709658 | [
"object"
] |
f85f12768f61d69d74dd2cd9944c4b00f4717fc1 | 11,743 | h | C | Engine/Plugins/GameWorks/Blast/Source/Blast/Public/extensions/authoring/include/NvBlastExtAuthoring.h | windystrife/UnrealEngine_NVIDIAGameWork | b50e6338a7c5b26374d66306ebc7807541ff815e | [
"MIT"
] | 10 | 2018-01-16T16:18:42.000Z | 2019-02-19T19:51:45.000Z | Engine/Plugins/GameWorks/Blast/Source/Blast/Public/extensions/authoring/include/NvBlastExtAuthoring.h | windystrife/UnrealEngine_NVIDIAGameWork | b50e6338a7c5b26374d66306ebc7807541ff815e | [
"MIT"
] | 136 | 2018-05-10T08:47:58.000Z | 2018-06-15T09:38:10.000Z | Engine/Plugins/GameWorks/Blast/Source/Blast/Public/extensions/authoring/include/NvBlastExtAuthoring.h | windystrife/UnrealEngine_NVIDIAGameWork | b50e6338a7c5b26374d66306ebc7807541ff815e | [
"MIT"
] | 1 | 2018-06-04T17:18:40.000Z | 2018-06-04T17:18:40.000Z | // This code contains NVIDIA Confidential Information and is disclosed to you
// under a form of NVIDIA software license agreement provided separately to you.
//
// Notice
// NVIDIA Corporation and its licensors retain all intellectual property and
// proprietary rights in and to this software and related documentation and
// any modifications thereto. Any use, reproduction, disclosure, or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA Corporation is strictly prohibited.
//
// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
//
// Information and code furnished is believed to be accurate and reliable.
// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
// information or for any infringement of patents or other rights of third parties that may
// result from its use. No license is granted by implication or otherwise under any patent
// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
// This code supersedes and replaces all information previously supplied.
// NVIDIA Corporation products are not authorized for use as critical
// components in life support devices or systems without express written approval of
// NVIDIA Corporation.
//
// Copyright (c) 2016-2018 NVIDIA Corporation. All rights reserved.
#ifndef NVBLASTAUTHORING_H
#define NVBLASTAUTHORING_H
#include "NvBlastExtAuthoringTypes.h"
namespace physx
{
class PxCooking;
class PxPhysicsInsertionCallback;
}
namespace Nv
{
namespace Blast
{
class Mesh;
class VoronoiSitesGenerator;
class CutoutSet;
class FractureTool;
class ConvexMeshBuilder;
class BlastBondGenerator;
class MeshCleaner;
struct CollisionParams;
struct CollisionHull;
}
}
struct NvBlastExtAssetUtilsBondDesc;
/**
Constructs mesh object from array of triangles.
User should call release() after usage.
\param[in] positions Array for vertex positions, 3 * verticesCount floats will be read
\param[in] normals Array for vertex normals, 3 * verticesCount floats will be read
\param[in] uv Array for vertex uv coordinates, 2 * verticesCount floats will be read
\param[in] verticesCount Number of vertices in mesh
\param[in] indices Array of vertex indices. Indices contain vertex index triplets which form a mesh triangle.
\param[in] indicesCount Indices count (should be equal to numberOfTriangles * 3)
\return pointer to Nv::Blast::Mesh if it was created succefully otherwise return nullptr
*/
NVBLAST_API Nv::Blast::Mesh* NvBlastExtAuthoringCreateMesh(const physx::PxVec3* positions, const physx::PxVec3* normals,
const physx::PxVec2* uv, uint32_t verticesCount, const uint32_t* indices, uint32_t indicesCount);
/**
Constructs mesh object from array of vertices, edges and facets.
User should call release() after usage.
\param[in] vertices Array for Nv::Blast::Vertex
\param[in] edges Array for Nv::Blast::Edge
\param[in] facets Array for Nv::Blast::Facet
\param[in] verticesCount Number of vertices in mesh
\param[in] edgesCount Number of edges in mesh
\param[in] facetsCount Number of facets in mesh
\return pointer to Nv::Blast::Mesh if it was created succefully otherwise return nullptr
*/
NVBLAST_API Nv::Blast::Mesh* NvBlastExtAuthoringCreateMeshFromFacets(const void* vertices, const void* edges, const void* facets,
uint32_t verticesCount, uint32_t edgesCount, uint32_t facetsCount);
/**
Voronoi sites should not be generated outside of the fractured mesh, so VoronoiSitesGenerator
should be supplied with fracture mesh.
\param[in] mesh Fracture mesh
\param[in] rnd User supplied random value generator.
\return Pointer to VoronoiSitesGenerator. User's code should release it after usage.
*/
NVBLAST_API Nv::Blast::VoronoiSitesGenerator* NvBlastExtAuthoringCreateVoronoiSitesGenerator(Nv::Blast::Mesh* mesh,
Nv::Blast::RandomGeneratorBase* rng);
/** Instantiates a blank CutoutSet */
NVBLAST_API Nv::Blast::CutoutSet* NvBlastExtAuthoringCreateCutoutSet();
/**
Builds a cutout set (which must have been initially created by createCutoutSet()).
Uses a bitmap described by pixelBuffer, bufferWidth, and bufferHeight. Each pixel is represented
by one byte in the buffer.
\param cutoutSet the CutoutSet to build
\param pixelBuffer pointer to be beginning of the pixel buffer
\param bufferWidth the width of the buffer in pixels
\param bufferHeight the height of the buffer in pixels
\param segmentationErrorThreshold Reduce the number of vertices on curve untill segmentation error is smaller then specified. By default set it to 0.001.
\param snapThreshold the pixel distance at which neighboring cutout vertices and segments may be fudged into alignment. By default set it to 1.
\param periodic whether or not to use periodic boundary conditions when creating cutouts from the map
\param expandGaps expand cutout regions to gaps or keep it as is
*/
NVBLAST_API void NvBlastExtAuthoringBuildCutoutSet(Nv::Blast::CutoutSet& cutoutSet, const uint8_t* pixelBuffer,
uint32_t bufferWidth, uint32_t bufferHeight, float segmentationErrorThreshold, float snapThreshold, bool periodic, bool expandGaps);
/**
Create FractureTool object.
\return Pointer to create FractureTool. User's code should release it after usage.
*/
NVBLAST_API Nv::Blast::FractureTool* NvBlastExtAuthoringCreateFractureTool();
/**
Create BlastBondGenerator
\return Pointer to created BlastBondGenerator. User's code should release it after usage.
*/
NVBLAST_API Nv::Blast::BlastBondGenerator* NvBlastExtAuthoringCreateBondGenerator(physx::PxCooking* cooking,
physx::PxPhysicsInsertionCallback* insertionCallback);
/**
Create ConvexMeshBuilder
\return Pointer to created ConvexMeshBuilder. User's code should release it after usage.
*/
NVBLAST_API Nv::Blast::ConvexMeshBuilder* NvBlastExtAuthoringCreateConvexMeshBuilder(physx::PxCooking* cooking,
physx::PxPhysicsInsertionCallback* insertionCallback);
/**
Transforms collision hull in place using scale, rotation, transform.
\param[in, out] hull Pointer to the hull to be transformed (modified).
\param[in] scale Pointer to scale to be applied. Can be nullptr.
\param[in] rotation Pointer to rotation to be applied. Can be nullptr.
\param[in] translation Pointer to translation to be applied. Can be nullptr.
*/
NVBLAST_API void NvBlastExtAuthoringTransformCollisionHullInPlace
(
Nv::Blast::CollisionHull* hull,
const physx::PxVec3* scaling,
const physx::PxQuat* rotation,
const physx::PxVec3* translation
);
/**
Transforms collision hull in place using scale, rotation, transform.
\param[in] hull Pointer to the hull to be transformed (modified).
\param[in] scale Pointer to scale to be applied. Can be nullptr.
\param[in] rotation Pointer to rotation to be applied. Can be nullptr.
\param[in] translation Pointer to translation to be applied. Can be nullptr.
*/
NVBLAST_API Nv::Blast::CollisionHull* NvBlastExtAuthoringTransformCollisionHull
(
const Nv::Blast::CollisionHull* hull,
const physx::PxVec3* scaling,
const physx::PxQuat* rotation,
const physx::PxVec3* translation
);
/**
Performs pending fractures and generates fractured asset, render and collision geometry
\param[in] fTool Fracture tool created by NvBlastExtAuthoringCreateFractureTool
\param[in] bondGenerator Bond generator created by NvBlastExtAuthoringCreateBondGenerator
\param[in] collisionBuilder Collision builder created by NvBlastExtAuthoringCreateConvexMeshBuilder
\param[in] defaultSupportDepth All new chunks will be marked as support if its depth equal to defaultSupportDepth.
By default leaves (chunks without children) marked as support.
\param[in] collisionParam Parameters of collision hulls generation.
\return Authoring result
*/
NVBLAST_API Nv::Blast::AuthoringResult* NvBlastExtAuthoringProcessFracture(Nv::Blast::FractureTool& fTool,
Nv::Blast::BlastBondGenerator& bondGenerator, Nv::Blast::ConvexMeshBuilder& collisionBuilder, const Nv::Blast::CollisionParams& collisionParam, int32_t defaultSupportDepth = -1);
/**
Updates graphics mesh only
\param[in] fTool Fracture tool created by NvBlastExtAuthoringCreateFractureTool
\param[out] ares AuthoringResult object which contains chunks, for which rendermeshes will be updated (e.g. to tweak UVs). Initially should be created by NvBlastExtAuthoringProcessFracture.
*/
NVBLAST_API void NvBlastExtAuthoringUpdateGraphicsMesh(Nv::Blast::FractureTool& fTool, Nv::Blast::AuthoringResult& ares);
/**
Build collision meshes
\param[in,out] ares AuthoringResult object which contains chunks, for which collision meshes will be built.
\param[in] collisionBuilder Reference to ConvexMeshBuilder instance.
\param[in] collisionParam Parameters of collision hulls generation.
\param[in] chunksToProcessCount Number of chunk indices in chunksToProcess memory buffer.
\param[in] chunksToProcess Chunk indices for which collision mesh should be built.
*/
NVBLAST_API void NvBlastExtAuthoringBuildCollisionMeshes
(
Nv::Blast::AuthoringResult& ares,
Nv::Blast::ConvexMeshBuilder& collisionBuilder,
const Nv::Blast::CollisionParams& collisionParam,
uint32_t chunksToProcessCount,
uint32_t* chunksToProcess
);
/**
Creates MeshCleaner object
\return pointer to Nv::Blast::Mesh if it was created succefully otherwise return nullptr
*/
NVBLAST_API Nv::Blast::MeshCleaner* NvBlastExtAuthoringCreateMeshCleaner();
/**
Finds bonds connecting chunks in a list of assets
New bond descriptors may be given to bond support chunks from different components.
An NvBlastAsset may appear more than once in the components array.
NOTE: This function allocates memory using the allocator in NvBlastGlobals, to create the new bond
descriptor arrays returned. The user must free this memory after use with NVBLAST_FREE
\param[in] components An array of assets to merge, of size componentCount.
\param[in] scales If not NULL, an array of size componentCount of scales to apply to the geometric data in the chunks and bonds. If NULL, no scaling is applied.
\param[in] rotations If not NULL, an array of size componentCount of rotations to apply to the geometric data in the chunks and bonds. The quaternions MUST be normalized.
If NULL, no rotations are applied.
\param[in] translations If not NULL, an array of of size componentCount of translations to apply to the geometric data in the chunks and bonds. If NULL, no translations are applied.
\param[in] convexHullOffsets For each component, an array of chunkSize+1 specifying the start of the convex hulls for that chunk inside the chunkHulls array for that component.
\param[in] chunkHulls For each component, an array of CollisionHull* specifying the collision geometry for the chunks in that component.
\param[in] componentCount The size of the components and relativeTransforms arrays.
\param[out] newBondDescs Descriptors of type NvBlastExtAssetUtilsBondDesc for new bonds between components.
\param[in] maxSeparation Maximal distance between chunks which can be connected by bond.
\return the number of bonds in newBondDescs
*/
NVBLAST_API uint32_t NvBlastExtAuthoringFindAssetConnectingBonds
(
const NvBlastAsset** components,
const physx::PxVec3* scales,
const physx::PxQuat* rotations,
const physx::PxVec3* translations,
const uint32_t** convexHullOffsets,
const Nv::Blast::CollisionHull*** chunkHulls,
uint32_t componentCount,
NvBlastExtAssetUtilsBondDesc*& newBondDescs,
float maxSeparation = 0.0f
);
#endif // ifndef NVBLASTAUTHORING_H
| 46.232283 | 192 | 0.798348 | [
"mesh",
"geometry",
"render",
"object",
"transform"
] |
f863ad0606bef01813e212391c7df164eca64722 | 1,768 | h | C | phast_gui/base/base_ui_calc.h | stijnhinterding/phast | dad4702eb6401c1eba03ad70eff3659292636d30 | [
"MIT"
] | 1 | 2021-05-22T17:40:51.000Z | 2021-05-22T17:40:51.000Z | phast_gui/base/base_ui_calc.h | stijnhinterding/phast | dad4702eb6401c1eba03ad70eff3659292636d30 | [
"MIT"
] | null | null | null | phast_gui/base/base_ui_calc.h | stijnhinterding/phast | dad4702eb6401c1eba03ad70eff3659292636d30 | [
"MIT"
] | 1 | 2021-03-15T07:09:03.000Z | 2021-03-15T07:09:03.000Z | /* Copyright (c) 2020 Stijn Hinterding, Utrecht University
* This sofware is licensed under the MIT license (see the LICENSE file)
*/
#ifndef BASE_UI_CALC_H
#define BASE_UI_CALC_H
#include "../interfaces/ilistener.h"
#include "../support/detectionupdate.h"
#include "../support/dataview.h"
#include "../support/typedefs.h"
#include "../interfaces/ibinningclass.h"
#include "../support/global.h"
#include <QObject>
#include <mutex>
class TT_EXPORT Base_ui_calc : public QObject, public IListener, public IBinningClass
{
Q_OBJECT
protected:
std::vector<chan_id> chans_to_sum;
opaque_ptr our_ref;
uint64_t bin_width;
bool data_displayed;
std::mutex m;
double time_unit;
private:
bool display_only_initial_data;
void recalc(DetectionUpdate event);
protected:
virtual chan_data_map get_times_to_save(DetectionUpdate event) const = 0;
virtual DataView::data_update arrange_update(DetectionUpdate event, bool rebin_only) = 0;
virtual void ClearData() = 0;
public:
Base_ui_calc(const std::vector<chan_id>& chans_to_sum,
uint64_t bin_width,
opaque_ptr our_ref,
bool display_only_initial_data,
double time_unit);
virtual uint64_t get_bin_width() const override;
// Should return time from which deletion is not allowed yet.
// (all times smaller than this time may be removed)
virtual const chan_data_map NewEvent(ITempDataStorage* sender, DetectionUpdate event) override;
void clear_data();
public slots:
virtual void on_new_bin_width(uint64_t width) override;
signals:
void new_data(DataView::data_update data);
};
#endif // BASE_UI_CALC_H
| 26.787879 | 99 | 0.692873 | [
"vector"
] |
f8679ed6bacc64caa43b2dc0be70936d0c2d623d | 8,836 | h | C | Headers/Renderer.h | xSeditx/MysticEngine | 8480df796e6df32020d48fc5ebb2b9f53690c060 | [
"MIT"
] | 1 | 2019-01-02T08:38:20.000Z | 2019-01-02T08:38:20.000Z | Headers/Renderer.h | xSeditx/MysticEngine | 8480df796e6df32020d48fc5ebb2b9f53690c060 | [
"MIT"
] | null | null | null | Headers/Renderer.h | xSeditx/MysticEngine | 8480df796e6df32020d48fc5ebb2b9f53690c060 | [
"MIT"
] | 1 | 2019-01-01T20:44:40.000Z | 2019-01-01T20:44:40.000Z | #pragma once
#include<vector>
#include"Window.h"
#include "Shader.h"
#include "Camera.h"
#include "FrameBuffer.h"
#include"Texture.h"
//=========================================== DEBUG SWITCHES ==========================================================
#define _TEXTURE_DEBUG 0
#define _UV_DEBUG 0
//====================================================================================================================
#define BUFFER_OFFSET(i) ((char *)NULL + (i))
struct Vertex
{
Vec3 Position;
Vec3 Normals;
Vec2 Uv;
};
//#define __GLBUFFER_FINISHED
enum BufferTypes
{
VERTEX,
COLOR,
NORMAL,
UVCOORD,
TEXTURE,
INDICE
};
//================================================================================================================================================================================================
// GLBuffer needs completion, This will become a Generic buffer class. Possibly typedef out the various buffer types to behave exactly how is currently setup for the multiple buffer types.
//================================================================================================================================================================================================
// TODO: BIGTODO: Make this Buffer class the Default, All buffers should spawn from this eliminating Hundreds of lines as well as abiguity between the buffers. Implementation such as map buffer can be easily realized
class Attribute
{
public:
Attribute() {}
Attribute(BufferTypes t)
{
AttributeType = t;
}
BufferTypes AttributeType;
};
template<class T>
class VertexBufferObject : public Attribute
{
public:
VertexBufferObject() {}
VertexBufferObject(T *data, GLsizei count)
: // Assume Dynamic Draw as the default buffer access
ElementCount(count),
ID(0)
{
Data.resize(count);
Data.insert(Data.begin(), count, *data);
Stride = sizeof(T);
_GL(glGenBuffers(1, &ID));
glBindBuffer(GL_ARRAY_BUFFER, ID);
glBufferData(GL_ARRAY_BUFFER, ElementCount * sizeof(T), data, GL_DYNAMIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
VertexBufferObject(GLenum access, T *data, GLsizei count)
: // Specify default access
ElementCount(count),
ID(0)
{
Data.resize(count);
Data.insert(Data.begin(), count, *data);
Stride = sizeof(T);
_GL(glGenBuffers(1, &ID));
glBindBuffer(GL_ARRAY_BUFFER, ID);
glBufferData(GL_ARRAY_BUFFER, ElementCount * sizeof(T), data, access);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
GLuint ID = 0;
GLuint ElementCount = 0;
GLuint Stride;
void Bind()
{
_GL(glBindBuffer(GL_ARRAY_BUFFER, ID));
}
void Unbind()
{
glBindBuffer(GL_ARRAY_BUFFER, NULL);
}
void Map(GLenum accessflags)
{
glMapBuffer(GL_ARRAY_BUFFER, accessflags);
}
void MapRange(int offset, int count, GLenum accessflags)
{
}
void Release()
{
}
void Destroy()
{
glDeleteBuffer(ID);
}
VertexBufferObject operator = (std::vector<T> data); // Map the whole buffer, resize if needed and make the data of the buffer equal to that of the Rvalue
VertexBufferObject operator = (VertexBufferObject &other) { return other; } // Same but perform a shallow copy of the buffer
VertexBufferObject operator += (VertexBufferObject &data); // Map the buffer and add to the end of it, updating the data, and size while retaining access type and ID
int size() const { return Data.size(); }
protected:
std::vector<T> Data;
};
class VertexArrayObject
{
public:
VertexArrayObject()
{
glGenVertexArrays(1, &VAO);
}
void Bind()
{
glBindVertexArray(VAO);
}
void Unbind()
{
glBindVertexArray(0);
}
template<typename T>
void Attach(BufferTypes bufferT, VertexBufferObject<T> *buffer)
{
Bind();
GLint
Amount = 0,
Attrib = 0;
switch (bufferT)
{
case BufferTypes::VERTEX:
Amount = 3;
buffer->AttributeType = VERTEX;
glBindBuffer(GL_ARRAY_BUFFER, buffer->ID);
Attrib = glGetAttribLocation(Shader::GetActiveShader()->GetName(), "VertexPosition");
Buffers.push_back(*buffer);
break;
case BufferTypes::COLOR:
Amount = 4;
buffer->AttributeType = COLOR;
glBindBuffer(GL_ARRAY_BUFFER, buffer->ID);
Attrib = glGetAttribLocation(Shader::GetActiveShader()->GetName(), "VertexColor");
Buffers.push_back(*buffer);
break;
case BufferTypes::NORMAL:
Amount = 3;
buffer->AttributeType = NORMAL;
glBindBuffer(GL_ARRAY_BUFFER, buffer->ID);
Attrib = glGetAttribLocation(Shader::GetActiveShader()->GetName(), "VertexNormal");
Buffers.push_back(*buffer);
break;
case BufferTypes::UVCOORD:
Amount = 2;
buffer->AttributeType = UVCOORD;
glBindBuffer(GL_ARRAY_BUFFER, buffer->ID);
Attrib = glGetAttribLocation(Shader::GetActiveShader()->GetName(), "TextureCoords");
Buffers.push_back(*buffer);
break;
case BufferTypes::INDICE:
ElementCount = buffer->ElementCount;
buffer->AttributeType = INDICE;
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer->ID);
Buffers.push_back(*buffer);
return; // If its Indices we have done what we need to already in binding the VAO than the IndexBuffer. Exit before attempts at Enabling Attributes take place.
break;
}
glEnableVertexAttribArray(Attrib);
glVertexAttribPointer(Attrib, Amount, GL_FLOAT, GL_FALSE, 0, (char *)NULL);
}
GLuint VAO;
int ElementCount;
std::vector<Attribute> Buffers;
};
/*
TODO: THIS WILL BE UPDATED TO PERFORM BATCHING OPERATIONS AS MUCH AS POSSIBLE AS THE ENGINE WILL LOG ALL DRAW CALLS AND DECIDE THE ORDERS TO PERFORM THEM IN
static class DrawCall
{
DrawCall(int elementcount, GL_UNSIGNED_INT, nullptr);
void Attach(VAOBuffer *buffer);
void Weave();
void Render();
void glDrawElements(GLenum mode,
GLsizei count,
GLenum type,
const GLvoid * indices);
};*/
// LEFTOVERS FROM FIXED FUNCTION, DELETE SOON AS SURE ITS NOT NEEDED
//#define VERTEX_ATTRIB 0
//#define NORMAL_ATTRIB 1
//#define TEXTURE_ATTRIB 2
//#define COLOR_ATTRIB 3
//
/// look into this https://www.opengl.org/discussion_boards/showthread.php/155504-Render-to-Texture-vs-CopyTexSubImage
// CONVERT THIS NAME TO SOMETHING LIKE IMAGE SINCE IT DOES NOT MAKE A TEXTURE BUT INSTEAD LOADS AN IMAGE
// THE TEXTUREBUFFER SHOULD EITHER BECOME TEXTURE OR PROB EVEN BETTER CALLED UV_BUFFER OR SOMETHING AND HAVE
// A TEXTURE CLASS WHICH IS ITSELF A COMBINATION OF THE IMAGE AND THE TEXTURE COORDS SO THAT THEY CAN BE LOADED
// AND UNLOADED AT THE SAME TIME OR SEPERATELY AS NEEDED.
//-------------------------------------------------------------
// ADD ALL VARIOUS BUFFERS TO A SINGLE BUFFER VERTEX, INDEX, COLOR, TEXTURE, NORMALS etc...
// Into a single Buffer for their type, Bind each buffer than call Draw Instances
//-----------------------
//1. Uniform Buffer Objects
//2. Texture Buffer Objects
//3. Instanced_arrays_ARB
//===================================================================================================================
//___________________________________________________________________________________________________________________
//1. pbuffer extension initialization
//2. pbuffer creation
//3. pbuffer binding
//4. pbuffer destruction.
// Obsolete but still might make a class to manage it just incase
//1. pbuffer extension initialization
//2. pbuffer creation
//3. pbuffer binding
//4. pbuffer destruction.
//__________________________________________________________________________________________________________________________________________________
//==================================================================================================================================================
// __forceinline void myInlineFunc() __attribute__((always_inline));
//======================================================================================================================================================================================
// SHADER CLASS
//======================================================================================================================================================================================
// TODO: NEED A SHADER PARSER SO FRAGMENT AND VERTEX SHADER ARE THE SAME FILE
// Merge the two after ALL debugging is handled
//GLuint Shader::VertexLocation = 0;
//GLuint Shader::ColorsLocation = 0;
//GLuint Shader::NormalsLocation = 0;
| 28.781759 | 217 | 0.580466 | [
"render",
"vector"
] |
f86dd1da0c6ae0d56dfe0e27da81104b8afa327d | 38,764 | h | C | Pods/BlackBerryDynamics/Frameworks/BlackBerryDynamics.xcframework/ios-x86_64-simulator/BlackBerryDynamics.framework/Headers/GD_C/GD_C_FileSystem.h | Swyft/AppKinetics-Client | 941dc624141cd534819885259c19ac357bb18b61 | [
"Apache-2.0"
] | null | null | null | Pods/BlackBerryDynamics/Frameworks/BlackBerryDynamics.xcframework/ios-x86_64-simulator/BlackBerryDynamics.framework/Headers/GD_C/GD_C_FileSystem.h | Swyft/AppKinetics-Client | 941dc624141cd534819885259c19ac357bb18b61 | [
"Apache-2.0"
] | null | null | null | Pods/BlackBerryDynamics/Frameworks/BlackBerryDynamics.xcframework/ios-x86_64-simulator/BlackBerryDynamics.framework/Headers/GD_C/GD_C_FileSystem.h | Swyft/AppKinetics-Client | 941dc624141cd534819885259c19ac357bb18b61 | [
"Apache-2.0"
] | null | null | null | /*
* (c) 2016 Good Technology Corporation. All rights reserved.
*/
#ifndef GD_C_FILESYSTEM_H
#define GD_C_FILESYSTEM_H
#include <stddef.h>
#include <stdarg.h>
#include <stdio.h>
#include <sys/stat.h>
/** \addtogroup capilist
* @{
*/
/** C API file structure, for accessing secure storage.
*
*/
typedef size_t GD_FILE;
/** C API directory structure, for accessing secure storage.
*
*/
typedef size_t GD_DIR;
/** @}
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef GD_C_API
# if !defined(_WIN32)
# define GD_C_API __attribute__((visibility("default")))
# else
# define GD_C_API
# endif
#endif
#ifndef GD_C_API_EXT
# define GD_C_API_EXT
#endif
#if defined(_WIN32)
# define GD_ATTRIBUTE(ignore)
#else
# define GD_ATTRIBUTE __attribute__
#endif
/** \addtogroup capilist
* @{
*/
/** Open a file that is in the secure store, for reading or writing.
* Call this function to open a file in the secure store for reading or writing.
* Files in the secure store are encrypted on the device; this
* function provides access to decrypted data.
*
* @param filename <tt>const char*</tt> pointer to a C string containing the
* path, within the secure store, that represents the file to be
* opened.
*
* @param mode <tt>const char*</tt> pointer to a C string of the mode. The
* values are analogous to the standard C call <tt>fopen</tt> and
* can be:
* - write <tt>"w"</tt>
* - read <tt>"r"</tt>
* - append <tt>"a"</tt>
* .
* Note that the "+" qualifier is supported for opening a file for
* both reading and writing.\n
* The "b" and "t" qualifiers aren't supported.
*
* @return <tt>GD_FILE*</tt> object pointer (analogous to the FILE* file pointer
* returned from <tt>fopen</tt>) which can be used for
* subsequent file access, or <tt>NULL</tt> if the
* file could not be opened or created.
*/
GD_C_API GD_FILE* GD_fopen(const char* filename, const char* mode);
/** Close a file that was previously opened.
* Call this function to close a file that was previously opened by a call to GD_fopen.
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous call to <tt>GD_fopen</tt>.\n
*
* Note that this should always be called when file access is no longer required. It also forces a flush
* of any uncommitted write operation.
*
* @return <tt>int</tt> 0 if successful, EOF otherwise
*
*/
GD_C_API int GD_fclose(GD_FILE* filePointer);
/** Read from a file that is in the secure store, previously opened in read mode
* with <tt>GD_fopen</tt>.
* Call this function to read a file in the secure store previously opened with
* <tt>GD_open</tt> in a read mode such as "r" or "w+".
*
* @param ptr <tt>void*</tt> pointer to a buffer to receive the read data.
*
* @param size <tt>size_t</tt> size of the data block.
*
* @param count <tt>size_t</tt> number of data blocks.
*
* @param filePointer <tt>GD_FILE*</tt> a pointer to a valid GD_FILE* object.
*
* (Note that the underlying library simply reads size * count bytes from the
* secure file system.)
*
* @return <tt>size_t</tt> The total number of elements successfully read is
* returned. If this number differs from the count
* parameter, either a reading error occurred or the
* end-of-file was reached while reading. In both cases,
* the proper indicator is set, which can be checked
* with <tt>ferror</tt> and <tt>feof</tt>, respectively.
* If either size or count is zero, the function returns
* zero and both the stream state and the content
* pointed by ptr remain unchanged.\n
* <tt>size_t</tt> is an unsigned integral type.
*
*/
GD_C_API size_t GD_fread(void* ptr, size_t size, size_t count, GD_FILE* filePointer);
/** Write to a file that is in the secure store, previously opened in write mode
* with <tt>GD_fopen</tt>.
* Call this function to read a file in the secure store previously opened with
* <tt>GD_open</tt> in a read mode such as "w" or "r+".
*
* @param ptr <tt>void*</tt> pointer to a buffer containing the data to be written
*
* @param size <tt>size_t</tt> size of the data block.
*
* @param count <tt>size_t</tt> number of data blocks
*
* @param filePointer <tt>GD_FILE*</tt> a pointer to a valid GD_FILE* object
*
* (Note that the underlying library simply writes size * count bytes to the
* encrypted file system.)
*
* @return <tt>size_t</tt> The total number of elements successfully written is
* returned. If this number differs from the count
* parameter, a writing error prevented the function
* from completing. In this case, the error indicator
* (<tt>ferror</tt>) will be set for the stream. If
* either size or count is zero, the function returns
* zero and the error indicator remains unchanged.
* <tt>size_t</tt> is an unsigned integral type.
*
*/
GD_C_API size_t GD_fwrite(const void* ptr, size_t size, size_t count, GD_FILE* filePointer);
/** Delete a file.
* Call this function to delete a file by path.
*
* @param filename <tt>const char*</tt> the path of the field to be deleted.
*
* @return <tt>int</tt> 0 if successful, -1 otherwise.
*/
GD_C_API int GD_remove(const char* filename);
/** Get the current position of the file pointer.
* Call this function obtain the current file pointer position.
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous call to <tt>GD_fopen</tt>.\n
*
* @return <tt>long int</tt> the position of the file pointer or -1 if an error has occurred.
*
*/
GD_C_API long int GD_ftell(GD_FILE* filePointer);
/** Get the current position of the file pointer.
* Call this function obtain the current file pointer position.
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous call to <tt>GD_fopen</tt>.\n
*
* @return <tt>off_t</tt> the position of the file pointer or -1 if an error has occurred.
*
*/
GD_C_API off_t GD_ftello(GD_FILE* filePointer);
/** Set the position of the file pointer.
* Call this function to set the file pointer position.
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous call to <tt>GD_fopen</tt>.\n
*
* @param offset <tt>long int</tt> offset relative to the origin parameter
*
* @param origin <tt>int</tt> one of SEEK_SET, SEEK_CUR, SEEK_END
*
* @return <tt>int</tt> 0 for success or -1 for failure
*
*/
GD_C_API int GD_fseek(GD_FILE* filePointer, long int offset, int origin);
/** Set the position of the file pointer.
* Call this function to set the file pointer position.
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous call to <tt>GD_fopen</tt>.\n
*
* @param offset <tt>off_t</tt> offset relative to the origin parameter
*
* @param origin <tt>int</tt> one of SEEK_SET, SEEK_CUR, SEEK_END
*
* @return <tt>int</tt> 0 for success or -1 for failure
*
*/
GD_C_API int GD_fseeko(GD_FILE* filePointer, off_t offset, int origin);
/** Read formatted data from stream.
* Reads data from the stream and stores them according to the parameter format into the locations pointed by
* the additional arguments. The additional arguments should point to already allocated objects of the type specified
* by their corresponding format specifier (subsequences beginning with %) within the format string.
*
* @param filePointer Pointer to a <tt>GD_FILE</tt> object that identifies an input stream to read data from.
*
* @param format C string that contains a sequence of characters that control how characters extracted from the stream are treated.
*
* @return <tt>int</tt> On success, the function returns the number of items of the argument list successfully filled.
* On error, the function returns EOF and sets the error indicator (ferror).
*/
GD_C_API int GD_fscanf(GD_FILE* filePointer, const char* format, ...) GD_ATTRIBUTE((format(scanf,2,3)));
/** Read formatted data from stream into variable argument list.
* Reads data from the stream and stores them according to parameter format into the locations pointed to by the elements
* in the variable argument list identified by args.
*
* Internally, the function retrieves arguments from the list identified by arg as if va_arg was used on it,
* and thus the state of arg is likely to be altered by the call.
*
* In any case, arg should have been initialized by va_start at some point before the call,
* and it is expected to be released by va_end at some point after the call.
*
* @param filePointer Pointer to a <tt>GD_FILE</tt> object that identifies an input stream.
*
* @param format C string that contains a format string that follows the same specification as scanf (see scanf for details).
*
* @param args A value identifying a variable arguments list initialized with va_start. va_list is a special type defined in <stdarg.h> file.
*
* @return <tt>int</tt> On success, the function returns the number of items of the argument list successfully filled.
* On error, the function returns EOF and sets the error indicator (ferror).
*/
GD_C_API int GD_vfscanf(GD_FILE* filePointer, const char * format, va_list args) GD_ATTRIBUTE((format(scanf,2,0)));
/** Test if the file pointer is at the end of the file.
* Call this function to check if the file pointer is at the end of the file.
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous call to <tt>GD_fopen</tt>.\n
*
* @return <tt>int</tt> non-zero if the end of file indicator is set, otherwise 0
*/
GD_C_API int GD_feof(GD_FILE* filePointer);
/** Generate a unique file name.
* Call this function to check or generate a unique file name
*
* @param str <tt>char*</tt> an array of bytes of at least <tt>L_tmpnam</tt> length to contain the proposed file name. If
* this argument is NULL then an internal static array is used.
*
* @return <tt>char*</tt> a pointer to a unique filename. If the <tt>str</tt> argument is not NULL then the pointer will refer to
* this array otherwise it will point to an internal static array. If the function cannot create a unique filename then NULL is
* returned.
*/
GD_C_API char* GD_tmpnam(char* str);
/** Truncate a file that is in the secure store.
* Call this function to truncate a file in the secure store to a specified length.
* If file was previously larger than the length specified, the file will be truncated and the
* extra data lost. If the file was previously smaller than the length specified, the file will be
* extended and padded with null bytes ('\0').
*
* @param filename <tt>const char*</tt> pointer to a C string containing the path, within the secure store, that
* represents the file to be truncated.
*
* @param length <tt>off_t</tt> in bytes of the file once truncated.
*
* @return <tt>int</tt> 0 for success or -1 for failure
*/
GD_C_API int GD_truncate(const char* filename, off_t length);
/** Truncate a file that is in the secure store.
* Call this function to truncate a file in the secure store to a specified length.
* If file was previously larger than the length specified, the file will be truncated and the extra
* data lost. If the file was previously smaller than the length specified, the file will be
* extended and padded with null bytes ('\0').
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous call to <tt>GD_fopen</tt>.\n
*
* @param length <tt>off_t</tt> in bytes of the file once truncated.
*
* @return <tt>int</tt> 0 for success or -1 for failure
*/
GD_C_API int GD_ftruncate(GD_FILE* filePointer, off_t length);
/** Reopen stream with different file or mode.
* Reuses stream to either open the file specified by filename or to change its access mode.
* If a new filename is specified, the function first attempts to close any file already associated with filePointer
* (third parameter) and disassociates it.
* Then, independently of whether that filePointer was successfuly closed or not,
* freopen opens the file specified by filename and associates it with the filePointer just as fopen would do using the specified mode.
* If filename is a null pointer, the function attempts to change the mode of the filePointer.
* The error indicator and eof indicator are automatically cleared (as if clearerr was called).
*
* @param filename <tt>const char*</tt> C string containing the name of the file to be opened.
*
* @param mode <tt>const char*</tt> pointer to a C string of the mode. The
* values are analogous to the standard C call <tt>fopen</tt> and
* can be:
* - write <tt>"w"</tt>
* - read <tt>"r"</tt>
* - append <tt>"a"</tt>
* .
* Note that the "+" qualifier is supported for opening a file for
* both reading and writing.\n
* The "b" and "t" qualifiers aren't supported.
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous
* call to <tt>GD_fopen</tt>.\n
*
* @return <tt>GD_FILE*</tt> If the file is successfully reopened, the function
* returns the pointer passed as parameter
* filePointer, which can be used to identify the
* reopened stream. Otherwise, a null pointer is
* returned.
*/
GD_C_API GD_FILE* GD_freopen(const char* filename, const char* mode, GD_FILE* filePointer);
/** Get current position in stream.
* Retrieves the current position in the stream.
* The function fills the fpost_t object pointed by pos with the information needed from the filePointer's position indicator
* to restore the stream to its current position (and multibyte state, if wide-oriented) with a call to fsetpos.
* The ftell function can be used to retrieve the current position in the stream as an integer value.
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous call to <tt>GD_fopen</tt>.\n
*
* @param pos <tt>fpos_t</tt> Pointer to a fpos_t object.
*
* @return <tt>int</tt> On success, the function returns zero.
* In case of error, errno is set to a platform-specific positive value and the function returns a non-zero value.
*/
GD_C_API int GD_fgetpos(GD_FILE* filePointer, fpos_t* pos);
/** Set position indicator of stream.
* Restores the current position in the stream to pos.
* The internal file position indicator associated with stream is set to the position represented by pos,
* which is a pointer to an fpos_t object whose value shall have been previously obtained by a call to fgetpos.
* The end-of-file internal indicator of the stream is cleared after a successful call to this function,
* and all effects from previous calls to ungetc on this stream are dropped.
* On streams open for update (read+write), a call to fsetpos allows to switch between reading and writing.
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous call to <tt>GD_fopen</tt>.\n
*
* @param pos <tt>fpos_t</tt> Pointer to a fpos_t object containing a position previously obtained with fgetpos.
*
* @return <tt>int</tt> On success, the function returns zero.
* On failure, a non-zero value is returned and errno is set to a system-specific positive value.
*/
GD_C_API int GD_fsetpos(GD_FILE* filePointer, const fpos_t* pos);
/** Set position of stream to the beginning.
* Sets the position indicator associated with stream to the beginning of the file.
* The end-of-file and error internal indicators associated to the stream are cleared after a successful call to this function,
* and all effects from previous calls to ungetc on this stream are dropped.
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous call to <tt>GD_fopen</tt>.\n
*/
GD_C_API void GD_rewind(GD_FILE* filePointer);
/** Get character from stream.
* Returns the character currently pointed by the internal file position indicator of the specified stream.
* The internal file position indicator is then advanced to the next character.
* If the stream is at the end-of-file when called, the function returns EOF and sets the end-of-file indicator for the stream (feof).
* If a read error occurs, the function returns EOF and sets the error indicator for the stream (ferror).
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous call to <tt>GD_fopen</tt>.\n
*
* @return <tt>int</tt> On success, the character read is returned (promoted to an int value).
* The return type is int to accommodate for the special value EOF, which indicates failure:
* If the position indicator was at the end-of-file, the function returns EOF and sets the eof indicator (feof) of stream.
* If some other reading error happens, the function also returns EOF, but sets its error indicator (ferror) instead.
*/
GD_C_API int GD_fgetc(GD_FILE* filePointer);
/** Get string from stream.
* Reads characters from stream and stores them as a C string into str
* until (num-1) characters have been read or either a newline or the end-of-file is reached, whichever happens first.
* A newline character makes fgets stop reading, but it is considered a valid character by the function and included in the string copied to str.
* A terminating null character is automatically appended after the characters copied to str.
*
* @param buf <tt>char*</tt> Pointer to an array of chars where the string read is copied.
*
* @param count <tt>int</tt> Maximum number of characters to be copied into str (including the terminating null-character).
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous call to <tt>GD_fopen</tt>.\n
*
* @return <tt>char*</tt> On success, the function returns str.
* If the end-of-file is encountered while attempting to read a character, the eof indicator is set (feof).
* If this happens before any characters could be read, the pointer returned is a null pointer
* (and the contents of str remain unchanged).
* If a read error occurs, the error indicator (ferror) is set and a null pointer is also returned
* (but the contents pointed by str may have changed).
*/
GD_C_API char* GD_fgets(char* buf, int count, GD_FILE* filePointer);
/** Write character to stream.
* Writes a character to the stream and advances the position indicator.
* The character is written at the position indicated by the internal position indicator of the stream,
* which is then automatically advanced by one.
*
* @param character <tt>int</tt> The int promotion of the character to be written.
* The value is internally converted to an unsigned char when written.
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous call to <tt>GD_fopen</tt>.\n
*
* @return <tt>int</tt> On success, the character written is returned.
* If a writing error occurs, EOF is returned and the error indicator (ferror) is set.
*/
GD_C_API int GD_fputc(int character, GD_FILE* filePointer);
/** Write string to stream.
* Writes the C string pointed by str to the stream.
* The function begins copying from the address specified (str) until it reaches the terminating null character ('\0').
* This terminating null-character is not copied to the stream.
*
* @param buf <tt>const char*</tt> C string with the content to be written to stream.
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous call to <tt>GD_fopen</tt>.\n
*
* @return <tt>int</tt> On success, a non-negative value is returned.
* On error, the function returns EOF and sets the error indicator (ferror).
*/
GD_C_API int GD_fputs(const char* buf, GD_FILE* filePointer);
/** Write formatted data to stream.
* Writes the C string pointed by format to the stream. If format includes format specifiers (subsequences beginning
* with %), the additional arguments following format are formatted and inserted in the resulting string replacing
* their respective specifiers.
*
* @param filePointer Pointer to a <tt>GD_FILE</tt> object that identifies an output stream.
*
* @param format C string that contains the text to be written to the stream. It can optionally contain embedded format
* specifiers that are replaced by the values specified in subsequent additional arguments and formatted as requested.
*
* @return <tt>int</tt> On success, the total number of characters written is returned.
* On error, the function returns EOF and sets the error indicator (ferror).
*/
GD_C_API int GD_fprintf(GD_FILE* filePointer, const char* format, ...) GD_ATTRIBUTE((format(printf,2,3)));
/** Write formatted data from variable argument list to stream.
* Writes the C string pointed by format to the stream, replacing any format specifier in the same way as printf does, but
* using the elements in the variable argument list identified by arg instead of additional function arguments.
*
* Internally, the function retrieves arguments from the list identified by arg as if va_arg was used on it, and thus the
* state of arg is likely altered by the call.
*
* In any case, arg should have been initialized by va_start at some point before the call, and it is expected to be released
* by va_end at some point after the call.
*
* @param filePointer Pointer to a <tt>GD_FILE</tt> object that identifies an output stream.
*
* @param format C string that contains a format string that follows the same specifications as format in printf (see printf for details).
*
* @param args A value identifying a variable arguments list initialized with va_start. va_list is a special type defined in the <stdarg.h> file.
*
* @return <tt>int</tt> On success, the total number of characters written is returned.
* On error, the function returns EOF and sets the error indicator (ferror).
*/
GD_C_API int GD_vfprintf(GD_FILE* filePointer, const char * format, va_list args) GD_ATTRIBUTE((format(printf,2,0)));
/** Rename file.
* Changes the name of the file or directory specified by oldname to newname.
* This is an operation performed directly on a file; No streams are involved in the operation.
* If oldname and newname specify different paths and this is supported by the system,
* the file is moved to the new location.
* If newname names an existing file, the function may either fail or override the existing file,
* depending on the specific system and library implementation.
*
* @param oldname <tt>const char*</tt> C string containing the name of an existing file to be renamed and/or moved.
*
* @param newname <tt>const char*</tt> C string containing the new name for the file.
*
* @return <tt>int</tt> If the file is successfully renamed, a zero value is returned.
* On failure, a nonzero value is returned.
*/
GD_C_API int GD_rename(const char* oldname, const char* newname);
/** Change stream buffering.
* Specifies a buffer for stream. The function allows to specify the mode and size of the buffer (in bytes).
* If buffer is a null pointer, the function automatically allocates a buffer (using size as a hint on the size to use).
* Otherwise, the array pointed by buffer may be used as a buffer of size bytes.
* This function should be called once the stream has been associated with an open file,
* but before any input or output operation is performed with it.
* A stream buffer is a block of data that acts as intermediary between the i/o operations and the physical file associated to the stream:
* For output buffers, data is output to the buffer until its maximum capacity is reached, then it is flushed
* (i.e.: all data is sent to the physical file at once and the buffer cleared).
* Likewise, input buffers are filled from the physical file, from which data is sent to the operations until exhausted,
* at which point new data is acquired from the file to fill the buffer again.
* Stream buffers can be explicitly flushed by calling fflush.
* They are also automatically flushed by fclose and freopen, or when the program terminates normally.
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous call to <tt>GD_fopen</tt>.\n
*
* @param buf <tt>char*</tt> User allocated buffer. Shall be at least size bytes long.
* If set to a null pointer, the function automatically allocates a buffer.
*
* @param mode <tt>int</tt> Specifies a mode for file buffering.(_IOFBF, _IOLBF and _IONBF)
*
* @param size <tt>size_t</tt> Buffer size, in bytes.
* If the buffer argument is a null pointer, this value may determine the size automatically allocated by the function for the buffer.
*
* @return <tt>int</tt> If the buffer is correctly assigned to the file, a zero value is returned.
* Otherwise, a non-zero value is returned;
* This may be due to an invalid mode parameter or to some other error allocating or assigning the buffer.
*/
GD_C_API int GD_setvbuf(GD_FILE* filePointer, char* buf, int mode, size_t size);
/** Change stream buffering.
* Specifies a buffer for stream. The function allows to specify the size of the buffer (in bytes).
* If buffer is a null pointer, the function automatically allocates a buffer (using size as a hint on the size to use).
* Otherwise, the array pointed by buffer may be used as a buffer of size bytes.
* This function should be called once the stream has been associated with an open file,
* but before any input or output operation is performed with it.
* A stream buffer is a block of data that acts as intermediary between the i/o operations and the physical file associated to the stream:
* For output buffers, data is output to the buffer until its maximum capacity is reached, then it is flushed
* (i.e.: all data is sent to the physical file at once and the buffer cleared).
* Likewise, input buffers are filled from the physical file, from which data is sent to the operations until exhausted,
* at which point new data is acquired from the file to fill the buffer again.
* Stream buffers can be explicitly flushed by calling fflush.
* They are also automatically flushed by fclose and freopen, or when the program terminates normally.
*
* Except for the lack of a return value, the GD_setbuffer function is exactly equivalent to the call
* setvbuf(stream, buf, buf ? _IOFBF : _IONBF, size);
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous call to <tt>GD_fopen</tt>.\n
*
* @param buf <tt>char*</tt> User allocated buffer. Shall be at least size bytes long.
* If set to a null pointer, the function automatically allocates a buffer.
*
* @param size <tt>int</tt> Buffer size, in bytes.
* If the buffer argument is a null pointer, this value may determine the size automatically allocated by the function for the buffer.
*/
GD_C_API void GD_setbuffer(GD_FILE* filePointer, char* buf, int size);
/** Change stream buffering.
* Specifies a buffer for stream.
* If buffer is a null pointer, the function automatically allocates a buffer.
* Otherwise, the array pointed by buffer may be used as a buffer of size BUFSIZ.
* This function should be called once the stream has been associated with an open file,
* but before any input or output operation is performed with it.
* A stream buffer is a block of data that acts as intermediary between the i/o operations and the physical file associated to the stream:
* For output buffers, data is output to the buffer until its maximum capacity is reached, then it is flushed
* (i.e.: all data is sent to the physical file at once and the buffer cleared).
* Likewise, input buffers are filled from the physical file, from which data is sent to the operations until exhausted,
* at which point new data is acquired from the file to fill the buffer again.
* Stream buffers can be explicitly flushed by calling fflush.
* They are also automatically flushed by fclose and freopen, or when the program terminates normally.
*
* Except for the lack of a return value, the GD_setbuf() function is exactly equivalent to the call
* GD_setvbuf(filePointer, buf, buf ? _IOFBF : _IONBF, BUFSIZ);
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous call to <tt>GD_fopen</tt>.\n
*
* @param buf <tt>char*</tt> User allocated buffer. Shall be BUFSIZ bytes long.
* If set to a null pointer, the function automatically allocates a buffer.
*
*/
GD_C_API void GD_setbuf(GD_FILE* filePointer, char* buf);
/** Flush stream.
* If the given stream was open for writing (or if it was open for updating and the last i/o operation was an output operation)
* any unwritten data in its output buffer is written to the file.
*
* \note Note that this will not synchronize any read streams open on the write stream. To additionally synchronize with open read streams
* on the same file, please use GD_fsync() instead.
*
* The stream remains open after this call.
* When a file is closed, either because of a call to fclose or because the program terminates, all the buffers associated with it are automatically flushed.
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous call to <tt>GD_fopen</tt>.\n
*
* @return <tt>int</tt> A zero value indicates success.
* If an error occurs, EOF is returned and the error indicator is set (see ferror).
*/
GD_C_API int GD_fflush(GD_FILE* filePointer);
/** Flush stream and synchronize.
* If the given stream was open for writing (or if it was open for updating and the last i/o operation was an output operation)
* any unwritten data in its output buffer is written to the file.
*
* \note This will also synchronize any read streams open on the write stream and is therefore less performant than GD_fflush(), which may be
* more appropriate if such synchronization is not required.
*
* The stream remains open after this call.
* When a file is closed, either because of a call to fclose or because the program terminates, all the buffers associated with it are automatically flushed.
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous call to <tt>GD_fopen</tt>.\n
*
* @return <tt>int</tt> A zero value indicates success.
* If an error occurs, EOF is returned and the error indicator is set (see ferror).
*/
GD_C_API int GD_fsync(GD_FILE* filePointer);
/** Clear error indicators.
* Resets both the error and the eof indicators of the stream.
* When a i/o function fails either because of an error or because the end of the file has been reached,
* one of these internal indicators may be set for the stream.
* The state of these indicators is cleared by a call to this function,
* or by a call to any of: rewind, fseek, fsetpos and freopen.
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous call to <tt>GD_fopen</tt>.\n
*/
GD_C_API void GD_clearerr(GD_FILE* filePointer);
/** Check error indicator.
* Checks if the error indicator associated with stream is set, returning a value different from zero if it is.
* This indicator is generally set by a previous operation on the stream that failed,
* and is cleared by a call to clearerr, rewind or freopen.
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous call to <tt>GD_fopen</tt>.\n
*
* @return <tt>int</tt> A non-zero value is returned in the case that the error indicator associated with the stream is set.
* Otherwise, zero is returned.
*/
GD_C_API int GD_ferror(GD_FILE* filePointer);
/** Create a directory at the specified path.
* The directory path is created at the path specified. The mode parameter is not used and exists here for compatability.
*
* @param dirname <tt>const char*</tt> directory path to be created.
*
* @param mode <tt>mode</tt> not used (all directories are rwx)
*
* @return <tt>int</tt>
*/
GD_C_API int GD_mkdir(const char* dirname, mode_t mode);
/** Open a directory at specified path.
* The opendir() function opens the directory named by dirname, associates a directory stream with it, and returns a pointer
* to be used to identify the directory stream in subsequent operations. The pointer NULL is returned if dirname cannot be
* accessed or if it cannot malloc(3) enough memory to hold the whole thing.
*
* @param dirname <tt>char*</tt> string of the path to the directory.\n
*
* @return <tt>GD_DIR*</tt> object which represents the directory, NULL is returned in the case of an error.\n
*/
GD_C_API GD_DIR* GD_opendir(const char *dirname);
/** Close an already opened directory stream.
* The closedir() function closes the named directory stream and frees the structure associated with the dirp pointer,
* returning 0 on success. On failure, -1 is returned and the global variable errno is set to indicate the error.
*
* @param dirp <tt>GD_DIR*</tt> directory stream to close
*
* @return <tt>int</tt> 0 on success, -1 on failure
*/
GD_C_API int GD_closedir(GD_DIR *dirp);
/** Read next directory entry.
* This function returns a pointer to the next directory entry. It returns NULL
* upon reaching the end of the directory or detecting an invalid seekdir()
* operation.
*
* @param dirp <tt>dirp</tt> directory stream to read from.
*
* @return <tt>struct dirent*</tt> pointer to a directory entry or NULL if the
* end has been reached.
*/
GD_C_API struct dirent* GD_readdir(GD_DIR *dirp);
/** Read next directory entry into a buffer.
* This function provides the same functionality as GD_readdir(), but the caller
* must provide a directory entry buffer to store the results in.
*
* If the read succeeds, result is pointed at the entry; upon reaching the end
* of the directory, result is set to NULL. readdir_r() returns 0 on success or
* an error number to indicate failure.
*
* @param dirp <tt>GD_DIR*</tt> directory stream to use.
*
* @param entry <tt>struct dirent*</tt> caller provided buffer to store the
* directory entry.
*
* @param result <tt>struct dirent**</tt> on sucess result is pointed to
* entry.
*
* @return <tt>int</tt> 0 on success, -1 on failure.
*/
GD_C_API int GD_readdir_r(GD_DIR* dirp, struct dirent* entry, struct dirent** result);
/** Reset directory stream.
* This function resets the position of the named directory stream to the
* beginning of the directory.
*
* @param dirp <tt>GD_DIR*</tt> directory stream to use.
*/
GD_C_API void GD_rewinddir(GD_DIR *dirp);
/** Set the position of a directory stream.
* This function sets the position of the next readdir() operation on the
* directory stream. The new position reverts to the one associated with the
* directory stream when the telldir() operation was performed.
*
* @param dirp <tt>GD_DIR*</tt> directory stream to use.
*
* @param loc <tt>long</tt> position to seek to.
*/
GD_C_API void GD_seekdir(GD_DIR *dirp, long loc);
/** Current location of a directory stream.
* This function returns the current location associated with the named
* directory stream. Values returned by this function are good only for the
* lifetime of the DIR pointer (e.g., dirp) from which they are derived. If the
* directory is closed and then reopened, prior values returned by a previous
* call will no longer be valid.
*
* @param dirp <tt>GD_DIR*</tt> directory stream to use.
*
* @return <tt>long</tt> current location in the stream.
*/
GD_C_API long GD_telldir(GD_DIR *dirp);
/** File statistics.
* This function returns information about the file at a specified path. Read,
* write or execute permission of the named file is not required, but all
* directories listed in the path name leading to the file must be searchable.
*
* @param path <tt>const char*</tt> pointer to a C string containing the path to the file.\n
*
* @param buf <tt>struct stat*</tt> buffer in which to write the stat data.\n
*
* @return <tt>int</tt> 0 on success, -1 on failure.\n
*/
GD_C_API int GD_stat(const char* path, struct stat* buf);
/** Obtain information about the directory or file associated with the named directory stream.
*
* @param dirp <tt>GD_DIR*</tt> directory stream to use.\n
*
* @param name <tt>const char*</tt> pointer to a C string containing the name to the file or directory.\n
*
* @param buf <tt>struct stat*</tt> buffer in which to write the stat data.\n
*
* @return <tt>int</tt> 0 on success, -1 on failure.\n
*/
GD_C_API int GD_statdir(GD_DIR *dirp, const char* name, struct stat* buf);
/** Get character from stream.
* Returns the character currently pointed by the internal file position indicator of the specified stream.
* The internal file position indicator is then advanced to the next character.
* If the stream is at the end-of-file when called, the function returns EOF and sets the end-of-file indicator for the stream (feof).
* If a read error occurs, the function returns EOF and sets the error indicator for the stream (ferror).
*
* @param filePointer <tt>GD_FILE*</tt> object which was returned by a previous call to <tt>GD_fopen</tt>.\n
*
* @return <tt>int</tt> On success, the character read is returned (promoted to an int value).
* The return type is int to accommodate for the special value EOF, which indicates failure:
* If the position indicator was at the end-of-file, the function returns EOF and sets the eof indicator (feof) of stream.
* If some other reading error happens, the function also returns EOF, but sets its error indicator (ferror) instead.
*/
GD_C_API int GD_getc(GD_FILE* filePointer);
/** Push character back onto stream.
* This function pushes the character c (converted to an unsigned char) back
* onto the specified input stream. The pushed-back character will be returned
* (in reverse order) by subsequent reads on the stream. A successful
* intervening call to one of the file positioning functions using the same
* stream, will discard the pushed-back characters.
*
* @return The <tt>GD_ungetc</tt> function returns the character pushed-back after the conversion, or EOF if the operation
* fails. If the value of the argument c character equals EOF, the operation will fail and the stream will
* remain unchanged.
*/
GD_C_API int GD_ungetc(int character, GD_FILE* filePointer);
#ifdef __cplusplus
}
#endif
/** @}
*/
#endif // GD_C_FILESYSTEM_H
| 49.318066 | 157 | 0.721572 | [
"object"
] |
f87a5da284644a8039b550266cf69a9011ad8576 | 1,706 | h | C | src/platform/cocoa/private/PAGLayerImpl+Internal.h | skylerpfli/libpag | 41adf2754a428569d3513a85908bcc6c1bf3d906 | [
"BSL-1.0",
"CC0-1.0",
"MIT"
] | 1,546 | 2022-01-14T02:09:47.000Z | 2022-03-31T10:38:42.000Z | src/platform/cocoa/private/PAGLayerImpl+Internal.h | skylerpfli/libpag | 41adf2754a428569d3513a85908bcc6c1bf3d906 | [
"BSL-1.0",
"CC0-1.0",
"MIT"
] | 86 | 2022-01-14T04:50:28.000Z | 2022-03-31T01:54:31.000Z | src/platform/cocoa/private/PAGLayerImpl+Internal.h | skylerpfli/libpag | 41adf2754a428569d3513a85908bcc6c1bf3d906 | [
"BSL-1.0",
"CC0-1.0",
"MIT"
] | 207 | 2022-01-14T02:09:52.000Z | 2022-03-31T08:34:49.000Z | /////////////////////////////////////////////////////////////////////////////////////////////////
//
// Tencent is pleased to support the open source community by making libpag available.
//
// Copyright (C) 2021 THL A29 Limited, a Tencent company. 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.
//
/////////////////////////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
#import "PAGLayerImpl.h"
#import "pag/file.h"
#import "pag/pag.h"
@interface PAGLayerImpl (Internal)
- (instancetype)initWithPagLayer:(std::shared_ptr<pag::PAGLayer>)pagLayer;
- (std::shared_ptr<pag::PAGLayer>)pagLayer;
- (void)setPagLayer:(std::shared_ptr<pag::PAGLayer>)pagLayer;
/*
* Convert pag::PAGLayer to a PAGLayer wrapper
*/
+ (PAGLayer*)ToPAGLayer:(std::shared_ptr<pag::PAGLayer>)layer;
/*
* Batch Convert pag::PAGLayer to a PAGLayer wrapper
*/
+ (NSArray<PAGLayer*>*)BatchConvertToPAGLayers:
(const std::vector<std::shared_ptr<pag::PAGLayer>>&)layerVector;
/*
* Batch Convert pag::Marker to a PAGMarker wrapper
*/
+ (NSArray<PAGMarker*>*)BatchConvertToPAGMarkers:(std::vector<const pag::Marker*>&)markers;
@end
| 35.541667 | 97 | 0.650645 | [
"vector"
] |
52bb030e81d2c5b08d8384da9bb8abd6ed9d4152 | 1,007 | c | C | lib/wizards/proge/lair/hallway10.c | vlehtola/questmud | 8bc3099b5ad00a9e0261faeb6637c76b521b6dbe | [
"MIT"
] | null | null | null | lib/wizards/proge/lair/hallway10.c | vlehtola/questmud | 8bc3099b5ad00a9e0261faeb6637c76b521b6dbe | [
"MIT"
] | null | null | null | lib/wizards/proge/lair/hallway10.c | vlehtola/questmud | 8bc3099b5ad00a9e0261faeb6637c76b521b6dbe | [
"MIT"
] | null | null | null | inherit "room/room";
object monster1;
object monster2;
object monster3;
reset(arg) {
if(!monster) {
monster = clone_object("/wizards/proge/suunnitelmat/lair/easy_aggro_orc");
move_object(monster, this_object());
}
if(!monster2) {
monster2 = clone_object("/wizards/proge/suunnitelmat/lair/easy_aggro_orc");
move_object(monster2, this_object());
}
if(!monster3) {
monster3 = clone_object("/wizards/proge/suunnitelmat/lair/easy_aggro_orc");
move_object(monster, this_object());
}
if(arg) return;
set_not_out();
add_exit("east","/wizards/proge/lair/hallway11");
add_exit("west","/wizards/proge/lair/hallway9");
short_desc =
"In the corner of the dark cave";
long_desc =
"Endless cave continues to east and west. Eerie screams can be\n"+
"heard eachoing from the east. Pieces of broken weapons are\n"+
"lying on the ground. You can smell a scent of smoke in the air\n"
"which stinks of orcs. Floor and walls are covered in blood.\n";
}
| 29.617647 | 79 | 0.69712 | [
"object"
] |
52c99df8166ef661a2e4a91e425c4ea1f50da1f1 | 1,686 | h | C | injected/include/FilterFindMoonChallenge.h | spelunky-fyi/Spelunky2SeedFinder | 80724261339b92a9bee796c9c99fa1afb14f298b | [
"MIT"
] | 2 | 2021-03-22T21:47:30.000Z | 2021-03-23T20:56:52.000Z | injected/include/FilterFindMoonChallenge.h | zappatic/Spelunky2SeedFinder | 80724261339b92a9bee796c9c99fa1afb14f298b | [
"MIT"
] | null | null | null | injected/include/FilterFindMoonChallenge.h | zappatic/Spelunky2SeedFinder | 80724261339b92a9bee796c9c99fa1afb14f298b | [
"MIT"
] | null | null | null | #pragma once
#include "Filter.h"
namespace SeedFinder
{
class SeedFinder;
class FilterFindMoonChallenge : public Filter
{
public:
explicit FilterFindMoonChallenge(SeedFinder* seedFinder);
~FilterFindMoonChallenge() override = default;
bool isValid() override;
bool shouldExecute(uint8_t currentWorld, uint8_t currentLevel) override;
bool execute(uint8_t currentWorld, uint8_t currentLevel) override;
void render() override;
void writeToLog() override;
uint8_t deepestLevel() const override;
void resetForNewSeed(uint32_t newSeed) override;
json serialize() const override;
std::string unserialize(const json& j) override;
static std::string title();
static std::string uniqueIdentifier();
static std::unique_ptr<FilterFindMoonChallenge> instantiate(SeedFinder* seedFinder);
private:
LevelStorage mLevelsToSearch;
AccessibilityChoice mAccessibility = AccessibilityChoice::MAYBE;
uint8_t mMinimumMattockDurability = 39;
const char* mChosenMattockComparison = msComparisonOptions[1];
uint8_t mCurrentWorld;
uint8_t mCurrentLevel;
std::vector<Entity*> mFrontLayerEntities;
bool mChallengeFound = false;
uint8_t mChallengeFoundOnLevel = 0;
uint8_t mTunX = 0;
uint8_t mTunY = 0;
static uint16_t msTunID;
static uint16_t msMattockID;
static const char* msComparisonOptions[];
static const char* kJSONMattockDurability;
static const char* kJSONMattockComparison;
void locateTun();
};
} // namespace SeedFinder | 33.058824 | 92 | 0.683274 | [
"render",
"vector"
] |
52cc4fb29389b22e26335e093dffe1d91878a8fa | 1,794 | h | C | include/c-spiffe/svid/jwtsvid/svid.h | marcusvtms/c-spiffe | 2cb5b1c9a07f2b7d746ebb19f41b355960fbfb8c | [
"Apache-2.0"
] | 9 | 2021-02-01T16:35:59.000Z | 2022-02-10T07:11:21.000Z | include/c-spiffe/svid/jwtsvid/svid.h | marcusvtms/c-spiffe | 2cb5b1c9a07f2b7d746ebb19f41b355960fbfb8c | [
"Apache-2.0"
] | 7 | 2021-02-10T17:49:53.000Z | 2022-02-24T06:58:58.000Z | include/c-spiffe/svid/jwtsvid/svid.h | marcusvtms/c-spiffe | 2cb5b1c9a07f2b7d746ebb19f41b355960fbfb8c | [
"Apache-2.0"
] | 7 | 2021-02-01T16:42:00.000Z | 2022-01-04T17:16:42.000Z | #ifndef INCLUDE_SVID_JWTSVID_SVID_H
#define INCLUDE_SVID_JWTSVID_SVID_H
#include "c-spiffe/spiffeid/id.h"
#include "c-spiffe/utils/util.h"
#include <jansson.h>
#include <time.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct map_string_claim {
string_t key;
json_t *value;
} map_string_claim;
/** JWT object */
typedef struct {
/** header in json internal format */
json_t *header;
/** payload in json internal format */
json_t *payload;
/** header in stb string Base64URL encoding */
string_t header_str;
/** payload in stb string Base64URL encoding */
string_t payload_str;
/** signature in stb string Base64URL encoding */
string_t signature;
} jwtsvid_JWT;
/** JWT parameters */
typedef struct jwtsvid_Params {
string_t audience;
string_arr_t extra_audiences;
spiffeid_ID subject;
} jwtsvid_Params;
/** JWT-SVID object */
typedef struct jwtsvid_SVID {
/** The SPIFFE ID of the JWT-SVID as present in the 'sub' claim */
spiffeid_ID id;
/** stb array of audience, intended recipients of JWT-SVID as present
* in the 'aud' claim */
string_arr_t audience;
/** The expiration time of JWT-SVID as present in 'exp' claim */
time_t expiry;
/** The parsed claims from token */
map_string_claim *claims;
/** Serialized JWT token */
string_t token;
} jwtsvid_SVID;
/**
* Marshal returns the JWT-SVID marshaled to a string.
*
* \param svid [in] JWT-SVID object pointer.
* \returns string with JWT token value. It must NOT be altered or freed
* directly.
*/
const char *jwtsvid_SVID_Marshal(jwtsvid_SVID *svid);
/**
* Frees a JWT-SVID object.
*
* \param svid [in] JWT-SVID object pointer.
*/
void jwtsvid_SVID_Free(jwtsvid_SVID *svid);
#ifdef __cplusplus
}
#endif
#endif
| 23.92 | 73 | 0.694537 | [
"object"
] |
52cdcd51020cac99a2384aafb75359f3b79e7fb5 | 1,257 | c | C | pset1/mario/mario.c | fabiopapais/cs50 | 5a7c933028bb176ade00961486dda348c31ec90e | [
"Unlicense"
] | 1 | 2021-05-07T16:17:28.000Z | 2021-05-07T16:17:28.000Z | pset1/mario/mario.c | fabiopapais/cs50 | 5a7c933028bb176ade00961486dda348c31ec90e | [
"Unlicense"
] | null | null | null | pset1/mario/mario.c | fabiopapais/cs50 | 5a7c933028bb176ade00961486dda348c31ec90e | [
"Unlicense"
] | null | null | null | #include <stdio.h>
#include <cs50.h>
int main(void)
{
// Initiate our variable height to prevent errors
int height;
// This block is responsable for acceptting only the valid *numbers* (> 1 and < 8)
do
{
height = get_int("Height: ");
}
while (height < 1 || height > 8);
int horizontal_value = 1;
int horizontal_blank_value = height - 1;
// Each repeat of this block represents one line of our print
for (int i = 0; i < height; i++)
{
// Left part of the tower
// That first part is responsible to print the spaces (" "), needed to shape it correctly
for (int z = 0; z < horizontal_blank_value; z++)
{
printf(" ");
}
// Then, simply print the necessary amount of hash's to make the left tower
for (int y = 0; y < horizontal_value; y++)
{
printf("#");
}
// The 2 spaces between the towers
printf(" ");
// Right part of the tower
for (int y = 0; y < horizontal_value; y++)
{
printf("#");
}
// Next line and updating our control variables
printf("\n");
horizontal_blank_value--;
horizontal_value++;
}
}
| 24.647059 | 97 | 0.539379 | [
"shape"
] |
52e0c9710a11bceba57fc20f9bf1a3cd17d135a6 | 2,594 | c | C | story.c | jeffpc/blahgd | 33507eeab201a0079062e87484fd799010db372c | [
"MIT"
] | null | null | null | story.c | jeffpc/blahgd | 33507eeab201a0079062e87484fd799010db372c | [
"MIT"
] | null | null | null | story.c | jeffpc/blahgd | 33507eeab201a0079062e87484fd799010db372c | [
"MIT"
] | null | null | null | /*
* Copyright (c) 2009-2018 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
*
* 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <jeffpc/error.h>
#include "post.h"
#include "req.h"
#include "render.h"
#include "sidebar.h"
#include "utils.h"
#include "debug.h"
static int __load_post(struct req *req, int p, bool preview)
{
struct nvlist *post;
struct val **val;
post = get_post(req, p, "title", preview);
if (!post) {
DBG("failed to load post #%d: %s (%d)%s", p, "XXX",
-1, preview ? " preview" : "");
vars_set_str(&req->vars, "title", STATIC_STR("not found"));
return -ENOENT;
}
val = malloc(sizeof(struct val *));
if (!val) {
DBG("failed to allocate val array");
nvl_putref(post);
return -ENOMEM;
}
*val = nvl_cast_to_val(post);
vars_set_array(&req->vars, "posts", val, 1);
if (preview)
vars_set_int(&req->vars, "preview", 1);
return 0;
}
/*
* Is the request a preview?
*/
static bool is_preview(struct req *req)
{
uint64_t tmp;
if (nvl_lookup_int(req->scgi->request.query, "preview", &tmp))
return false;
return tmp == PREVIEW_SECRET;
}
int blahg_story(struct req *req)
{
uint64_t postid;
if (nvl_lookup_int(req->scgi->request.query, "p", &postid))
return R404(req, NULL);
if (postid > INT_MAX)
return R404(req, NULL);
sidebar(req);
vars_scope_push(&req->vars);
if (__load_post(req, postid, is_preview(req)))
return R404(req, NULL);
req->scgi->response.body = render_page(req, "{storyview}");
return 0;
}
| 24.942308 | 80 | 0.699692 | [
"render"
] |
52e93db7071e422f38e631b6dd7046f347a479e5 | 1,349 | c | C | src/oop/ptc_basic.c | march1896/pegas | 7bff06cea9544c5cb5ead5f9f0167c449759b3fc | [
"MIT"
] | 1 | 2015-12-11T06:25:04.000Z | 2015-12-11T06:25:04.000Z | src/oop/ptc_basic.c | march1896/pegas | 7bff06cea9544c5cb5ead5f9f0167c449759b3fc | [
"MIT"
] | null | null | null | src/oop/ptc_basic.c | march1896/pegas | 7bff06cea9544c5cb5ead5f9f0167c449759b3fc | [
"MIT"
] | null | null | null | #include "ptc_basic.h"
DEFINE_UID(basic_ptc_id);
Object *pobject_clone(const Object *me, heap_info *heap) {
struct basic_protocol *ptc = me->is_a->get_protocol(basic_ptc_id);
if (ptc != NULL && ptc->clone != NULL) {
Object *new_obj = object_create(heap);
unknown *new_ref = ptc->clone(me->content, heap);
object_init(new_obj, me->is_a, new_ref, heap, true);
return new_obj;
}
return NULL;
}
bool pobject_equals(const Object *me, const Object *other) {
struct basic_protocol *ptc = NULL;
if (me->is_a != other->is_a)
return false;
ptc = me->is_a->get_protocol(basic_ptc_id);
if (ptc == NULL)
return false;
if (ptc->equals != NULL) {
return ptc->equals(me->content, other->content);
}
if (ptc->compare != NULL) {
return ptc->compare(me->content, other->content) == 0;
}
return false;
}
int pobject_compare(const Object *me, const Object *other) {
const struct basic_protocol *ptc;
if (me->is_a != other->is_a)
return false;
ptc = me->is_a->get_protocol(basic_ptc_id);
if (ptc != NULL && ptc->compare != NULL) {
return ptc->compare(me->content, other->content);
}
return false;
}
hashcode pobject_hashcode(const Object *me) {
struct basic_protocol *ptc = me->is_a->get_protocol(basic_ptc_id);
if (ptc != NULL && ptc->hashcode != NULL) {
return ptc->hashcode(me->content);
}
return 0;
}
| 21.078125 | 67 | 0.674574 | [
"object"
] |
52f095f33244acf14c3baf93c5693848f252dbfc | 2,146 | h | C | activemq-cpp/src/main/activemq/commands/ActiveMQObjectMessage.h | novomatic-tech/activemq-cpp | d6f76ede90d21b7ee2f0b5d4648e440e66d63003 | [
"Apache-2.0"
] | 87 | 2015-03-02T17:58:20.000Z | 2022-02-11T02:52:52.000Z | activemq-cpp/src/main/activemq/commands/ActiveMQObjectMessage.h | korena/activemq-cpp | e4c56ee4fec75c3284b9167a7215e2d80a9a4dc4 | [
"Apache-2.0"
] | 3 | 2017-05-10T13:16:08.000Z | 2019-01-23T20:21:53.000Z | activemq-cpp/src/main/activemq/commands/ActiveMQObjectMessage.h | korena/activemq-cpp | e4c56ee4fec75c3284b9167a7215e2d80a9a4dc4 | [
"Apache-2.0"
] | 71 | 2015-04-28T06:04:04.000Z | 2022-03-15T13:34:06.000Z | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _ACTIVEMQ_COMMANDS_ACTIVEMQOBJECTMESSAGE_H_
#define _ACTIVEMQ_COMMANDS_ACTIVEMQOBJECTMESSAGE_H_
#include <activemq/commands/ActiveMQMessageTemplate.h>
#include <cms/ObjectMessage.h>
#include <activemq/util/Config.h>
#include <memory>
namespace activemq {
namespace commands {
class AMQCPP_API ActiveMQObjectMessage : public ActiveMQMessageTemplate<cms::ObjectMessage> {
public:
const static unsigned char ID_ACTIVEMQOBJECTMESSAGE;
private:
ActiveMQObjectMessage(const ActiveMQObjectMessage&);
ActiveMQObjectMessage& operator=(const ActiveMQObjectMessage&);
public:
ActiveMQObjectMessage();
virtual ~ActiveMQObjectMessage() throw () {
}
virtual unsigned char getDataStructureType() const;
virtual ActiveMQObjectMessage* cloneDataStructure() const;
virtual void copyDataStructure(const DataStructure* src);
virtual std::string toString() const;
virtual bool equals(const DataStructure* value) const;
public: // CMS Message
virtual cms::Message* clone() const;
public: // CMS ObjectMessage
virtual void setObjectBytes(const std::vector<unsigned char>& bytes);
virtual std::vector<unsigned char> getObjectBytes() const;
};
}}
#endif /*_ACTIVEMQ_COMMANDS_ACTIVEMQOBJECTMESSAGE_H_*/
| 30.225352 | 97 | 0.739049 | [
"vector"
] |
9bd366b60bb059e757f0664acc33429ecf224c07 | 1,175 | c | C | libs/hwdrivers/src/xSens_MT4/xstypes/src/xstriggerindicationdata.c | amitsingh19975/mrpt | 451480f9815cc029ae427ed8067732606bcfbb43 | [
"BSD-3-Clause"
] | 9 | 2017-11-19T16:18:09.000Z | 2020-07-16T02:13:43.000Z | libs/hwdrivers/src/xSens_MT4/xstypes/src/xstriggerindicationdata.c | amitsingh19975/mrpt | 451480f9815cc029ae427ed8067732606bcfbb43 | [
"BSD-3-Clause"
] | null | null | null | libs/hwdrivers/src/xSens_MT4/xstypes/src/xstriggerindicationdata.c | amitsingh19975/mrpt | 451480f9815cc029ae427ed8067732606bcfbb43 | [
"BSD-3-Clause"
] | 4 | 2018-06-08T07:55:51.000Z | 2022-02-22T08:56:28.000Z | /* +---------------------------------------------------------------------------+
| Mobile Robot Programming Toolkit (MRPT) |
| http://www.mrpt.org/ |
| |
| Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
| See: http://www.mrpt.org/Authors - All rights reserved. |
| Released under BSD License. See details in http://www.mrpt.org/License |
+---------------------------------------------------------------------------+ */
#include "xstriggerindicationdata.h"
#include <string.h>
/*! \addtogroup cinterface C Interface
@{
*/
/*! \brief Destroy the %XsTriggerIndicationData object */
void XsTriggerIndicationData_destruct(XsTriggerIndicationData* thisPtr)
{
memset(thisPtr, 0, sizeof(XsTriggerIndicationData));
}
/*! \brief Returns true if the object is valid (line and polarity may not be 0) */
int XsTriggerIndicationData_valid(const XsTriggerIndicationData* thisPtr)
{
return thisPtr->m_line != 0 && thisPtr->m_polarity != 0;
}
/*! @} */
| 40.517241 | 83 | 0.501277 | [
"object"
] |
9bd37d36f136d5251c1b8ecba56cefcea244102a | 2,226 | h | C | gamesolver/experiment/SolverStage.h | kryozahiro/gamesolver | e5367c292cd9791c1758ac02df226efcb748cd67 | [
"BSL-1.0"
] | null | null | null | gamesolver/experiment/SolverStage.h | kryozahiro/gamesolver | e5367c292cd9791c1758ac02df226efcb748cd67 | [
"BSL-1.0"
] | null | null | null | gamesolver/experiment/SolverStage.h | kryozahiro/gamesolver | e5367c292cd9791c1758ac02df226efcb748cd67 | [
"BSL-1.0"
] | 1 | 2019-10-06T16:06:10.000Z | 2019-10-06T16:06:10.000Z | /*
* SolverStage.h
*
* Created on: 2015/07/22
* Author: kryozahiro
*/
#ifndef GAMESOLVER_EXPERIMENT_SOLVERSTAGE_H_
#define GAMESOLVER_EXPERIMENT_SOLVERSTAGE_H_
#include "../solver/Solver.h"
#include "GeneratorStage.h"
#include "Stage.h"
class SolverStage : public Stage {
public:
SolverStage(const boost::property_tree::ptree& config, const boost::property_tree::ptree& solverStageTree, std::shared_ptr<Game>& game, std::string programName, std::pair<int, int> evaluationLoggerRange);
virtual ~SolverStage() = default;
/// Stageの実装
virtual void operator()(std::vector<std::shared_ptr<Solution>>& solutions, std::mt19937_64& randomEngine);
/// 解の履歴を取得する
const std::shared_ptr<SolutionHistory> getHistory() const;
private:
/// ソルバの読み込み
std::shared_ptr<SolverBase> createSolver(boost::property_tree::ptree& solverTree, std::vector<std::shared_ptr<Solution>>& solutions);
/*template <template <class ConcreteProgram> class ConcreteSolver>
std::shared_ptr<Solver<Game>> createSolverImpl(boost::property_tree::ptree& solverTree, std::vector<std::shared_ptr<Solution>>& solutions) {
std::shared_ptr<Solver<Game>> solver;
if (programName == "GrayCodeMapping") {
//solver = ConcreteSolver<GrayCodeMapping>(solverTree, programs, history);
} else if (programName == "ExpressionTree") {
solver = std::make_shared<ConcreteSolver<ExpressionTree>>(solverTree, solutions);
} else if (programName == "InstructionSequence") {
solver = std::make_shared<ConcreteSolver<InstructionSequence>>(solverTree, solutions);
} else if (programName == "FeedforwardNetwork") {
solver = std::make_shared<ConcreteSolver<FeedforwardNetwork>>(solverTree, solutions);
} else {
assert(false);
}
return solver;
}*/
/// \<Config>ノード
const boost::property_tree::ptree config;
/// \<SolverStage>ノード
const boost::property_tree::ptree solverStageTree;
/// 使用するGame
std::shared_ptr<Game> game;
/// 使用するProgram
std::string programName;
/// ロギングの設定
std::pair<int, int> evaluationLoggerRange;
/// 終了条件
std::shared_ptr<TerminationCriteria> termination;
int historySize;
/// ソルバ
std::string solverName;
std::shared_ptr<SolverBase> solver;
};
#endif /* GAMESOLVER_EXPERIMENT_SOLVERSTAGE_H_ */
| 30.916667 | 205 | 0.741689 | [
"vector"
] |
9bd4d277366a4fbca413efce2f61b59cfad4c4d3 | 1,177 | h | C | JsonReader.h | nirry78/codegen | 9c538533ea899c8e9bb4a5f2f0851c0680708c82 | [
"MIT"
] | null | null | null | JsonReader.h | nirry78/codegen | 9c538533ea899c8e9bb4a5f2f0851c0680708c82 | [
"MIT"
] | null | null | null | JsonReader.h | nirry78/codegen | 9c538533ea899c8e9bb4a5f2f0851c0680708c82 | [
"MIT"
] | null | null | null | #ifndef _JSON_READER_H
#define _JSON_READER_H
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <list>
#include <nlohmann/json.hpp>
#include "Logging.h"
#include "Container.h"
using json = nlohmann::json;
class JsonReader
{
private:
json mJsonObject;
std::list<Container> mContainerList;
std::list<Container>::iterator mContainerIterator;
uint32_t mContainerCount;
void VerifyContainer(json& object);
void VerifyParameters(Container& container, json& object);
public:
JsonReader();
virtual ~JsonReader();
bool ReadFile(const char *filename);
bool SelectNamespace(const char *value);
bool ForeachContainerReset(Tag *tag);
bool ForeachContainerNext();
bool ForeachFieldReset(Tag *tag);
bool ForeachFieldNext();
void OutputContainer(Document* document, std::string& name, Tag* tag);
void OutputField(Document* document, std::string& name, Tag* tag);
};
#endif /* _JSON_READER_H */ | 30.179487 | 81 | 0.615973 | [
"object"
] |
9bdbfd2700e37193d71b54e60208b4c973a05e8a | 1,193 | h | C | libembroidery/compound-file-common.h | Drahflow/Embroidermodder | 5fe2bed6407845e9d183aee40095b3f778a5b559 | [
"Zlib"
] | 3 | 2017-05-18T13:57:43.000Z | 2018-08-13T14:56:33.000Z | libembroidery/compound-file-common.h | Drahflow/Embroidermodder | 5fe2bed6407845e9d183aee40095b3f778a5b559 | [
"Zlib"
] | null | null | null | libembroidery/compound-file-common.h | Drahflow/Embroidermodder | 5fe2bed6407845e9d183aee40095b3f778a5b559 | [
"Zlib"
] | null | null | null | /*! @file compound-file-common.h */
#ifndef COMPOUND_FILE_COMMON_H
#define COMPOUND_FILE_COMMON_H
#include "api-start.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
Type of sector
*/
#define CompoundFileSector_MaxRegSector 0xFFFFFFFA
#define CompoundFileSector_DIFAT_Sector 0xFFFFFFFC
#define CompoundFileSector_FAT_Sector 0xFFFFFFFD
#define CompoundFileSector_EndOfChain 0xFFFFFFFE
#define CompoundFileSector_FreeSector 0xFFFFFFFF
/**
Type of directory object
*/
#define ObjectTypeUnknown 0x00 /*!< Probably unallocated */
#define ObjectTypeStorage 0x01 /*!< a directory type object */
#define ObjectTypeStream 0x02 /*!< a file type object */
#define ObjectTypeRootEntry 0x05 /*!< the root entry */
/**
Special values for Stream Identifiers
*/
#define CompoundFileStreamId_MaxRegularStreamId 0xFFFFFFFA /*!< All real stream Ids are less than this */
#define CompoundFileStreamId_NoStream 0xFFFFFFFF /*!< There is no valid stream Id */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#include "api-stop.h"
#endif /* COMPOUND_FILE_COMMON_H */
/* kate: bom off; indent-mode cstyle; indent-width 4; replace-trailing-space-save on; */
| 28.404762 | 105 | 0.740989 | [
"object"
] |
9bea380fdea96586ed4106d3653b9d16f23b8515 | 640 | h | C | test/unit-tests/metafs/mvm/volume/volume_catalog_manager_mock.h | YongJin-Cho/poseidonos | c07a0240316d4536aa09f22d7977604f3650d752 | [
"BSD-3-Clause"
] | null | null | null | test/unit-tests/metafs/mvm/volume/volume_catalog_manager_mock.h | YongJin-Cho/poseidonos | c07a0240316d4536aa09f22d7977604f3650d752 | [
"BSD-3-Clause"
] | null | null | null | test/unit-tests/metafs/mvm/volume/volume_catalog_manager_mock.h | YongJin-Cho/poseidonos | c07a0240316d4536aa09f22d7977604f3650d752 | [
"BSD-3-Clause"
] | null | null | null | #include <gmock/gmock.h>
#include <list>
#include <string>
#include <vector>
#include "src/metafs/mvm/volume/volume_catalog_manager.h"
namespace pos
{
class MockVolumeCatalogManager : public VolumeCatalogManager
{
public:
using VolumeCatalogManager::VolumeCatalogManager;
MOCK_METHOD(void, Init, (MetaVolumeType volumeType, MetaLpnType regionBaseLpn, MetaLpnType maxVolumeLpn), (override));
MOCK_METHOD(MetaLpnType, GetRegionSizeInLpn, (), (override));
MOCK_METHOD(void, Bringup, (), (override));
MOCK_METHOD(bool, SaveContent, (), (override));
MOCK_METHOD(void, Finalize, (), (override));
};
} // namespace pos
| 27.826087 | 122 | 0.740625 | [
"vector"
] |
9bede82b7c3627ba7cf855225adfcb61d4e39f2e | 32,751 | h | C | vs2015/tesseract304/BaseApiWinRT.h | yoisel/tesseract | efee76ea374966e585c7370d5631eebef2f609f0 | [
"Apache-2.0"
] | 8 | 2015-12-08T14:52:31.000Z | 2021-09-15T19:50:05.000Z | vs2015/tesseract304/BaseApiWinRT.h | yoisel/tesseract | efee76ea374966e585c7370d5631eebef2f609f0 | [
"Apache-2.0"
] | null | null | null | vs2015/tesseract304/BaseApiWinRT.h | yoisel/tesseract | efee76ea374966e585c7370d5631eebef2f609f0 | [
"Apache-2.0"
] | 2 | 2016-12-10T04:32:39.000Z | 2020-11-13T08:16:22.000Z | /**********************************************************************
* File: BaseApiWinRT.cpp
* Description: BaseApi class wrapper for interop with WinRT/WinPhone Apps
* Author: Yoisel Melis Santana
* Created: Oct 14 2015
*
** 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
namespace Tesseract
{
public enum class OcrEngineMode {
OEM_TESSERACT_ONLY = tesseract::OcrEngineMode::OEM_TESSERACT_ONLY, // Run Tesseract only - fastest
OEM_CUBE_ONLY = tesseract::OcrEngineMode::OEM_CUBE_ONLY, // Run Cube only - better accuracy, but slower
OEM_TESSERACT_CUBE_COMBINED = tesseract::OcrEngineMode::OEM_TESSERACT_CUBE_COMBINED, // Run both and combine results - best accuracy
OEM_DEFAULT = tesseract::OcrEngineMode::OEM_TESSERACT_CUBE_COMBINED
// Specify this mode when calling init_*(),
// to indicate that any of the above modes
// should be automatically inferred from the
// variables in the language-specific config,
// command-line configs, or if not specified
// in any of the above should be set to the
// default OEM_TESSERACT_ONLY.
};
class InitData
{
public:
inline ~InitData()
{
if (_configs_size > 0)
{
for (int i = 0; i < _configs_size; i++)
{
delete[] _configs[i];
}
delete[] _configs;
}
if (_vars_vec != 0)
delete _vars_vec;
if (_vars_values != 0)
delete _vars_values;
}
char ** _configs = NULL;
int _configs_size = 0;
GenericVector<STRING> * _vars_vec = NULL;
GenericVector<STRING> * _vars_values = NULL;
};
#define IfFailedThrowHR(expr) {HRESULT hr = (expr); if (FAILED(hr)) throw hr;}
public ref class BaseApiWinRT sealed
{
public:
BaseApiWinRT();
/**
* Returns the version identifier as a string.
*/
Platform::String^ Version()
{
USES_CONVERSION;
return ref new Platform::String( A2W_CP(tesseract::TessBaseAPI::Version(), CP_UTF8));
}
/**
* Set the value of an internal "parameter."
* Supply the name of the parameter and the value as a string, just as
* you would in a config file.
* Returns false if the name lookup failed.
* Eg SetVariable("tessedit_char_blacklist", "xyz"); to ignore x, y and z.
* Or SetVariable("classify_bln_numeric_mode", "1"); to set numeric-only mode.
* SetVariable may be used before Init, but settings will revert to
* defaults on End().
*
* Note: Must be called after Init(). Only works for non-init variables
* (init variables should be passed to Init()).
*/
bool SetVariable(Platform::String^ name, Platform::String^ value)
{
USES_CONVERSION;
return baseAPI->SetVariable(W2A_CP(name->Data(), CP_UTF8), W2A_CP(value->Data(), CP_UTF8));
}
bool SetDebugVariable(Platform::String^ name, Platform::String^ value)
{
USES_CONVERSION;
return baseAPI->SetDebugVariable(W2A_CP(name->Data(), CP_UTF8), W2A_CP(value->Data(), CP_UTF8));
}
/**
* Returns true if the parameter was found among Tesseract parameters.
* Fills in value with the value of the parameter.
*/
bool GetIntVariable( Platform::String^ name, int *value)
{
USES_CONVERSION;
if (!value || name == nullptr)
return false;
return baseAPI->GetIntVariable(W2A_CP(name->Data(), CP_UTF8), value);
}
bool GetBoolVariable( Platform::String^ name, bool *value)
{
USES_CONVERSION;
if (!value || name == nullptr)
return false;
return baseAPI->GetBoolVariable(W2A_CP(name->Data(), CP_UTF8), value);
}
bool GetDoubleVariable(Platform::String^ name, double *value)
{
USES_CONVERSION;
if (!value || name == nullptr)
return false;
return baseAPI->GetDoubleVariable(W2A_CP(name->Data(), CP_UTF8), value);
}
/**
* Returns the pointer to the string that represents the value of the
* parameter if it was found among Tesseract parameters.
*/
Platform::String^ GetStringVariable(Platform::String^ name)
{
USES_CONVERSION;
if (name == nullptr)
return nullptr;
return ref new Platform::String( A2W(baseAPI->GetStringVariable(W2A_CP(name->Data(), CP_UTF8))));
}
/**
* Get value of named variable as a string, if it exists.
* Returns nulptr if it does not exist.
*/
Platform::String^ GetVariableAsString(Platform::String^ name)
{
USES_CONVERSION;
if (name == nullptr)
return nullptr;
STRING strVal;
char * nameAux = W2A_CP(name->Data(), CP_UTF8);
bool result = baseAPI->GetVariableAsString(nameAux, &strVal);
return result ? ref new Platform::String( A2W(strVal.c_str()) ) : nullptr;
}
/**
* Instances are now mostly thread-safe and totally independent,
* but some global parameters remain. Basically it is safe to use multiple
* TessBaseAPIs in different threads in parallel, UNLESS:
* you use SetVariable on some of the Params in classify and textord.
* If you do, then the effect will be to change it for all your instances.
*
* Start tesseract. Returns zero on success and -1 on failure.
* NOTE that the only members that may be called before Init are those
* listed above here in the class definition.
*
* The datapath must be the name of the parent directory of tessdata and
* must end in / . Any name after the last / will be stripped.
* The language is (usually) an ISO 639-3 string or NULL will default to eng.
* It is entirely safe (and eventually will be efficient too) to call
* Init multiple times on the same instance to change language, or just
* to reset the classifier.
* The language may be a string of the form [~]<lang>[+[~]<lang>]* indicating
* that multiple languages are to be loaded. Eg hin+eng will load Hindi and
* English. Languages may specify internally that they want to be loaded
* with one or more other languages, so the ~ sign is available to override
* that. Eg if hin were set to load eng by default, then hin+~eng would force
* loading only hin. The number of loaded languages is limited only by
* memory, with the caveat that loading additional languages will impact
* both speed and accuracy, as there is more work to do to decide on the
* applicable language, and there is more chance of hallucinating incorrect
* words.
* WARNING: On changing languages, all Tesseract parameters are reset
* back to their default values. (Which may vary between languages.)
* If you have a rare need to set a Variable that controls
* initialization for a second call to Init you should explicitly
* call End() and then use SetVariable before Init. This is only a very
* rare use case, since there are very few uses that require any parameters
* to be set before Init.
*
* If set_only_non_debug_params is true, only params that do not contain
* "debug" in the name will be set.
*/
Windows::Foundation::IAsyncOperation<int>^ InitAsync(Platform::String^ datapath, Platform::String^ language, OcrEngineMode mode,
const Platform::Array<Platform::String^> ^ configs,
const Platform::Array<Platform::String^> ^ vars_vec,
const Platform::Array<Platform::String^> ^ vars_values,
bool set_only_non_debug_params);
Windows::Foundation::IAsyncOperation<int>^ InitAsync(Platform::String^ datapath, Platform::String^ language, OcrEngineMode mode) {
return InitAsync(datapath, language, mode, nullptr, nullptr, nullptr, false);
}
Windows::Foundation::IAsyncOperation<int>^ InitAsync(Platform::String^ datapath, Platform::String^ language) {
return InitAsync( datapath, language, OcrEngineMode::OEM_DEFAULT, nullptr, nullptr, nullptr, false);
}
/**
* Returns the languages string used in the last valid initialization.
* If the last initialization specified "deu+hin" then that will be
* returned. If hin loaded eng automatically as well, then that will
* not be included in this list. To find the languages actually
* loaded use GetLoadedLanguagesAsVector.
* The returned string should NOT be deleted.
*/
Platform::String^ GetInitLanguagesAsString()
{
USES_CONVERSION;
return ref new Platform::String(A2W_CP(baseAPI->GetInitLanguagesAsString(), CP_UTF8));
}
/**
* Recognize a rectangle from an image and return the result as a string.
* May be called many times for a single Init.
* Currently has no error checking.
*/
Windows::Foundation::IAsyncOperation<Platform::String^>^ TesseractRectAsync(
Windows::Storage::Streams::IRandomAccessStream ^ inputImage, Windows::Foundation::Rect rect);
/**
* Provide an image for Tesseract to recognize. Format is as TesseractRectAsync above.
* SetImage clears all recognition results, and sets the rectangle to the
* full image, so it may be followed immediately by a GetUTF8TextAsync, and it
* will automatically perform recognition.
*/
void SetImage(Windows::Storage::Streams::IRandomAccessStream ^ inputImage);
/**
* The recognized text is returned as a char* which is coded
* as UTF8 and must be freed with the delete [] operator.
*/
Windows::Foundation::IAsyncOperation<Platform::String^>^ GetUTF8TextAsync();
/**
* Set the resolution of the source image in pixels per inch so font size
* information can be calculated in results. Call this after SetImage().
*/
void SetSourceResolution(int ppi);
/**
* Restrict recognition to a sub-rectangle of the image. Call after SetImage.
* Each SetRectangle clears the recogntion results so multiple rectangles
* can be recognized with the same image.
*/
void SetRectangle(int left, int top, int width, int height);
/**
* Free up recognition results and any stored image data, without actually
* freeing any recognition data that would be time-consuming to reload.
* Afterwards, you must call SetImage or TesseractRect before doing
* any Recognize or Get* operation.
*/
void Clear();
/**
* Close down tesseract and free up all memory. End() is equivalent to
* destructing and reconstructing your TessBaseAPI.
* Once End() has been used, none of the other API functions may be used
* other than Init and anything declared above it in the class definition.
*/
void End();
private:
tesseract::TessBaseAPI * baseAPI;
~BaseApiWinRT();
void GetBitmapLockFromWinRTStream(Windows::Storage::Streams::IRandomAccessStream ^ inputImage, CComPtr<IWICBitmapLock> & m_pBitmapLock, UINT & imageWidth, UINT & imageHeight);
#if 0
/**
* Returns the loaded languages in the vector of STRINGs.
* Includes all languages loaded by the last Init, including those loaded
* as dependencies of other loaded languages.
*/
void GetLoadedLanguagesAsVector(GenericVector<STRING>* langs) const;
/**
* Returns the available languages in the vector of STRINGs.
*/
void GetAvailableLanguagesAsVector(GenericVector<STRING>* langs) const;
/**
* Init only the lang model component of Tesseract. The only functions
* that work after this init are SetVariable and IsValidWord.
* WARNING: temporary! This function will be removed from here and placed
* in a separate API at some future time.
*/
int InitLangMod(const char* datapath, const char* language);
/**
* Init only for page layout analysis. Use only for calls to SetImage and
* AnalysePage. Calls that attempt recognition will generate an error.
*/
void InitForAnalysePage();
/**
* Read a "config" file containing a set of param, value pairs.
* Searches the standard places: tessdata/configs, tessdata/tessconfigs
* and also accepts a relative or absolute path name.
* Note: only non-init params will be set (init params are set by Init()).
*/
void ReadConfigFile(const char* filename);
/** Same as above, but only set debug params from the given config file. */
void ReadDebugConfigFile(const char* filename);
/**
* Set the current page segmentation mode. Defaults to PSM_SINGLE_BLOCK.
* The mode is stored as an IntParam so it can also be modified by
* ReadConfigFile or SetVariable("tessedit_pageseg_mode", mode as string).
*/
void SetPageSegMode(PageSegMode mode);
/** Return the current page segmentation mode. */
PageSegMode GetPageSegMode() const;
/**
* Recognize a rectangle from an image and return the result as a string.
* May be called many times for a single Init.
* Currently has no error checking.
* Greyscale of 8 and color of 24 or 32 bits per pixel may be given.
* Palette color images will not work properly and must be converted to
* 24 bit.
* Binary images of 1 bit per pixel may also be given but they must be
* byte packed with the MSB of the first byte being the first pixel, and a
* 1 represents WHITE. For binary images set bytes_per_pixel=0.
* The recognized text is returned as a char* which is coded
* as UTF8 and must be freed with the delete [] operator.
*
* Note that TesseractRect is the simplified convenience interface.
* For advanced uses, use SetImage, (optionally) SetRectangle, Recognize,
* and one or more of the Get*Text functions below.
*/
char* TesseractRect(const unsigned char* imagedata,
int bytes_per_pixel, int bytes_per_line,
int left, int top, int width, int height);
/**
* Call between pages or documents etc to free up memory and forget
* adaptive data.
*/
void ClearAdaptiveClassifier();
/**
* @defgroup AdvancedAPI Advanced API
* The following methods break TesseractRect into pieces, so you can
* get hold of the thresholded image, get the text in different formats,
* get bounding boxes, confidences etc.
*/
/* @{ */
/**
* Provide an image for Tesseract to recognize. Format is as
* TesseractRect above. Does not copy the image buffer, or take
* ownership. The source image may be destroyed after Recognize is called,
* either explicitly or implicitly via one of the Get*Text functions.
* SetImage clears all recognition results, and sets the rectangle to the
* full image, so it may be followed immediately by a GetUTF8Text, and it
* will automatically perform recognition.
*/
void SetImage(const unsigned char* imagedata, int width, int height,
int bytes_per_pixel, int bytes_per_line);
/**
* Provide an image for Tesseract to recognize. As with SetImage above,
* Tesseract doesn't take a copy or ownership or pixDestroy the image, so
* it must persist until after Recognize.
* Pix vs raw, which to use?
* Use Pix where possible. A future version of Tesseract may choose to use Pix
* as its internal representation and discard IMAGE altogether.
* Because of that, an implementation that sources and targets Pix may end up
* with less copies than an implementation that does not.
*/
void SetImage(Pix* pix);
/**
* Set the resolution of the source image in pixels per inch so font size
* information can be calculated in results. Call this after SetImage().
*/
void SetSourceResolution(int ppi);
/**
* Restrict recognition to a sub-rectangle of the image. Call after SetImage.
* Each SetRectangle clears the recogntion results so multiple rectangles
* can be recognized with the same image.
*/
void SetRectangle(int left, int top, int width, int height);
/**
* In extreme cases only, usually with a subclass of Thresholder, it
* is possible to provide a different Thresholder. The Thresholder may
* be preloaded with an image, settings etc, or they may be set after.
* Note that Tesseract takes ownership of the Thresholder and will
* delete it when it it is replaced or the API is destructed.
*/
void SetThresholder(ImageThresholder* thresholder) {
if (thresholder_ != NULL)
delete thresholder_;
thresholder_ = thresholder;
ClearResults();
}
/**
* Get a copy of the internal thresholded image from Tesseract.
* Caller takes ownership of the Pix and must pixDestroy it.
* May be called any time after SetImage, or after TesseractRect.
*/
Pix* GetThresholdedImage();
/**
* Get the result of page layout analysis as a leptonica-style
* Boxa, Pixa pair, in reading order.
* Can be called before or after Recognize.
*/
Boxa* GetRegions(Pixa** pixa);
/**
* Get the textlines as a leptonica-style
* Boxa, Pixa pair, in reading order.
* Can be called before or after Recognize.
* If raw_image is true, then extract from the original image instead of the
* thresholded image and pad by raw_padding pixels.
* If blockids is not NULL, the block-id of each line is also returned as an
* array of one element per line. delete [] after use.
* If paraids is not NULL, the paragraph-id of each line within its block is
* also returned as an array of one element per line. delete [] after use.
*/
Boxa* GetTextlines(const bool raw_image, const int raw_padding,
Pixa** pixa, int** blockids, int** paraids);
/*
Helper method to extract from the thresholded image. (most common usage)
*/
Boxa* GetTextlines(Pixa** pixa, int** blockids) {
return GetTextlines(false, 0, pixa, blockids, NULL);
}
/**
* Get textlines and strips of image regions as a leptonica-style Boxa, Pixa
* pair, in reading order. Enables downstream handling of non-rectangular
* regions.
* Can be called before or after Recognize.
* If blockids is not NULL, the block-id of each line is also returned as an
* array of one element per line. delete [] after use.
*/
Boxa* GetStrips(Pixa** pixa, int** blockids);
/**
* Get the words as a leptonica-style
* Boxa, Pixa pair, in reading order.
* Can be called before or after Recognize.
*/
Boxa* GetWords(Pixa** pixa);
/**
* Gets the individual connected (text) components (created
* after pages segmentation step, but before recognition)
* as a leptonica-style Boxa, Pixa pair, in reading order.
* Can be called before or after Recognize.
* Note: the caller is responsible for calling boxaDestroy()
* on the returned Boxa array and pixaDestroy() on cc array.
*/
Boxa* GetConnectedComponents(Pixa** cc);
/**
* Get the given level kind of components (block, textline, word etc.) as a
* leptonica-style Boxa, Pixa pair, in reading order.
* Can be called before or after Recognize.
* If blockids is not NULL, the block-id of each component is also returned
* as an array of one element per component. delete [] after use.
* If blockids is not NULL, the paragraph-id of each component with its block
* is also returned as an array of one element per component. delete [] after
* use.
* If raw_image is true, then portions of the original image are extracted
* instead of the thresholded image and padded with raw_padding.
* If text_only is true, then only text components are returned.
*/
Boxa* GetComponentImages(const PageIteratorLevel level,
const bool text_only, const bool raw_image,
const int raw_padding,
Pixa** pixa, int** blockids, int** paraids);
// Helper function to get binary images with no padding (most common usage).
Boxa* GetComponentImages(const PageIteratorLevel level,
const bool text_only,
Pixa** pixa, int** blockids) {
return GetComponentImages(level, text_only, false, 0, pixa, blockids, NULL);
}
/**
* Returns the scale factor of the thresholded image that would be returned by
* GetThresholdedImage() and the various GetX() methods that call
* GetComponentImages().
* Returns 0 if no thresholder has been set.
*/
int GetThresholdedImageScaleFactor() const;
/**
* Dump the internal binary image to a PGM file.
* @deprecated Use GetThresholdedImage and write the image using pixWrite
* instead if possible.
*/
void DumpPGM(const char* filename);
/**
* Runs page layout analysis in the mode set by SetPageSegMode.
* May optionally be called prior to Recognize to get access to just
* the page layout results. Returns an iterator to the results.
* If merge_similar_words is true, words are combined where suitable for use
* with a line recognizer. Use if you want to use AnalyseLayout to find the
* textlines, and then want to process textline fragments with an external
* line recognizer.
* Returns NULL on error or an empty page.
* The returned iterator must be deleted after use.
* WARNING! This class points to data held within the TessBaseAPI class, and
* therefore can only be used while the TessBaseAPI class still exists and
* has not been subjected to a call of Init, SetImage, Recognize, Clear, End
* DetectOS, or anything else that changes the internal PAGE_RES.
*/
PageIterator* AnalyseLayout() {
return AnalyseLayout(false);
}
PageIterator* AnalyseLayout(bool merge_similar_words);
/**
* Recognize the image from SetAndThresholdImage, generating Tesseract
* internal structures. Returns 0 on success.
* Optional. The Get*Text functions below will call Recognize if needed.
* After Recognize, the output is kept internally until the next SetImage.
*/
int Recognize(ETEXT_DESC* monitor);
/**
* Methods to retrieve information after SetAndThresholdImage(),
* Recognize() or TesseractRect(). (Recognize is called implicitly if needed.)
*/
/** Variant on Recognize used for testing chopper. */
int RecognizeForChopTest(ETEXT_DESC* monitor);
/**
* Turns images into symbolic text.
*
* filename can point to a single image, a multi-page TIFF,
* or a plain text list of image filenames.
*
* retry_config is useful for debugging. If not NULL, you can fall
* back to an alternate configuration if a page fails for some
* reason.
*
* timeout_millisec terminates processing if any single page
* takes too long. Set to 0 for unlimited time.
*
* renderer is responible for creating the output. For example,
* use the TessTextRenderer if you want plaintext output, or
* the TessPDFRender to produce searchable PDF.
*
* If tessedit_page_number is non-negative, will only process that
* single page. Works for multi-page tiff file, or filelist.
*
* Returns true if successful, false on error.
*/
bool ProcessPages(const char* filename, const char* retry_config,
int timeout_millisec, TessResultRenderer* renderer);
// Does the real work of ProcessPages.
bool ProcessPagesInternal(const char* filename, const char* retry_config,
int timeout_millisec, TessResultRenderer* renderer);
/**
* Turn a single image into symbolic text.
*
* The pix is the image processed. filename and page_index are
* metadata used by side-effect processes, such as reading a box
* file or formatting as hOCR.
*
* See ProcessPages for desciptions of other parameters.
*/
bool ProcessPage(Pix* pix, int page_index, const char* filename,
const char* retry_config, int timeout_millisec,
TessResultRenderer* renderer);
/**
* Get a reading-order iterator to the results of LayoutAnalysis and/or
* Recognize. The returned iterator must be deleted after use.
* WARNING! This class points to data held within the TessBaseAPI class, and
* therefore can only be used while the TessBaseAPI class still exists and
* has not been subjected to a call of Init, SetImage, Recognize, Clear, End
* DetectOS, or anything else that changes the internal PAGE_RES.
*/
ResultIterator* GetIterator();
/**
* Get a mutable iterator to the results of LayoutAnalysis and/or Recognize.
* The returned iterator must be deleted after use.
* WARNING! This class points to data held within the TessBaseAPI class, and
* therefore can only be used while the TessBaseAPI class still exists and
* has not been subjected to a call of Init, SetImage, Recognize, Clear, End
* DetectOS, or anything else that changes the internal PAGE_RES.
*/
MutableIterator* GetMutableIterator();
/**
* The recognized text is returned as a char* which is coded
* as UTF8 and must be freed with the delete [] operator.
*/
char* GetUTF8Text();
/**
* Make a HTML-formatted string with hOCR markup from the internal
* data structures.
* page_number is 0-based but will appear in the output as 1-based.
*/
char* GetHOCRText(int page_number);
/**
* The recognized text is returned as a char* which is coded in the same
* format as a box file used in training. Returned string must be freed with
* the delete [] operator.
* Constructs coordinates in the original image - not just the rectangle.
* page_number is a 0-based page index that will appear in the box file.
*/
char* GetBoxText(int page_number);
/**
* The recognized text is returned as a char* which is coded
* as UNLV format Latin-1 with specific reject and suspect codes
* and must be freed with the delete [] operator.
*/
char* GetUNLVText();
/** Returns the (average) confidence value between 0 and 100. */
int MeanTextConf();
/**
* Returns all word confidences (between 0 and 100) in an array, terminated
* by -1. The calling function must delete [] after use.
* The number of confidences should correspond to the number of space-
* delimited words in GetUTF8Text.
*/
int* AllWordConfidences();
/**
* Applies the given word to the adaptive classifier if possible.
* The word must be SPACE-DELIMITED UTF-8 - l i k e t h i s , so it can
* tell the boundaries of the graphemes.
* Assumes that SetImage/SetRectangle have been used to set the image
* to the given word. The mode arg should be PSM_SINGLE_WORD or
* PSM_CIRCLE_WORD, as that will be used to control layout analysis.
* The currently set PageSegMode is preserved.
* Returns false if adaption was not possible for some reason.
*/
bool AdaptToWordStr(PageSegMode mode, const char* wordstr);
/**
* Free up recognition results and any stored image data, without actually
* freeing any recognition data that would be time-consuming to reload.
* Afterwards, you must call SetImage or TesseractRect before doing
* any Recognize or Get* operation.
*/
void Clear();
/**
* Close down tesseract and free up all memory. End() is equivalent to
* destructing and reconstructing your TessBaseAPI.
* Once End() has been used, none of the other API functions may be used
* other than Init and anything declared above it in the class definition.
*/
void End();
/**
* Clear any library-level memory caches.
* There are a variety of expensive-to-load constant data structures (mostly
* language dictionaries) that are cached globally -- surviving the Init()
* and End() of individual TessBaseAPI's. This function allows the clearing
* of these caches.
**/
static void ClearPersistentCache();
/**
* Check whether a word is valid according to Tesseract's language model
* @return 0 if the word is invalid, non-zero if valid.
* @warning temporary! This function will be removed from here and placed
* in a separate API at some future time.
*/
int IsValidWord(const char *word);
// Returns true if utf8_character is defined in the UniCharset.
bool IsValidCharacter(const char *utf8_character);
bool GetTextDirection(int* out_offset, float* out_slope);
/** Sets Dict::letter_is_okay_ function to point to the given function. */
void SetDictFunc(DictFunc f);
/** Sets Dict::probability_in_context_ function to point to the given
* function.
*/
void SetProbabilityInContextFunc(ProbabilityInContextFunc f);
/** Sets Wordrec::fill_lattice_ function to point to the given function. */
void SetFillLatticeFunc(FillLatticeFunc f);
/**
* Estimates the Orientation And Script of the image.
* @return true if the image was processed successfully.
*/
bool DetectOS(OSResults*);
/** This method returns the features associated with the input image. */
void GetFeaturesForBlob(TBLOB* blob, INT_FEATURE_STRUCT* int_features,
int* num_features, int* feature_outline_index);
/**
* This method returns the row to which a box of specified dimensions would
* belong. If no good match is found, it returns NULL.
*/
static ROW* FindRowForBox(BLOCK_LIST* blocks, int left, int top,
int right, int bottom);
/**
* Method to run adaptive classifier on a blob.
* It returns at max num_max_matches results.
*/
void RunAdaptiveClassifier(TBLOB* blob,
int num_max_matches,
int* unichar_ids,
float* ratings,
int* num_matches_returned);
/** This method returns the string form of the specified unichar. */
const char* GetUnichar(int unichar_id);
/** Return the pointer to the i-th dawg loaded into tesseract_ object. */
const Dawg *GetDawg(int i) const;
/** Return the number of dawgs loaded into tesseract_ object. */
int NumDawgs() const;
/** Returns a ROW object created from the input row specification. */
static ROW *MakeTessOCRRow(float baseline, float xheight,
float descender, float ascender);
/** Returns a TBLOB corresponding to the entire input image. */
static TBLOB *MakeTBLOB(Pix *pix);
/**
* This method baseline normalizes a TBLOB in-place. The input row is used
* for normalization. The denorm is an optional parameter in which the
* normalization-antidote is returned.
*/
static void NormalizeTBLOB(TBLOB *tblob, ROW *row, bool numeric_mode);
Tesseract* const tesseract() const {
return tesseract_;
}
OcrEngineMode const oem() const {
return last_oem_requested_;
}
void InitTruthCallback(TruthCallback *cb) { truth_cb_ = cb; }
#ifndef NO_CUBE_BUILD
/** Return a pointer to underlying CubeRecoContext object if present. */
CubeRecoContext *GetCubeRecoContext() const;
#endif // NO_CUBE_BUILD
void set_min_orientation_margin(double margin);
/**
* Return text orientation of each block as determined by an earlier run
* of layout analysis.
*/
void GetBlockTextOrientations(int** block_orientation,
bool** vertical_writing);
/** Find lines from the image making the BLOCK_LIST. */
BLOCK_LIST* FindLinesCreateBlockList();
/**
* Delete a block list.
* This is to keep BLOCK_LIST pointer opaque
* and let go of including the other headers.
*/
static void DeleteBlockList(BLOCK_LIST* block_list);
/* @} */
protected:
/** Common code for setting the image. Returns true if Init has been called. */
TESS_LOCAL bool InternalSetImage();
/**
* Run the thresholder to make the thresholded image. If pix is not NULL,
* the source is thresholded to pix instead of the internal IMAGE.
*/
TESS_LOCAL virtual void Threshold(Pix** pix);
/**
* Find lines from the image making the BLOCK_LIST.
* @return 0 on success.
*/
TESS_LOCAL int FindLines();
/** Delete the pageres and block list ready for a new page. */
void ClearResults();
/**
* Return an LTR Result Iterator -- used only for training, as we really want
* to ignore all BiDi smarts at that point.
* delete once you're done with it.
*/
TESS_LOCAL LTRResultIterator* GetLTRIterator();
/**
* Return the length of the output text string, as UTF8, assuming
* one newline per line and one per block, with a terminator,
* and assuming a single character reject marker for each rejected character.
* Also return the number of recognized blobs in blob_count.
*/
TESS_LOCAL int TextLength(int* blob_count);
/** @defgroup ocropusAddOns ocropus add-ons */
/* @{ */
/**
* Adapt to recognize the current image as the given character.
* The image must be preloaded and be just an image of a single character.
*/
TESS_LOCAL void AdaptToCharacter(const char *unichar_repr,
int length,
float baseline,
float xheight,
float descender,
float ascender);
/** Recognize text doing one pass only, using settings for a given pass. */
TESS_LOCAL PAGE_RES* RecognitionPass1(BLOCK_LIST* block_list);
TESS_LOCAL PAGE_RES* RecognitionPass2(BLOCK_LIST* block_list,
PAGE_RES* pass1_result);
//// paragraphs.cpp ////////////////////////////////////////////////////
TESS_LOCAL void DetectParagraphs(bool after_text_recognition);
/**
* Extract the OCR results, costs (penalty points for uncertainty),
* and the bounding boxes of the characters.
*/
TESS_LOCAL static int TesseractExtractResult(char** text,
int** lengths,
float** costs,
int** x0,
int** y0,
int** x1,
int** y1,
PAGE_RES* page_res);
TESS_LOCAL const PAGE_RES* GetPageRes() const {
return page_res_;
};
/* @} */
#endif
};
}
| 36.965011 | 177 | 0.716253 | [
"object",
"vector",
"model"
] |
9bf6316d0c75c99b7bc096f5b42fb354cc72f29c | 4,683 | c | C | sdl2/edgar-1.31/src/enemy/summoner.c | pdpdds/SDLGameProgramming | 3af68e2133296f3e7bc3d7454d9301141bca2d5a | [
"BSD-2-Clause"
] | null | null | null | sdl2/edgar-1.31/src/enemy/summoner.c | pdpdds/SDLGameProgramming | 3af68e2133296f3e7bc3d7454d9301141bca2d5a | [
"BSD-2-Clause"
] | null | null | null | sdl2/edgar-1.31/src/enemy/summoner.c | pdpdds/SDLGameProgramming | 3af68e2133296f3e7bc3d7454d9301141bca2d5a | [
"BSD-2-Clause"
] | null | null | null | /*
Copyright (C) 2009-2019 Parallel Realities
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/
#include "../headers.h"
#include "../audio/audio.h"
#include "../collisions.h"
#include "../entity.h"
#include "../geometry.h"
#include "../graphics/animation.h"
#include "../system/error.h"
#include "../system/properties.h"
#include "../system/random.h"
#include "enemies.h"
extern Entity *self, player;
extern Game game;
static void lookForPlayer(void);
static void summon(void);
static void summonWait(void);
static void hover(void);
static void summonEnd(void);
static void die(void);
static void creditsMove(void);
Entity *addSummoner(int x, int y, char *name)
{
Entity *e = getFreeEntity();
if (e == NULL)
{
showErrorAndExit("No free slots to add a Summoner");
}
loadProperties(name, e);
e->x = x;
e->y = y;
e->action = &lookForPlayer;
e->draw = &drawLoopingAnimationToMap;
e->die = ¨
e->takeDamage = &entityTakeDamageNoFlinch;
e->reactToBlock = &changeDirection;
e->touch = &entityTouch;
e->creditsAction = &creditsMove;
e->type = ENEMY;
setEntityAnimation(e, "STAND");
return e;
}
static void lookForPlayer()
{
float dirX;
self->thinkTime--;
if (self->dirX == 0)
{
self->dirX = self->face == LEFT ? self->speed : -self->speed;
}
self->face = self->dirX > 0 ? RIGHT : LEFT;
dirX = self->dirX;
checkToMap(self);
if (self->dirX == 0 && dirX != 0)
{
self->dirX = self->face == LEFT ? self->speed : -self->speed;
self->face = self->face == LEFT ? RIGHT : LEFT;
}
if (self->thinkTime <= 0 && player.health > 0 && prand() % 30 == 0)
{
self->thinkTime = 0;
if (collision(self->x + (self->face == RIGHT ? self->w : -160), self->y, 160, 200, player.x, player.y, player.w, player.h) == 1)
{
self->action = &summonWait;
setEntityAnimation(self, "ATTACK_1");
self->animationCallback = &summon;
self->dirX = 0;
}
}
hover();
}
static void summonWait()
{
checkToMap(self);
hover();
}
static void summon()
{
char summonList[MAX_VALUE_LENGTH], enemyToSummon[MAX_VALUE_LENGTH];
char *token;
int summonIndex = 0, summonCount = 0;
Entity *e;
STRNCPY(summonList, self->requires, MAX_VALUE_LENGTH);
token = strtok(summonList, "|");
while (token != NULL)
{
token = strtok(NULL, "|");
summonCount++;
}
if (summonCount == 0)
{
showErrorAndExit("Summoner at %f %f has no summon list", self->x, self->y);
}
summonIndex = prand() % summonCount;
STRNCPY(summonList, self->requires, MAX_VALUE_LENGTH);
summonCount = 0;
token = strtok(summonList, "|");
while (token != NULL)
{
if (summonCount == summonIndex)
{
break;
}
token = strtok(NULL, "|");
summonCount++;
}
snprintf(enemyToSummon, MAX_VALUE_LENGTH, "enemy/%s", token);
e = addEnemy(enemyToSummon, self->x, self->y);
e->targetX = self->x;
e->targetY = self->y;
e->x = e->targetX;
e->y = e->targetY;
calculatePath(e->x, e->y, e->targetX, e->targetY, &e->dirX, &e->dirY);
e->flags |= (NO_DRAW|HELPLESS|TELEPORTING);
self->action = &summonWait;
self->creditsAction = &summonWait;
setEntityAnimation(self, "ATTACK_2");
self->animationCallback = &summonEnd;
}
static void hover()
{
self->startX++;
if (self->startX >= 360)
{
self->startX = 0;
}
self->y = self->startY + sin(DEG_TO_RAD(self->startX)) * 8;
}
static void summonEnd()
{
setEntityAnimation(self, "STAND");
self->action = &lookForPlayer;
self->creditsAction = &creditsMove;
self->dirX = self->face == LEFT ? -self->speed : self->speed;
self->thinkTime = 600;
}
static void die()
{
playSoundToMap("sound/enemy/gazer/gazer_die", -1, self->x, self->y, 0);
self->dirY = 0;
entityDie();
}
static void creditsMove()
{
hover();
self->thinkTime++;
self->dirX = self->speed;
checkToMap(self);
if (self->dirX == 0)
{
self->inUse = FALSE;
}
if (self->thinkTime == 180)
{
STRNCPY(self->requires, "armadillo", MAX_VALUE_LENGTH);
self->creditsAction = &summonWait;
setEntityAnimation(self, "ATTACK_1");
self->animationCallback = &summon;
self->dirX = 0;
}
}
| 18.509881 | 130 | 0.663891 | [
"geometry"
] |
9bfebf9cfb0f9fa7bc76c82d9d9b0a566f298be6 | 2,870 | h | C | searchlib/src/vespa/searchlib/fef/featurenameparser.h | amahussein/vespa | 29d266ae1e5c95e25002b97822953fdd02b1451e | [
"Apache-2.0"
] | 1 | 2018-12-30T05:42:18.000Z | 2018-12-30T05:42:18.000Z | searchlib/src/vespa/searchlib/fef/featurenameparser.h | amahussein/vespa | 29d266ae1e5c95e25002b97822953fdd02b1451e | [
"Apache-2.0"
] | 1 | 2021-03-31T22:27:25.000Z | 2021-03-31T22:27:25.000Z | searchlib/src/vespa/searchlib/fef/featurenameparser.h | amahussein/vespa | 29d266ae1e5c95e25002b97822953fdd02b1451e | [
"Apache-2.0"
] | 1 | 2020-02-01T07:21:28.000Z | 2020-02-01T07:21:28.000Z | // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/vespalib/stllike/string.h>
#include <vector>
namespace search {
namespace fef {
/**
* Simple parser used to split feature names into components by the
* framework.
**/
class FeatureNameParser
{
public:
typedef vespalib::string string;
typedef std::vector<string> StringVector;
private:
bool _valid;
uint32_t _endPos;
string _baseName;
StringVector _parameters;
string _output;
string _executorName;
string _featureName;
public:
/**
* The constructor parses the given feature name, splitting it
* into components. If the given string is not a valid feature
* name, all components will be empty and the @ref valid method
* will return false.
*
* @param featureName feature name
**/
FeatureNameParser(const vespalib::string &featureName);
~FeatureNameParser();
/**
* Does this object represent a valid feature name?
*
* @return true if valid, false if invalid
**/
bool valid() const { return _valid; }
/**
* Obtain the number of bytes from the original feature name that
* was successfully parsed. If the feature name was valid, this
* method will simply return the size of the string given to the
* constructor. If a parse error occurred, this method will return
* the index of the offending character in the string given to the
* constructor.
*
* @return number of bytes successfully parsed
**/
uint32_t parsedBytes() const { return _endPos; }
/**
* Obtain the base name from the parsed feature name.
*
* @return base name
**/
const string &baseName() const { return _baseName; }
/**
* Obtain the parameter list from the parsed feature name.
*
* @return parameter list
**/
const StringVector ¶meters() const { return _parameters; }
/**
* Obtain the output name from the parsed feature name.
*
* @return output name
**/
const string &output() const { return _output; }
/**
* Obtain a normalized name for the executor making this
* feature. This includes the parameter list. The @ref
* FeatureNameBuilder is used to make this name.
*
* @return normalized executor name with parameters
**/
const string &executorName() const { return _executorName; }
/**
* Obtain a normalized full feature name. The @ref
* FeatureNameBuilder is used to make this name.
*
* @return normalized full feature name
**/
const string &featureName() const { return _featureName; }
};
} // namespace fef
} // namespace search
| 28.137255 | 118 | 0.640418 | [
"object",
"vector"
] |
5005cba5ad03fc88f563a63f5e837eff41be827d | 2,308 | h | C | tfp_ops.h | tho15/tfplusplus | e151986f7d449ee5ccb440fbb947fbc64fd62f49 | [
"MIT"
] | 34 | 2018-02-15T16:33:39.000Z | 2022-03-04T15:30:27.000Z | tfp_ops.h | DefTruth/tfplusplus | e151986f7d449ee5ccb440fbb947fbc64fd62f49 | [
"MIT"
] | 6 | 2018-08-21T12:02:28.000Z | 2021-03-17T03:53:35.000Z | tfp_ops.h | DefTruth/tfplusplus | e151986f7d449ee5ccb440fbb947fbc64fd62f49 | [
"MIT"
] | 12 | 2018-10-10T20:09:25.000Z | 2022-01-26T11:45:29.000Z | #ifndef TFP_OPS_H_
#define TFP_OPS_H_
#include "tensorflow/core/framework/types.pb.h"
namespace tensorflow {
namespace ops {
class XavierInitializer {
public:
XavierInitializer(const ::tensorflow::Scope& scope, ::tensorflow::Input shape,
DataType dtype);
operator ::tensorflow::Output() const { return output; }
operator ::tensorflow::Input() const { return output; }
::tensorflow::Node* node() const { return output.node(); }
::tensorflow::Output output;
};
XavierInitializer::XavierInitializer( const ::tensorflow::Scope& scope,
::tensorflow::Input shape, DataType dtype) {
if (!scope.ok()) return;
auto _shape = ::tensorflow::ops::AsNodeOut(scope, shape);
if (!scope.ok()) return;
::tensorflow::Node* ret;
const auto unique_name = scope.GetUniqueNameForOp("XavierInitializer");
auto builder = ::tensorflow::NodeBuilder(unique_name, "XavierInitializer")
.Input(_shape)
.Attr("dtype", dtype)
;
scope.UpdateBuilder(&builder);
scope.UpdateStatus(builder.Finalize(scope.graph(), &ret));
if (!scope.ok()) return;
scope.UpdateStatus(scope.DoShapeInference(ret));
this->output = Output(ret, 0);
}
class Normalizer {
public:
Normalizer(const ::tensorflow::Scope& scope, ::tensorflow::Input input,
DataType dtype);
operator ::tensorflow::Output() const { return output; }
operator ::tensorflow::Input() const { return output; }
::tensorflow::Node* node() const { return output.node(); }
::tensorflow::Output output;
};
Normalizer::Normalizer(const ::tensorflow::Scope& scope,
::tensorflow::Input inputTensor, DataType dtype) {
if (!scope.ok()) return;
auto _inputTensor = ::tensorflow::ops::AsNodeOut(scope, inputTensor);
if (!scope.ok()) return;
::tensorflow::Node* ret;
const auto unique_name = scope.GetUniqueNameForOp("Normalizer");
auto builder = ::tensorflow::NodeBuilder(unique_name, "Normalizer")
.Input(_inputTensor)
.Attr("dtype", dtype)
;
scope.UpdateBuilder(&builder);
scope.UpdateStatus(builder.Finalize(scope.graph(), &ret));
if (!scope.ok()) return;
scope.UpdateStatus(scope.DoShapeInference(ret));
this->output = Output(ret, 0);
}
}}
#endif //TFP_OPS_H_
| 25.086957 | 80 | 0.663778 | [
"shape"
] |
5008d50e0dbc163064019d7422135fc41e18b238 | 3,075 | h | C | src/noname_tools/file_tools.h | w1th0utnam3/noname_tools | 6ec1dfd306401c7f4982a0d9e191934b72cac214 | [
"MIT"
] | 4 | 2016-09-17T19:38:43.000Z | 2020-04-17T06:29:52.000Z | src/noname_tools/file_tools.h | w1th0utnam3/noname_tools | 6ec1dfd306401c7f4982a0d9e191934b72cac214 | [
"MIT"
] | null | null | null | src/noname_tools/file_tools.h | w1th0utnam3/noname_tools | 6ec1dfd306401c7f4982a0d9e191934b72cac214 | [
"MIT"
] | null | null | null | #pragma once
// MIT License
//
// Copyright (c) 2020 Fabian Löschner
//
// 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 <vector>
#include <string>
#include <fstream>
namespace noname {
namespace tools {
// TODO: Make methods templated in string type
//! Reads a complete file into a string
inline std::string read_file(const std::string &file_path) {
std::string contents;
std::ifstream input(file_path, std::ios::in | std::ios::binary);
if (input) {
input.seekg(0, std::ios::end);
contents.resize(input.tellg());
input.seekg(0, std::ios::beg);
input.read(&contents[0], contents.size());
input.close();
}
return contents;
}
//! Reads all lines from the specified file to a vector
inline std::vector<std::string> read_all_lines(const std::string &file_path) {
std::vector<std::string> lines;
std::string currentLine;
std::ifstream file(file_path);
while (std::getline(file, currentLine)) lines.push_back(currentLine);
file.close();
return lines;
}
//! Reads the specified number of lines from a file or reads the whole file if number of lines is zero
inline std::vector<std::string> read_lines(const std::string &file_path, const size_t number_of_lines = 0) {
if (number_of_lines == 0) return read_all_lines(file_path);
std::vector<std::string> lines;
lines.reserve(number_of_lines);
std::string currentLine;
std::ifstream file(file_path);
size_t counter = 0;
while (counter < number_of_lines && std::getline(file, currentLine)) {
lines.push_back(currentLine);
counter++;
}
file.close();
return lines;
}
}
}
| 40.460526 | 117 | 0.620813 | [
"vector"
] |
500b756a9b5b61b7197a786f013d74ecda41f719 | 3,799 | h | C | scOOP/mc/externalenergycalculator.h | robertvacha/SC | 4f8226a1866dc6eb004c22bc273339d46a944050 | [
"MIT"
] | 2 | 2021-09-26T10:15:55.000Z | 2022-02-20T08:12:00.000Z | scOOP/mc/externalenergycalculator.h | robertvacha/SC | 4f8226a1866dc6eb004c22bc273339d46a944050 | [
"MIT"
] | 2 | 2015-09-15T18:10:04.000Z | 2019-05-21T12:03:26.000Z | scOOP/mc/externalenergycalculator.h | robertvacha/SC | 4f8226a1866dc6eb004c22bc273339d46a944050 | [
"MIT"
] | 4 | 2015-02-19T11:24:16.000Z | 2021-07-15T10:19:08.000Z | /** @file externalenergycalculator.h*/
#ifndef EXTERNALENERGYCALCULATOR_H
#define EXTERNALENERGYCALCULATOR_H
#include "../structures/sim.h"
class ExternalEnergyCalculator
{
private:
Vector* box;
double dist; /* closest distance */
Particle* part1; /* particle 1 */
Ia_param * param; /* interaction parameters */
bool positive;
bool orientin;
double orient;
double rcmz; /* z distance between*/
double interendz; /* z coordinate of interaction end*/
Vector project; /*vector2 for projection down to plane */
public:
ExternalEnergyCalculator(Vector* box) : box(box) {}
double extere2(Particle* target);
private:
/**
* @brief exter2ClosestDist
* @param interact
*/
void exter2ClosestDist();
/**
* @brief exter2_atre
* @param interact
* @param ndist
* @param numpatch
* @param halfl
* @return
*/
double exter2Atre(double* ndist, int numpatch, double halfl);
/**
* @brief psc_wall Find projection of cpsc on plane (0,0,1) including cutoff and return
vector2 to its begining and end and cm
* @param pbeg
* @param pend
* @param projectdir
* @param partdir
* @param cutdist
* @param partbeg
* @param partend
* @return
*/
int pscWall(Vector* pbeg, Vector* pend, Vector* projectdir, Vector* partdir,
double * cutdist, Vector *partbeg, Vector *partend);
/**
* @brief cpsc_wall
* @param pbeg
* @param pend
* @param projectdir
* @param partdir
* @param halfl
* @param cutdist
* @param partbeg
* @param partend
* @return
*/
int cpscWall(Vector* pbeg, Vector* pend, Vector* projectdir, Vector* partdir,
double* halfl, double * cutdist, Vector *partbeg, Vector *partend);
/**
* @brief cutprojectatwall
* @param pextr1
* @param pextr2
* @param pextr3
* @param pextr4
* @param projectdir
* @param partdir
* @param cutdist
* @param partbeg
* @param partend
* @param pend
* @param cuttoproject
* @return
*/
int cutProjectAtWall(Vector* pextr1, Vector* pextr2, Vector* pextr3, Vector* pextr4,
Vector* projectdir, Vector* partdir, double * cutdist,
Vector *partbeg, Vector *partend, Vector *pend, double *cuttoproject);
/**
* @brief projectinz project a point in project direction to z plane z=0
* @param vec1
* @param projectdir
* @param projection
*/
inline void projectinZ(Vector* vec1, Vector* projectdir,Vector * projection) {
projection->x = vec1->x - vec1->z * projectdir->x/projectdir->z;
projection->y = vec1->y - vec1->z * projectdir->y/projectdir->z;
projection->z = 0;
}
/**
* @brief exter_atre Calculates interaction of target particle and external field
calculate projection of patch of spherocylinder on wall
evaluate intersection area and calculate interaction from that
* @param ndist
* @param numpatch
* @param halfl
* @return
*
* @deprecated
*/
double exterAtre(double *ndist,int numpatch,double halfl);
/**
* @brief areaeightpoints calculates area defined by six points in z=0 plane
* @param p1
* @param p2
* @param p3
* @param p4
* @param p5
* @param p6
* @param p7
* @param p8
* @return
*/
double areaEightPoints(Vector * p1, Vector * p2, Vector * p3, Vector * p4,
Vector * p5, Vector * p6,Vector * p7, Vector * p8);
};
#endif // EXTERNALENERGYCALCULATOR_H
| 27.933824 | 95 | 0.586733 | [
"vector"
] |
5016613d71e02a5b0e014aebd0de53cdfbe36674 | 64,009 | c | C | base/ntsetup/win95upg/w95upg/common9x/namefix.c | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | base/ntsetup/win95upg/w95upg/common9x/namefix.c | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | base/ntsetup/win95upg/w95upg/common9x/namefix.c | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | /*++
Copyright (c) 1997 Microsoft Corporation
Module Name:
namefix.c
Abstract:
This module generates memdb entries for names that are to be used on Windows
NT. All names are validated, and incompatible names are placed in the
NewNames memdb category.
Names are organized into groups; within a group, each name must be unique,
but across groups, duplicate names are allowed. For example, the name
group "UserNames" holds all user names, and each user name must be unique.
The user name can be the same as the computer name, because the computer
name is stored in the "ComputerName" group.
The code here is extendable for other types of name collisions. To add
support for other types of names, simply add the group name to the
NAME_GROUP_LIST macro expansion below, then implement three functions:
pEnumGroupName
pValidateGroupName
pRecommendGroupName
You'll replace GroupName in the function names above with the name of your
actual group.
The code in this module should be the only place where names are validated
on the Win9x side.
Author:
Jim Schmidt (jimschm) 24-Dec-1997
Revision History:
jimschm 21-Jan-1998 Commented macro expansion list, added
g_DisableDomainChecks capability
--*/
#include "pch.h"
#include "cmn9xp.h"
#include <validc.h> // nt\private\inc
#define S_ILLEGAL_CHARS ILLEGAL_NAME_CHARS_STR TEXT("*")
#define DBG_NAMEFIX "NameFix"
#define MIN_UNLEN 20
//
// TEST_ALL_INCOMPATIBLE will force all names to be considered incompatible
// TEST_MANGLE_NAMES will force names to be invalid
//
//#define TEST_ALL_INCOMPATIBLE
//#define TEST_MANGLE_NAMES
/*++
Macro Expansion List Description:
NAME_GROUP_LIST lists each name category, such as computer name, domain name,
user name and so on. The macro expansion list automatically generates
three function prototypes for each name category. Also, the message ID is
used as the category identifier by external callers.
Line Syntax:
DEFMAC(GroupName, Id)
Arguments:
GroupName - Specifies the type of name. Must be a valid C function name.
The macro expansion list will generate prototypes for:
pEnum<GroupName>
pValidate<GroupName>
pRecommend<GroupName>
where, of course, <GroupName> is replaced by the text in the
macro declaration line.
All three functions must be implemented in this source file.
Id - Specifies the message ID giving the display name of the name group.
The name group is displayed in the list box that the user sees when
they are alerted there are some incompatible names on their machine.
Id is also used to uniquely identify a name group in some of the
routines below.
Variables Generated From List:
g_NameGroupRoutines
--*/
#define NAME_GROUP_LIST \
DEFMAC(ComputerDomain, MSG_COMPUTERDOMAIN_CATEGORY) \
DEFMAC(Workgroup, MSG_WORKGROUP_CATEGORY) \
DEFMAC(UserName, MSG_USERNAME_CATEGORY) \
DEFMAC(ComputerName, MSG_COMPUTERNAME_CATEGORY) \
//
// Macro expansion declarations
//
#define MAX_NAME 2048
typedef struct {
//
// The NAME_ENUM structure is passed uninitialized to pEnumGroupName
// function. The same structure is passed unchanged to subsequent
// calls to pEnumGroupName. Each enum function declares its
// params in this struct.
//
union {
struct {
//
// pEnumUser
//
USERENUM UserEnum;
};
};
//
// All enumeration routines must fill in the following if they
// return TRUE:
//
TCHAR Name[MAX_NAME];
} NAME_ENUM, *PNAME_ENUM;
typedef struct {
PCTSTR GroupName;
TCHAR AuthenticatingAgent[MAX_COMPUTER_NAME];
BOOL FromUserInterface;
UINT FailureMsg;
BOOL DomainLogonEnabled;
} NAME_GROUP_CONTEXT, *PNAME_GROUP_CONTEXT;
typedef BOOL (ENUM_NAME_PROTOTYPE)(PNAME_GROUP_CONTEXT Context, PNAME_ENUM EnumPtr, BOOL First);
typedef ENUM_NAME_PROTOTYPE * ENUM_NAME_FN;
typedef BOOL (VALIDATE_NAME_PROTOTYPE)(PNAME_GROUP_CONTEXT Context, PCTSTR NameCandidate);
typedef VALIDATE_NAME_PROTOTYPE * VALIDATE_NAME_FN;
typedef VOID (RECOMMEND_NAME_PROTOTYPE)(PNAME_GROUP_CONTEXT Context, PCTSTR InvalidName, PTSTR RecommendedNameBuf);
typedef RECOMMEND_NAME_PROTOTYPE * RECOMMEND_NAME_FN;
typedef struct {
UINT NameId;
PCTSTR GroupName;
ENUM_NAME_FN Enum;
VALIDATE_NAME_FN Validate;
RECOMMEND_NAME_FN Recommend;
NAME_GROUP_CONTEXT Context;
} NAME_GROUP_ROUTINES, *PNAME_GROUP_ROUTINES;
//
// Automatic arrays and prototypes
//
// The prototoypes
#define DEFMAC(x,id) ENUM_NAME_PROTOTYPE pEnum##x;
NAME_GROUP_LIST
#undef DEFMAC
#define DEFMAC(x,id) VALIDATE_NAME_PROTOTYPE pValidate##x;
NAME_GROUP_LIST
#undef DEFMAC
#define DEFMAC(x,id) RECOMMEND_NAME_PROTOTYPE pRecommend##x;
NAME_GROUP_LIST
#undef DEFMAC
// The array of functions
#define DEFMAC(x,id) {id, TEXT(#x), pEnum##x, pValidate##x, pRecommend##x},
NAME_GROUP_ROUTINES g_NameGroupRoutines[] = {
NAME_GROUP_LIST /* , */
{0, NULL, NULL, NULL, NULL, NULL}
};
//
// Local prototypes
//
BOOL
pDoesNameExistInMemDb (
IN PNAME_GROUP_CONTEXT Context,
IN PCTSTR UserName
);
//
// Implementation
//
PNAME_GROUP_ROUTINES
pGetNameGroupById (
IN UINT MessageId
)
/*++
Routine Description:
pGetNameGroupById finds a group by searching the list for a message ID. The
message ID is the unique identifier for the group.
Arguments:
MessageId - Specifies the unique ID of the group to find
Return Value:
A pointer to the group struct, or NULL if one was not found.
--*/
{
INT i;
for (i = 0 ; g_NameGroupRoutines[i].GroupName ; i++) {
if (g_NameGroupRoutines[i].NameId == MessageId) {
return &g_NameGroupRoutines[i];
}
}
return NULL;
}
PNAME_GROUP_CONTEXT
pGetNameGroupContextById (
IN UINT MessageId
)
/*++
Routine Description:
pGetNameGroupById finds a group by searching the list for a message ID. The
message ID is the unique identifier for the group. The return value is
the context structure used by the group.
Arguments:
MessageId - Specifies the unique ID of the group to find
Return Value:
A pointer to the group's context struct, or NULL if one was not found.
--*/
{
INT i;
for (i = 0 ; g_NameGroupRoutines[i].GroupName ; i++) {
if (g_NameGroupRoutines[i].NameId == MessageId) {
return &g_NameGroupRoutines[i].Context;
}
}
return NULL;
}
BOOL
pEnumComputerName (
IN PNAME_GROUP_CONTEXT Context,
IN OUT PNAME_ENUM EnumPtr,
IN BOOL First
)
/*++
Routine Description:
pEnumComputerName obtains the computer name and returns it
in the EnumPtr struct. If no name is assigned to the computer,
an empty string is returned.
Arguments:
Context - Unused (holds context about name group)
EnumPtr - Receives the computer name
First - Specifies TRUE on the first call to pEnumComputerName,
or FALSE on subseqeuent calls to pEnumComputerName.
Return Value:
If First is TRUE, returns TRUE if a name is enumerated, or FALSE
if the name is not valid.
If First is FALSE, always returns FALSE.
--*/
{
DWORD Size;
if (!First) {
return FALSE;
}
//
// Get the computer name
//
Size = sizeof (EnumPtr->Name) / sizeof (EnumPtr->Name[0]);
if (!GetComputerName (EnumPtr->Name, &Size)) {
EnumPtr->Name[0] = 0;
}
return TRUE;
}
BOOL
pEnumUserName (
IN PNAME_GROUP_CONTEXT Context,
IN OUT PNAME_ENUM EnumPtr,
IN BOOL First
)
/*++
Routine Description:
pEnumUserName enumerates all users on the machine via the EnumFirstUser/
EnumNextUser APIs. It does not enumerate the fixed names.
Like the other enumeration routines, this routine is called until it
returns FALSE, so that all resources are cleaned up correctly.
Arguments:
Context - Unused (holds context about name group)
EnumPtr - Specifies the current enumeration state. Receives the enumerated
user name.
First - Specifies TRUE on the first call to pEnumUserName,
or FALSE on subseqeuent calls to pEnumUserName.
Return Value:
TRUE if a user was enumerated, or FALSE if all users were enumerated.
--*/
{
//
// Enumerate the next user
//
if (First) {
if (!EnumFirstUser (&EnumPtr->UserEnum, ENUMUSER_DO_NOT_MAP_HIVE)) {
LOG ((LOG_ERROR, "No users to enumerate"));
return FALSE;
}
} else {
if (!EnumNextUser (&EnumPtr->UserEnum)) {
return FALSE;
}
}
//
// Special case -- ignore default user
//
while (*EnumPtr->UserEnum.UserName == 0) {
if (!EnumNextUser (&EnumPtr->UserEnum)) {
return FALSE;
}
}
//
// Copy user name to name buffer
//
StringCopy (EnumPtr->Name, EnumPtr->UserEnum.UserName);
return TRUE;
}
BOOL
pEnumWorkgroup (
IN PNAME_GROUP_CONTEXT Context,
IN OUT PNAME_ENUM EnumPtr,
IN BOOL First
)
/*++
Routine Description:
pEnumWorkgroup obtains the workgroup name and returns it
in the EnumPtr struct. If the VNETSUP support is not
installed, or the workgroup name is empty, this routine
returns FALSE.
Arguments:
Context - Receives AuthenticatingAgent value
EnumPtr - Receives the computer domain name
First - Specifies TRUE on the first call to pEnumWorkgroup,
or FALSE on subseqeuent calls to pEnumWorkgroup.
Return Value:
If First is TRUE, returns TRUE if a name is enumerated, or FALSE
if the name is not valid.
If First is FALSE, always returns FALSE.
--*/
{
HKEY VnetsupKey;
PCTSTR StrData;
if (!First) {
return FALSE;
}
EnumPtr->Name[0] = 0;
//
// Obtain the workgroup name into EnumPtr->Name
//
VnetsupKey = OpenRegKeyStr (S_VNETSUP);
if (VnetsupKey) {
StrData = GetRegValueString (VnetsupKey, S_WORKGROUP);
if (StrData) {
_tcssafecpy (EnumPtr->Name, StrData, MAX_COMPUTER_NAME);
MemFree (g_hHeap, 0, StrData);
}
ELSE_DEBUGMSG ((DBG_WARNING, "pEnumWorkgroup: Workgroup value does not exist"));
CloseRegKey (VnetsupKey);
}
ELSE_DEBUGMSG ((DBG_WARNING, "pEnumWorkgroup: VNETSUP key does not exist"));
return EnumPtr->Name[0] != 0;
}
BOOL
pEnumComputerDomain (
IN PNAME_GROUP_CONTEXT Context,
IN OUT PNAME_ENUM EnumPtr,
IN BOOL First
)
/*++
Routine Description:
pEnumComputerDomain obtains the workgroup name and returns it in the EnumPtr
struct. If the MS Networking client is not installed, this routine returns
FALSE.
This routine also obtains the AuthenticatingAgent value, and stores it in
the Context structure for use by pRecommendComputerDomain.
Arguments:
Context - Receives AuthenticatingAgent value
EnumPtr - Receives the computer domain name
First - Specifies TRUE on the first call to pEnumComputerDomain,
or FALSE on subseqeuent calls to pEnumComputerDomain.
Return Value:
If First is TRUE, returns TRUE if a name is enumerated, or FALSE
if the name is not valid.
If First is FALSE, always returns FALSE.
--*/
{
HKEY Key;
HKEY NetLogonKey;
HKEY VnetsupKey;
PBYTE Data;
PCTSTR StrData;
BOOL b = TRUE;
if (!First) {
return FALSE;
}
EnumPtr->Name[0] = 0;
Context->DomainLogonEnabled = FALSE;
//
// Is the MS Networking client installed?
//
Key = OpenRegKeyStr (S_MSNP32);
if (!Key) {
//
// MS Networking client is not installed. Return FALSE
// because any Win9x workgroup name will work with NT.
//
DEBUGMSG ((DBG_NAMEFIX, "pEnumComputerDomain: MS Networking client is not installed."));
return FALSE;
}
__try {
//
// Determine if the domain logon is enabled
//
NetLogonKey = OpenRegKeyStr (S_LOGON_KEY);
if (NetLogonKey) {
Data = (PBYTE) GetRegValueBinary (NetLogonKey, S_LM_LOGON);
if (Data) {
if (*Data) {
Context->DomainLogonEnabled = TRUE;
}
MemFree (g_hHeap, 0, Data);
}
CloseRegKey (NetLogonKey);
}
//
// If no domain logon is enabled, return FALSE, because
// any Win9x workgroup name will work with NT.
//
if (!Context->DomainLogonEnabled) {
DEBUGMSG ((DBG_NAMEFIX, "pEnumComputerDomain: Domain logon is not enabled."));
b = FALSE;
__leave;
}
//
// Obtain the workgroup name into EnumPtr->Name; we will try
// to use this as the NT computer domain.
//
VnetsupKey = OpenRegKeyStr (S_VNETSUP);
if (VnetsupKey) {
StrData = GetRegValueString (VnetsupKey, S_WORKGROUP);
if (StrData) {
_tcssafecpy (EnumPtr->Name, StrData, MAX_COMPUTER_NAME);
MemFree (g_hHeap, 0, StrData);
}
ELSE_DEBUGMSG ((DBG_WARNING, "pEnumComputerDomain: Workgroup value does not exist"));
CloseRegKey (VnetsupKey);
}
ELSE_DEBUGMSG ((DBG_WARNING, "pEnumComputerDomain: VNETSUP key does not exist"));
//
// Obtain the AuthenticatingAgent value from Key and stick it in
// Context->AuthenticatingAgent
//
StrData = GetRegValueString (Key, S_AUTHENTICATING_AGENT);
if (StrData) {
//
// Copy AuthenticatingAgent to enum struct
//
_tcssafecpy (Context->AuthenticatingAgent, StrData, MAX_COMPUTER_NAME);
MemFree (g_hHeap, 0, StrData);
} else {
Context->AuthenticatingAgent[0] = 0;
LOG ((LOG_ERROR,"Domain Logon enabled, but AuthenticatingAgent value is missing"));
}
}
__finally {
CloseRegKey (Key);
}
return b;
}
BOOL
pValidateNetName (
OUT PNAME_GROUP_CONTEXT Context, OPTIONAL
IN PCTSTR NameCandidate,
IN BOOL SpacesAllowed,
IN BOOL DotSpaceCheck,
IN UINT MaxLength,
OUT PCSTR *OffendingChar OPTIONAL
)
/*++
Routine Description:
pValidateNetName performs a check to see if the specified name is valid on
NT 5.
Arguments:
Context - Receives the error message ID, if any error occurred.
NameCandidate - Specifies the name to validate.
SpacesAllowed - Specifies TRUE if spaces are allowed in the name, or FALSE
if not.
DotSpaceCheck - Specifies TRUE if the name cannot consist only of a dot and
a space, or FALSE if it can.
MaxLength - Specifies the max characters that can be in the name.
OffendingChar - Receives the pointer to the character that caused the
problem, or NULL if no error or the error was caused by
something other than a character set mismatch or length test.
Return Value:
TRUE if the name is valid, or FALSE if it is not.
--*/
{
PCTSTR p;
PCTSTR LastNonSpaceChar;
CHARTYPE ch;
BOOL allDigits;
if (OffendingChar) {
*OffendingChar = NULL;
}
//
// Minimum length test
//
if (!NameCandidate[0]) {
if (Context) {
Context->FailureMsg = MSG_INVALID_EMPTY_NAME_POPUP;
}
return FALSE;
}
//
// Maximum length test; use Lchars because we go to Unicode
//
if (LcharCount (NameCandidate) > MaxLength) {
if (Context) {
Context->FailureMsg = MSG_INVALID_COMPUTERNAME_LENGTH_POPUP;
}
if (OffendingChar) {
*OffendingChar = TcharCountToPointer (NameCandidate, MaxLength);
}
return FALSE;
}
//
// No leading spaces allowed
//
if (_tcsnextc (NameCandidate) == TEXT(' ')) {
if (Context) {
Context->FailureMsg = MSG_INVALID_COMPUTERNAME_CHAR_POPUP;
}
if (OffendingChar) {
*OffendingChar = NameCandidate;
}
return FALSE;
}
//
// No invalid characters
//
ch = ' ';
LastNonSpaceChar = NULL;
allDigits = TRUE;
for (p = NameCandidate ; *p ; p = _tcsinc (p)) {
ch = _tcsnextc (p);
if (_tcschr (S_ILLEGAL_CHARS, ch) != NULL ||
(ch == TEXT(' ') && !SpacesAllowed)
) {
if (OffendingChar) {
*OffendingChar = p;
}
if (Context) {
Context->FailureMsg = MSG_INVALID_COMPUTERNAME_CHAR_POPUP;
}
return FALSE;
}
if (ch != TEXT('.') && ch != TEXT(' ')) {
DotSpaceCheck = FALSE;
}
if (ch != TEXT(' ')) {
LastNonSpaceChar = p;
}
if (allDigits) {
if (ch < TEXT('0') || ch > TEXT('9')) {
allDigits = FALSE;
}
}
}
if (allDigits) {
if (OffendingChar) {
*OffendingChar = NameCandidate;
}
if (Context) {
Context->FailureMsg = MSG_INVALID_COMPUTERNAME_CHAR_POPUP;
}
return FALSE;
}
//
// No trailing dot
//
if (ch == TEXT('.')) {
MYASSERT (LastNonSpaceChar);
if (OffendingChar) {
*OffendingChar = LastNonSpaceChar;
}
if (Context) {
Context->FailureMsg = MSG_INVALID_COMPUTERNAME_CHAR_POPUP;
}
return FALSE;
}
//
// No trailing space
//
if (ch == TEXT(' ')) {
MYASSERT (LastNonSpaceChar);
if (OffendingChar) {
*OffendingChar = _tcsinc (LastNonSpaceChar);
}
if (Context) {
Context->FailureMsg = MSG_INVALID_COMPUTERNAME_CHAR_POPUP;
}
return FALSE;
}
//
// Dot-space only check
//
if (DotSpaceCheck) {
if (OffendingChar) {
*OffendingChar = NameCandidate;
}
if (Context) {
Context->FailureMsg = MSG_INVALID_USERNAME_SPACEDOT_POPUP;
}
return FALSE;
}
return TRUE;
}
BOOL
ValidateDomainNameChars (
IN PCTSTR NameCandidate
)
{
return pValidateNetName (
NULL,
NameCandidate,
FALSE,
FALSE,
min (MAX_SERVER_NAME, DNLEN),
NULL
);
}
BOOL
ValidateUserNameChars (
IN PCTSTR NameCandidate
)
{
return pValidateNetName (
NULL,
NameCandidate,
TRUE,
TRUE,
min (MAX_USER_NAME, MIN_UNLEN),
NULL
);
}
BOOL
pValidateComputerName (
IN PNAME_GROUP_CONTEXT Context,
IN PCTSTR NameCandidate
)
/*++
Routine Description:
pValidateComputerName makes sure the specified name is not
empty, is not longer than 15 characters, and consists only
of characters legal for a computer name. Also, if the name
collides with a user name, then the computer name is invalid.
Arguments:
Context - Unused (holds context about name group)
NameCandidate - Specifies name to validate
Return Value:
TRUE if the name is valid, FALSE otherwise.
--*/
{
BOOL b;
//PNAME_GROUP_CONTEXT UserContext;
//UserContext = pGetNameGroupContextById (MSG_USERNAME_CATEGORY);
//if (pDoesNameExistInMemDb (UserContext, NameCandidate)) {
// return FALSE;
//}
b = pValidateNetName (
Context,
NameCandidate,
FALSE,
FALSE,
MAX_COMPUTER_NAME,
NULL
);
return b;
}
BOOL
pValidateWorkgroup (
IN PNAME_GROUP_CONTEXT Context,
IN PCTSTR NameCandidate
)
/*++
Routine Description:
pValidateWorkgroup makes sure the specified name is not
empty, is not longer than 15 characters, and consists only
of characters legal for a computer name.
If domain logon is enabled, this routine always returns
TRUE.
Arguments:
Context - Unused (holds context about name group)
NameCandidate - Specifies name to validate
Return Value:
TRUE if the name is valid, FALSE otherwise.
--*/
{
PNAME_GROUP_CONTEXT DomainContext;
//
// Return TRUE if domain is enabled
//
DomainContext = pGetNameGroupContextById (MSG_COMPUTERDOMAIN_CATEGORY);
if (DomainContext && DomainContext->DomainLogonEnabled) {
return TRUE;
}
//
// A workgroup name is a domain name, but spaces are allowed.
//
return pValidateNetName (Context, NameCandidate, TRUE, FALSE, DNLEN, NULL);
}
BOOL
pValidateUserName (
IN PNAME_GROUP_CONTEXT Context,
IN PCTSTR NameCandidate
)
/*++
Routine Description:
pValidateUserName makes sure the specified name is not empty,
is not longer than 20 characters, consists only of characters
legal for a user name, and does not exist in memdb's NewName
or InUseName categories.
Arguments:
Context - Specifies context info for the UserName name group,
used for memdb operations.
NameCandidate - Specifies name to validate
Return Value:
TRUE if the name is valid, FALSE otherwise.
--*/
{
BOOL b;
//
// Validate name
//
b = pValidateNetName (Context, NameCandidate, TRUE, TRUE, min (MAX_USER_NAME, MIN_UNLEN), NULL);
if (!b && Context->FailureMsg == MSG_INVALID_COMPUTERNAME_LENGTH_POPUP) {
Context->FailureMsg = MSG_INVALID_USERNAME_LENGTH_POPUP;
}
if (!b) {
return FALSE;
}
//
// Check for existence in memdb
//
if (pDoesNameExistInMemDb (Context, NameCandidate)) {
Context->FailureMsg = MSG_INVALID_USERNAME_DUPLICATE_POPUP;
return FALSE;
}
return TRUE;
}
BOOL
pValidateComputerDomain (
IN PNAME_GROUP_CONTEXT Context,
IN PCTSTR NameCandidate
)
/*++
Routine Description:
pValidateComputerDomain performs the same validatation that
pValidateComputerName performs. Therefore, it simply calls
pValidateComputerName.
If the name comes from the registry, and not the user interface, then we
check to see if the workgroup name actually refers to a domain controller.
If it does, the name is returned as valid; otherwise, the name is returned
as invalid, even though it may consist of valid characters.
If the name comes from the user interface, we assume the UI code will do
the validation to see if the name is an actual server. This allows the UI
to override the API, because the API may not work properly on all networks.
Arguments:
Context - Specifies context of the ComputerDomain name group. In particular,
the FromUserInterface member tells us to ignore validation of the
domain name via the NetServerGetInfo API.
NameCandidate - Specifies domain name to validate
Return Value:
TRUE if the domain name is legal, or FALSE if it is not.
--*/
{
TCHAR NewComputerName[MAX_COMPUTER_NAME];
if (!pValidateNetName (Context, NameCandidate, FALSE, FALSE, DNLEN, NULL)) {
return FALSE;
}
if (!Context->FromUserInterface) {
if (GetUpgradeComputerName (NewComputerName)) {
// 1 == account was found, 0 == account does not exist, -1 == no response
if (1 != DoesComputerAccountExistOnDomain (
NameCandidate,
NewComputerName,
TRUE
)) {
return FALSE;
}
}
}
return TRUE;
}
BOOL
pCleanUpNetName (
IN PNAME_GROUP_CONTEXT Context,
IN OUT PTSTR Name,
IN UINT NameType
)
/*++
Routine Description:
pCleanUpNetName eliminates all characters that are invalid from the
specified name.
NOTE: We could add some smarts here, such as translation of
spaces to dashes, and so on.
Arguments:
Context - Unused; passed along to pValidateComputerName.
Name - Specifies the name containing potentially invalid characters.
Receives the name with all invalid characters removed.
NameType - Specifies the type of name to clean up
Return Value:
TRUE if the resulting name is valid, or FALSE if the resulting
name is still not valid.
--*/
{
TCHAR TempBuf[MAX_COMPUTER_NAME];
PTSTR p;
PTSTR q;
UINT Len;
BOOL b;
//
// Delete all the invalid characters
//
_tcssafecpy (TempBuf, Name, MAX_COMPUTER_NAME);
for (;;) {
p = NULL;
b = FALSE;
switch (NameType) {
case MSG_COMPUTERNAME_CATEGORY:
b = pValidateNetName (Context, TempBuf, TRUE, FALSE, MAX_COMPUTER_NAME, &p);
break;
case MSG_WORKGROUP_CATEGORY:
b = pValidateNetName (Context, TempBuf, TRUE, FALSE, DNLEN, &p);
break;
case MSG_COMPUTERDOMAIN_CATEGORY:
b = pValidateNetName (Context, TempBuf, FALSE, FALSE, DNLEN, &p);
break;
case MSG_USERNAME_CATEGORY:
b = pValidateNetName (Context, TempBuf, TRUE, TRUE, MIN_UNLEN, &p);
break;
}
if (b || !p) {
break;
}
q = _tcsinc (p);
Len = ByteCount (q) + sizeof (TCHAR);
MoveMemory (p, q, Len);
}
if (b) {
//
// Do not allow names that contain a lot of invalid characters
//
if (LcharCount (Name) - 3 > LcharCount (TempBuf)) {
b = FALSE;
}
}
if (!b) {
// Empty out recommended name
*Name = 0;
}
if (b) {
StringCopy (Name, TempBuf);
switch (NameType) {
case MSG_COMPUTERNAME_CATEGORY:
b = pValidateComputerName (Context, Name);
break;
case MSG_WORKGROUP_CATEGORY:
b = pValidateWorkgroup (Context, Name);
break;
case MSG_COMPUTERDOMAIN_CATEGORY:
b = pValidateComputerDomain (Context, Name);
break;
case MSG_USERNAME_CATEGORY:
b = pValidateUserName (Context, Name);
break;
}
}
return b;
}
VOID
pRecommendComputerName (
IN PNAME_GROUP_CONTEXT Context,
IN PCTSTR InvalidName,
OUT PTSTR RecommendedName
)
/*++
Routine Description:
pRecommendComputerName obtains the current user's name and
returns it for use as a computer name. If the user's name
has characters that cannot be used in a computer name,
the invalid characters are removed. If the name is still
invalid, then a static string is returned.
Arguments:
Context - Unused (holds context about name group)
InvalidName - Specifies the current invalid name, or an empty
string if no name exists.
RecommendedName - Receives the recommended name.
Return Value:
none
--*/
{
DWORD Size;
PCTSTR p;
PCTSTR ArgArray[1];
//
// Try to clean up the invalid name
//
if (*InvalidName) {
_tcssafecpy (RecommendedName, InvalidName, MAX_COMPUTER_NAME);
if (pCleanUpNetName (Context, RecommendedName, MSG_COMPUTERNAME_CATEGORY)) {
return;
}
}
//
// Generate a suggestion from the user name
//
Size = MAX_COMPUTER_NAME;
if (!GetUserName (RecommendedName, &Size)) {
*RecommendedName = 0;
} else {
CharUpper (RecommendedName);
ArgArray[0] = RecommendedName;
p = ParseMessageID (MSG_COMPUTER_REPLACEMENT_NAME, ArgArray);
MYASSERT (p);
if (p) {
_tcssafecpy (RecommendedName, p, MAX_COMPUTER_NAME);
FreeStringResource (p);
}
ELSE_DEBUGMSG ((DBG_ERROR, "Failed to parse message resource for MSG_COMPUTER_REPLACEMENT_NAME. Check localization."));
}
//
// Try to clean up invalid computer name chars in user name
//
if (pCleanUpNetName (Context, RecommendedName, MSG_COMPUTERNAME_CATEGORY)) {
return;
}
//
// All else has failed; obtain static computer name string
//
p = GetStringResource (MSG_RECOMMENDED_COMPUTER_NAME);
MYASSERT (p);
if (p) {
StringCopy (RecommendedName, p);
FreeStringResource (p);
}
ELSE_DEBUGMSG ((DBG_ERROR, "Failed to parse message resource for MSG_RECOMMENDED_COMPUTER_NAME. Check localization."));
}
VOID
pRecommendWorkgroup (
IN PNAME_GROUP_CONTEXT Context,
IN PCTSTR InvalidName,
OUT PTSTR RecommendedName
)
/*++
Routine Description:
pRecommendWorkgroupName tries to clean up the invalid workgroup name, and
only if necessary recommends the name Workgroup.
Arguments:
Context - Unused (holds context about name group)
InvalidName - Specifies the current invalid name, or an empty
string if no name exists.
RecommendedName - Receives the recommended name.
Return Value:
none
--*/
{
PCTSTR p;
//
// Try to clean up the invalid name
//
if (*InvalidName) {
_tcssafecpy (RecommendedName, InvalidName, MAX_COMPUTER_NAME);
if (pCleanUpNetName (Context, RecommendedName, MSG_WORKGROUP_CATEGORY)) {
return;
}
}
//
// All else has failed; obtain static workgroup string
//
p = GetStringResource (MSG_RECOMMENDED_WORKGROUP_NAME);
MYASSERT (p);
StringCopy (RecommendedName, p);
FreeStringResource (p);
}
VOID
pRecommendUserName (
IN PNAME_GROUP_CONTEXT Context,
IN PCTSTR InvalidName,
OUT PTSTR RecommendedName
)
/*++
Routine Description:
pRecommendUserName tries to clean up the specified invalid
user name. If that fails, this routine generates a
generic user name (such as Windows User). If the generic
name is not valid, numbers are appended until a unique,
valid name is found.
Arguments:
Context - Specifies settings for the UserName name group context,
including the group name itself. This context is used
in memdb operations to validate the name.
InvalidName - Specifies the current invalid name, or an empty
string if no name exists.
RecommendedName - Receives the recommended name.
Return Value:
none
--*/
{
PCTSTR p;
UINT Sequencer;
//
// Attempt to clean out invalid characters from the user
// name.
//
_tcssafecpy (RecommendedName, InvalidName, MAX_USER_NAME);
if (pCleanUpNetName (Context, RecommendedName, MSG_USERNAME_CATEGORY)) {
return;
}
//
// If there are some characters left, and there is room for
// a sequencer, just add the sequencer.
//
if (*RecommendedName) {
p = DuplicateText (RecommendedName);
MYASSERT (p);
for (Sequencer = 1 ; Sequencer < 10 ; Sequencer++) {
wsprintf (RecommendedName, TEXT("%s-%u"), p, Sequencer);
if (pValidateUserName (Context, RecommendedName)) {
break;
}
}
FreeText (p);
if (Sequencer < 10) {
return;
}
}
//
// Obtain a generic name
//
p = GetStringResource (MSG_RECOMMENDED_USER_NAME);
MYASSERT (p);
if (p) {
__try {
if (pValidateUserName (Context, p)) {
StringCopy (RecommendedName, p);
} else {
for (Sequencer = 2 ; Sequencer < 100000 ; Sequencer++) {
wsprintf (RecommendedName, TEXT("%s %u"), p, Sequencer);
if (pValidateUserName (Context, RecommendedName)) {
break;
}
}
if (Sequencer == 100000) {
LOG ((LOG_ERROR, "Sequencer hit %u", Sequencer));
}
}
}
__finally {
FreeStringResource (p);
}
}
ELSE_DEBUGMSG ((DBG_ERROR, "Could not retrieve string resource MSG_RECOMMENDED_USER_NAME. Check localization."));
}
VOID
pRecommendComputerDomain (
IN PNAME_GROUP_CONTEXT Context,
IN PCTSTR InvalidName,
OUT PTSTR RecommendedName
)
/*++
Routine Description:
pRecommendComputerDomain returns the value of AuthenticatingAgent
stored in the Context structure by pEnumComputerDomain.
Arguments:
Context - Specifies the name group context structure, which holds
the computer domain found by pEnumComputerDomain.
InvalidName - Specifies the current invalid name, or an empty
string if no name exists.
RecommendedName - Receives the recommended name.
Return Value:
none
--*/
{
StringCopy (RecommendedName, Context->AuthenticatingAgent);
}
BOOL
ValidateName (
IN HWND ParentWnd, OPTIONAL
IN PCTSTR NameGroup,
IN PCTSTR NameCandidate
)
/*++
Routine Description:
ValidateName is called by the UI to perform validation on the
specified name.
Arguments:
ParentWnd - Specifies the handle used for popups that tell the user
what is wrong with the name they entered. If NULL, no
UI is generated.
NameGroup - Specifies the name group, a static string that defines
what characters are legal for the name.
NameCandidate - Specifies the name to validate
Return Value:
TRUE if the name is valid, or FALSE if it is not valid.
--*/
{
INT i;
BOOL b;
//
// Scan the g_NameGroupRoutines array for the name grup
//
for (i = 0 ; g_NameGroupRoutines[i].GroupName ; i++) {
if (StringIMatch (g_NameGroupRoutines[i].GroupName, NameGroup)) {
break;
}
}
if (!g_NameGroupRoutines[i].GroupName) {
DEBUGMSG ((DBG_WHOOPS, "ValidateName: Don't know how to validate %s names", NameGroup));
LOG ((LOG_ERROR, "Don't know how to validate %s names", NameGroup));
return TRUE;
}
g_NameGroupRoutines[i].Context.FromUserInterface = TRUE;
b = g_NameGroupRoutines[i].Validate (&g_NameGroupRoutines[i].Context, NameCandidate);
if (!b && ParentWnd) {
OkBox (ParentWnd, g_NameGroupRoutines[i].Context.FailureMsg);
}
g_NameGroupRoutines[i].Context.FromUserInterface = FALSE;
return b;
}
BOOL
pDoesNameExistInMemDb (
IN PNAME_GROUP_CONTEXT Context,
IN PCTSTR Name
)
/*++
Routine Description:
pDoesUserExistInMemDb looks in memdb to see if the specified name
is listed in either the NewNames category (incompatible names that
are going to be changed), or the InUseNames category (compatible
names that cannot be used more than once).
This routine compares only names in the same name group.
Arguments:
Context - Specifies the group context
Name - Specifies the name to query
Return Value:
TRUE if the name is in use, or FALSE if the name is not in use.
--*/
{
TCHAR Node[MEMDB_MAX];
DEBUGMSG ((DBG_NAMEFIX, "%s: [%s] is compatible", Context->GroupName, Name));
MemDbBuildKey (
Node,
MEMDB_CATEGORY_NEWNAMES,
Context->GroupName,
MEMDB_FIELD_NEW,
Name
);
if (MemDbGetValue (Node, NULL)) {
return TRUE;
}
MemDbBuildKey (
Node,
MEMDB_CATEGORY_INUSENAMES,
Context->GroupName,
NULL,
Name
);
return MemDbGetValue (Node, NULL);
}
VOID
pMemDbSetIncompatibleName (
IN PCTSTR NameGroup,
IN PCTSTR OrgName,
IN PCTSTR NewName
)
/*++
Routine Description:
pMemDbSetIncompatibleName adds the correct entries to memdb to
have a name appear in the name collision wizard page.
Arguments:
NameGroup - Specifies the name group such as ComputerName, UserName, etc...
OrgName - Specifies the original name that is invalid
NewName - Specifies the recommended new name
Return Value:
none
--*/
{
DWORD NewNameOffset;
DEBUGMSG ((DBG_NAMEFIX, "%s: [%s]->[%s]", NameGroup, OrgName, NewName));
MemDbSetValueEx (
MEMDB_CATEGORY_NEWNAMES,
NameGroup,
NULL,
NULL,
0,
NULL
);
MemDbSetValueEx (
MEMDB_CATEGORY_NEWNAMES,
NameGroup,
MEMDB_FIELD_NEW,
NewName,
0,
&NewNameOffset
);
MemDbSetValueEx (
MEMDB_CATEGORY_NEWNAMES,
NameGroup,
MEMDB_FIELD_OLD,
OrgName,
NewNameOffset,
NULL
);
}
VOID
pMemDbSetCompatibleName (
IN PCTSTR NameGroup,
IN PCTSTR Name
)
/*++
Routine Description:
pMemDbSetCompatibleName creates the memdb entries necessary
to store names that are in use and are compatible.
Arguments:
NameGroup - Specifies the name group such as ComputerName, UserName, etc...
Name - Specifies the compatible name
Return Value:
none
--*/
{
MemDbSetValueEx (
MEMDB_CATEGORY_INUSENAMES,
NameGroup,
NULL,
Name,
0,
NULL
);
}
VOID
CreateNameTables (
VOID
)
/*++
Routine Description:
CreateNameTables finds all names on the computer and puts valid names
into the InUseNames memdb category, and invalid names into the NewNames
memdb category (including both the invalid name and recommended name).
A wizard page appears if invalid names are found on the system.
Arguments:
none
Return Value:
none
--*/
{
INT i;
NAME_ENUM e;
PNAME_GROUP_ROUTINES Group;
TCHAR RecommendedName[MAX_NAME];
PTSTR p;
PTSTR DupList;
static BOOL AlreadyDone = FALSE;
if (AlreadyDone) {
return;
}
AlreadyDone = TRUE;
TurnOnWaitCursor();
//
// Special case: Add NT group names to InUse list
//
p = (PTSTR) GetStringResource (
*g_ProductFlavor == PERSONAL_PRODUCTTYPE ?
MSG_NAME_COLLISION_LIST_PER :
MSG_NAME_COLLISION_LIST
);
MYASSERT (p);
if (p) {
DupList = DuplicateText (p);
MYASSERT (DupList);
FreeStringResource (p);
p = _tcschr (DupList, TEXT('|'));
while (p) {
*p = 0;
p = _tcschr (_tcsinc (p), TEXT('|'));
}
Group = pGetNameGroupById (MSG_USERNAME_CATEGORY);
MYASSERT (Group);
if (Group) {
p = DupList;
while (*p) {
pMemDbSetCompatibleName (
Group->GroupName,
p
);
p = GetEndOfString (p) + 1;
}
}
FreeText (DupList);
}
//
// General case: Enumerate all names, call Validate and add them to memdb
//
for (i = 0 ; g_NameGroupRoutines[i].GroupName ; i++) {
Group = &g_NameGroupRoutines[i];
//
// Initialize the context structure
//
ZeroMemory (&Group->Context, sizeof (NAME_GROUP_CONTEXT));
Group->Context.GroupName = Group->GroupName;
//
// Call the enum entry point
//
ZeroMemory (&e, sizeof (e));
if (Group->Enum (&Group->Context, &e, TRUE)) {
do {
//
// Determine if this name is valid. If it is valid, add it to the
// InUseNames memdb category. If it is not valid, get a recommended
// replacement name, and store the incompatible and recommended
// names in the NewNames memdb category.
//
#ifdef TEST_MANGLE_NAMES
StringCat (e.Name, TEXT("\"%foo"));
#endif
#ifdef TEST_ALL_INCOMPATIBLE
if (0) {
#else
if (Group->Validate (&Group->Context, e.Name)) {
#endif
pMemDbSetCompatibleName (
Group->GroupName,
e.Name
);
} else {
Group->Recommend (&Group->Context, e.Name, RecommendedName);
pMemDbSetIncompatibleName (
Group->GroupName,
e.Name,
RecommendedName
);
}
} while (Group->Enum (&Group->Context, &e, FALSE));
}
}
TurnOffWaitCursor();
}
BOOL
IsIncompatibleNamesTableEmpty (
VOID
)
/*++
Routine Description:
IsIncompatibleNamesTableEmpty looks at memdb to see if there are any
names in the NewNames category. This function is used to determine
if the name collision wizard page should appear.
Arguments:
none
Return Value:
TRUE if at least one name is invalid, or FALSE if all names are valid.
--*/
{
INVALID_NAME_ENUM e;
return !EnumFirstInvalidName (&e);
}
BOOL
pEnumInvalidNameWorker (
IN OUT PINVALID_NAME_ENUM EnumPtr
)
/*++
Routine Description:
pEnumInvalidNameWorker implements a state machine for invalid
name enumeration. It returns the group name, original name
and new name to the caller.
Arguments:
EnumPtr - Specifies the enumeration in progress; receives the
updated fields
Return Value:
TRUE if an item was enumerated, or FALSE if no more items exist.
--*/
{
PCTSTR p;
INT i;
while (EnumPtr->State != ENUM_STATE_DONE) {
switch (EnumPtr->State) {
case ENUM_STATE_INIT:
if (!MemDbEnumItems (&EnumPtr->NameGroup, MEMDB_CATEGORY_NEWNAMES)) {
EnumPtr->State = ENUM_STATE_DONE;
} else {
EnumPtr->State = ENUM_STATE_ENUM_FIRST_GROUP_ITEM;
}
break;
case ENUM_STATE_ENUM_FIRST_GROUP_ITEM:
if (!MemDbGetValueEx (
&EnumPtr->Name,
MEMDB_CATEGORY_NEWNAMES,
EnumPtr->NameGroup.szName,
MEMDB_FIELD_OLD
)) {
EnumPtr->State = ENUM_STATE_ENUM_NEXT_GROUP;
} else {
EnumPtr->State = ENUM_STATE_RETURN_GROUP_ITEM;
}
break;
case ENUM_STATE_RETURN_GROUP_ITEM:
//
// Get the group name
//
EnumPtr->GroupName = EnumPtr->NameGroup.szName;
//
// Get the display group name from the message resources
//
for (i = 0 ; g_NameGroupRoutines[i].GroupName ; i++) {
if (StringMatch (g_NameGroupRoutines[i].GroupName, EnumPtr->GroupName)) {
break;
}
}
MYASSERT (g_NameGroupRoutines[i].GroupName);
if (g_NameGroupRoutines[i].NameId == MSG_COMPUTERDOMAIN_CATEGORY) {
EnumPtr->State = ENUM_STATE_ENUM_NEXT_GROUP_ITEM;
break;
}
p = GetStringResource (g_NameGroupRoutines[i].NameId);
MYASSERT (p);
if (p) {
_tcssafecpy (EnumPtr->DisplayGroupName, p, (sizeof (EnumPtr->DisplayGroupName) / 2) / sizeof (TCHAR));
FreeStringResource (p);
}
ELSE_DEBUGMSG ((DBG_ERROR, "Unable to get string resource. Check localization."));
//
// Get EnumPtr->NewName and EnumPtr->Identifier
//
EnumPtr->OriginalName = EnumPtr->Name.szName;
MemDbBuildKeyFromOffset (
EnumPtr->Name.dwValue,
EnumPtr->NewName,
3,
NULL
);
MemDbGetOffsetEx (
MEMDB_CATEGORY_NEWNAMES,
EnumPtr->GroupName,
MEMDB_FIELD_OLD,
EnumPtr->OriginalName,
&EnumPtr->Identifier
);
EnumPtr->State = ENUM_STATE_ENUM_NEXT_GROUP_ITEM;
return TRUE;
case ENUM_STATE_ENUM_NEXT_GROUP_ITEM:
if (!MemDbEnumNextValue (&EnumPtr->Name)) {
EnumPtr->State = ENUM_STATE_ENUM_NEXT_GROUP;
} else {
EnumPtr->State = ENUM_STATE_RETURN_GROUP_ITEM;
}
break;
case ENUM_STATE_ENUM_NEXT_GROUP:
if (!MemDbEnumNextValue (&EnumPtr->NameGroup)) {
EnumPtr->State = ENUM_STATE_DONE;
} else {
EnumPtr->State = ENUM_STATE_ENUM_FIRST_GROUP_ITEM;
}
break;
}
}
return FALSE;
}
BOOL
EnumFirstInvalidName (
OUT PINVALID_NAME_ENUM EnumPtr
)
/*++
Routine Description:
EnumFirstInvalidName enumerates the first entry in the memdb NewNames
category. The caller receives the name group, the old name and
the new name.
Arguments:
none
Return Value:
TRUE if at least one name is invalid, or FALSE if all names are valid.
--*/
{
EnumPtr->State = ENUM_STATE_INIT;
return pEnumInvalidNameWorker (EnumPtr);
}
BOOL
EnumNextInvalidName (
IN OUT PINVALID_NAME_ENUM EnumPtr
)
/*++
Routine Description:
EnumNextInvalidName enumerates the first entry in the memdb NewNames
category. The caller receives the name group, the old name and
the new name.
Arguments:
none
Return Value:
TRUE if another invalid name is available, or FALSE if no more names
can be enumerated.
--*/
{
return pEnumInvalidNameWorker (EnumPtr);
}
VOID
GetNamesFromIdentifier (
IN DWORD Identifier,
IN PTSTR NameGroup, OPTIONAL
IN PTSTR OriginalName, OPTIONAL
IN PTSTR NewName OPTIONAL
)
/*++
Routine Description:
GetNamesFromIdentifier copies names to caller-specified buffers, given a
unique identifier (a memdb offset). The unique identifer is provided
by enumeration functions.
Arguments:
Identifier - Specifies the identifier of the name.
NameGroup - Receives the text for the name group.
OriginalName - Receivies the original name.
NewName - Receives the fixed name that is compatible with NT.
Return Value:
none
--*/
{
BOOL b;
PTSTR p;
TCHAR NameGroupTemp[MEMDB_MAX];
TCHAR OrgNameTemp[MEMDB_MAX];
DWORD NewNameOffset;
if (NameGroup) {
*NameGroup = 0;
}
if (OriginalName) {
*OriginalName = 0;
}
if (NewName) {
*NewName = 0;
}
//
// Get NameGroup
//
if (!MemDbBuildKeyFromOffset (Identifier, NameGroupTemp, 1, NULL)) {
return;
}
p = _tcschr (NameGroupTemp, TEXT('\\'));
MYASSERT (p);
*p = 0;
if (NameGroup) {
StringCopy (NameGroup, NameGroupTemp);
}
//
// Get OrgName and NewNameOffset.
//
b = MemDbBuildKeyFromOffset (Identifier, OrgNameTemp, 3, &NewNameOffset);
if (OriginalName) {
StringCopy (OriginalName, OrgNameTemp);
}
//
// Get NewName
//
if (NewName) {
b &= MemDbBuildKeyFromOffset (NewNameOffset, NewName, 3, NULL);
}
MYASSERT (b);
}
VOID
ChangeName (
IN DWORD Identifier,
IN PCTSTR NewName
)
/*++
Routine Description:
ChangeName puts a new name value in memdb for the name indicated by
Identifier. The Identifier comes from enum functions.
Arguments:
Identifier - Specifies the name identifier (a memdb offset), and cannot be
zero.
NewName - Specifies the NT-compatible replacement name.
Return Value:
none
--*/
{
TCHAR Node[MEMDB_MAX];
TCHAR NameGroup[MEMDB_MAX];
TCHAR OrgName[MEMDB_MAX];
DWORD NewNameOffset;
PTSTR p, q;
BOOL b;
MYASSERT (Identifier);
if (!Identifier) {
return;
}
//
// - Obtain the original name
// - Get the offset to the current new name
// - Build the full key to the current new name
// - Delete the current new name
//
if (!MemDbBuildKeyFromOffset (Identifier, OrgName, 3, &NewNameOffset)) {
DEBUGMSG ((DBG_WHOOPS, "Can't obtain original name using offset %u", Identifier));
LOG ((LOG_ERROR, "Can't obtain original name using offset %u", Identifier));
return;
}
if (!MemDbBuildKeyFromOffset (NewNameOffset, Node, 0, NULL)) {
DEBUGMSG ((DBG_WHOOPS, "Can't obtain new name key using offset %u", NewNameOffset));
LOG ((LOG_ERROR, "Can't obtain new name key using offset %u", NewNameOffset));
return;
}
MemDbDeleteValue (Node);
//
// Obtain the name group from the key string. It's the second
// field (separated by backslashes).
//
p = _tcschr (Node, TEXT('\\'));
MYASSERT (p);
p = _tcsinc (p);
q = _tcschr (p, TEXT('\\'));
MYASSERT (q);
StringCopyAB (NameGroup, p, q);
//
// Now set the updated new name, and link the original name
// to the new name.
//
b = MemDbSetValueEx (
MEMDB_CATEGORY_NEWNAMES,
NameGroup,
MEMDB_FIELD_NEW,
NewName,
0,
&NewNameOffset
);
b &= MemDbSetValueEx (
MEMDB_CATEGORY_NEWNAMES,
NameGroup,
MEMDB_FIELD_OLD,
OrgName,
NewNameOffset,
NULL
);
if (!b) {
LOG ((LOG_ERROR, "Failure while attempting to change %s name to %s.",OrgName,NewName));
}
}
BOOL
GetUpgradeComputerName (
OUT PTSTR NewName
)
/*++
Routine Description:
GetUpgradeComputerName obtains the computer name that will be used for
upgrade.
Arguments:
NewName - Receives the name of the computer, as it will be set
when NT is installed. Must hold at least
MAX_COMPUTER_NAME characters.
Return Value:
TRUE if the name exists, or FALSE if it does not yet exit.
--*/
{
PNAME_GROUP_ROUTINES Group;
NAME_ENUM e;
Group = pGetNameGroupById (MSG_COMPUTERNAME_CATEGORY);
MYASSERT (Group);
if (!Group)
return FALSE;
//
// Look in MemDb for a replacement name
//
if (MemDbGetEndpointValueEx (
MEMDB_CATEGORY_NEWNAMES,
Group->GroupName,
MEMDB_FIELD_NEW,
NewName
)) {
return TRUE;
}
//
// No replacement name; obtain the current name
//
ZeroMemory (&e, sizeof (e));
if (Group->Enum (&Group->Context, &e, TRUE)) {
StringCopy (NewName, e.Name);
while (Group->Enum (&Group->Context, &e, FALSE)) {
// empty
}
return TRUE;
}
return FALSE;
}
DWORD
GetDomainIdentifier (
VOID
)
/*++
Routine Description:
GetDomainIdentifier returns the identifier for the domain name. The
identifier is a memdb offset.
Arguments:
None.
Return Value:
A non-zero identifier which can be used with other routines in this file.
--*/
{
PNAME_GROUP_ROUTINES Group;
MEMDB_ENUM e;
DWORD Identifier = 0;
Group = pGetNameGroupById (MSG_COMPUTERDOMAIN_CATEGORY);
MYASSERT (Group);
if (Group && MemDbGetValueEx (
&e,
MEMDB_CATEGORY_NEWNAMES,
Group->GroupName,
MEMDB_FIELD_OLD
)) {
MemDbGetOffsetEx (
MEMDB_CATEGORY_NEWNAMES,
Group->GroupName,
MEMDB_FIELD_OLD,
e.szName,
&Identifier
);
}
return Identifier;
}
BOOL
pGetUpgradeName (
IN UINT CategoryId,
OUT PTSTR NewName
)
/*++
Routine Description:
pGetUpgradeName returns the NT-compatible name for a given name group. If
a name group has multiple names, this routine should not be used.
Arguments:
CategoryId - Specifies the MSG_* constant for the group (see macro
expansion list at top of file).
NewName - Receives the text for the NT-compatible replacement name for
the group.
Return Value:
TRUE if a name is being returned, or FALSE if no replacement name exists.
--*/
{
PNAME_GROUP_ROUTINES Group;
NAME_ENUM e;
Group = pGetNameGroupById (CategoryId);
MYASSERT (Group);
if (!Group)
return FALSE;
//
// Look in MemDb for a replacement name
//
if (MemDbGetEndpointValueEx (
MEMDB_CATEGORY_NEWNAMES,
Group->GroupName,
MEMDB_FIELD_NEW,
NewName
)) {
return TRUE;
}
//
// No replacement name; obtain the current name
//
ZeroMemory (&e, sizeof (e));
if (Group->Enum (&Group->Context, &e, TRUE)) {
StringCopy (NewName, e.Name);
while (Group->Enum (&Group->Context, &e, FALSE)) {
// empty
}
return TRUE;
}
return FALSE;
}
BOOL
GetUpgradeDomainName (
OUT PTSTR NewName
)
/*++
Routine Description:
GetUpgradeDomainName returns the new domain name, if one exists.
Arguments:
NewName - Receiveis the new domain name.
Return Value:
TRUE if a new name is being returned, or FALSE if no replacement name
exists.
--*/
{
return pGetUpgradeName (
MSG_COMPUTERDOMAIN_CATEGORY,
NewName
);
}
BOOL
GetUpgradeWorkgroupName (
OUT PTSTR NewName
)
/*++
Routine Description:
GetUpgradeWorkgroupName returns the new workgroup name, if one exists.
Arguments:
None.
Return Value:
TRUE if a new name is being returned, or FALSE if no replacement name
exists.
--*/
{
return pGetUpgradeName (
MSG_WORKGROUP_CATEGORY,
NewName
);
}
BOOL
GetUpgradeUserName (
IN PCTSTR User,
OUT PTSTR NewUserName
)
/*++
Routine Description:
GetUpgradeUserName returns the fixed user name for the user specified. If
no fixed name exists, this routine returns the original name.
Arguments:
User - Specifies the user to look up. The user name must exist on
the Win9x configuration.
NewUserName - Receives the NT-compatible user name, which may or may not be
the same as User.
Return Value:
Always TRUE.
--*/
{
PNAME_GROUP_ROUTINES Group;
TCHAR Node[MEMDB_MAX];
DWORD NewOffset;
Group = pGetNameGroupById (MSG_USERNAME_CATEGORY);
MYASSERT (Group);
//
// Look in MemDb for a replacement name
//
if (Group) {
MemDbBuildKey (
Node,
MEMDB_CATEGORY_NEWNAMES,
Group->GroupName,
MEMDB_FIELD_OLD,
User
);
if (MemDbGetValue (Node, &NewOffset)) {
if (MemDbBuildKeyFromOffset (NewOffset, NewUserName, 3, NULL)) {
return TRUE;
}
}
}
//
// No replacement name; use the current name
//
StringCopy (NewUserName, User);
return TRUE;
}
BOOL
WarnAboutBadNames (
IN HWND PopupParent
)
/*++
Routine Description:
WarnAboutBadNames adds an incompatibility message whenever domain
logon is enabled but there is no account set up for the machine. A popup
is generated if PopupParent is non-NULL.
Other incompatibility messages are added for each name that will change.
Arguments:
Popup - Specifies TRUE if the message should appear in a message box, or
FALSE if it should be added to the incompatibility report.
Return Value:
TRUE if the user wants to continue, or FALSE if the user wants to change
the domain name.
--*/
{
PCTSTR RootGroup;
PCTSTR NameSubGroup;
PCTSTR FullGroupName;
PCTSTR BaseGroup;
PNAME_GROUP_CONTEXT Context;
PCTSTR ArgArray[3];
INVALID_NAME_ENUM e;
BOOL b = TRUE;
TCHAR EncodedName[MEMDB_MAX];
PCTSTR Blank;
if (PopupParent) {
//
// PopupParent is non-NULL only when the incompatible names wizard page
// is being deactivated. Here we have a chance to make sure the names
// specified all work together before proceeding.
//
// This functionality has been disabled because domain validation has
// been moved to a new page. We might re-enable this when another
// invalid name group comes along.
//
return TRUE;
}
//
// Enumerate all bad names
//
if (EnumFirstInvalidName (&e)) {
Blank = GetStringResource (MSG_BLANK_NAME);
MYASSERT (Blank);
do {
//
// Prepare message
//
ArgArray[0] = e.DisplayGroupName;
ArgArray[1] = e.OriginalName;
ArgArray[2] = e.NewName;
if (ArgArray[1][0] == 0) {
ArgArray[1] = Blank;
}
if (ArgArray[2][0] == 0) {
ArgArray[2] = Blank;
}
RootGroup = GetStringResource (MSG_INSTALL_NOTES_ROOT);
MYASSERT (RootGroup);
NameSubGroup = ParseMessageID (MSG_NAMECHANGE_WARNING_GROUP, ArgArray);
MYASSERT (NameSubGroup);
BaseGroup = JoinPaths (RootGroup, NameSubGroup);
MYASSERT (BaseGroup);
FreeStringResource (RootGroup);
FreeStringResource (NameSubGroup);
NameSubGroup = ParseMessageID (MSG_NAMECHANGE_WARNING_SUBCOMPONENT, ArgArray);
MYASSERT (NameSubGroup);
FullGroupName = JoinPaths (BaseGroup, NameSubGroup);
MYASSERT (FullGroupName);
FreePathString (BaseGroup);
FreeStringResource (NameSubGroup);
EncodedName[0] = TEXT('|');
StringCopy (EncodedName + 1, e.OriginalName);
MsgMgr_ObjectMsg_Add(
EncodedName, // Object name, prefixed with a pipe symbol
FullGroupName, // Message title
S_EMPTY // Message text
);
FreePathString (FullGroupName);
} while (EnumNextInvalidName (&e));
FreeStringResource (Blank);
//
// Save changed user names to FixedUserNames
//
Context = pGetNameGroupContextById (MSG_USERNAME_CATEGORY);
MYASSERT (Context);
if (EnumFirstInvalidName (&e)) {
do {
if (StringMatch (Context->GroupName, e.GroupName)) {
_tcssafecpy (EncodedName, e.OriginalName, MAX_USER_NAME);
MemDbMakeNonPrintableKey (
EncodedName,
MEMDB_CONVERT_DOUBLEWACKS_TO_ASCII_1|
MEMDB_CONVERT_WILD_STAR_TO_ASCII_2|
MEMDB_CONVERT_WILD_QMARK_TO_ASCII_3
);
MemDbSetValueEx (
MEMDB_CATEGORY_FIXEDUSERNAMES,
EncodedName,
NULL,
e.NewName,
0,
NULL
);
}
} while (EnumNextInvalidName (&e));
}
}
return b;
}
DWORD
BadNamesWarning (
DWORD Request
)
{
switch (Request) {
case REQUEST_QUERYTICKS:
return TICKS_BAD_NAMES_WARNING;
case REQUEST_RUN:
if (!WarnAboutBadNames (NULL)) {
return GetLastError ();
}
else {
return ERROR_SUCCESS;
}
default:
DEBUGMSG ((DBG_ERROR, "Bad parameter in BadNamesWarning"));
}
return 0;
}
//
// The following flag is no longer in use. It used to be used
// to disable domain checking (to bypass the block requiring
// a valid domain). Currently there is no way to get beyond
// the wizard page that resolved the domain name, except by
// providing a valid domain or credentials to create a computer
// account on a domain.
//
BOOL g_DisableDomainChecks = FALSE;
VOID
DisableDomainChecks (
VOID
)
{
g_DisableDomainChecks = TRUE;
}
VOID
EnableDomainChecks (
VOID
)
{
g_DisableDomainChecks = FALSE;
}
BOOL
IsOriginalDomainNameValid (
VOID
)
/*++
Routine Description:
IsOriginalDomainNameValid checks to see if there is a replacement domain
name. If there is, the current domain name must be invalid.
Arguments:
None.
Return Value:
TRUE - the Win9x domain name is valid, no replacement name exists
FALSE - the Win9x domain name is invalid
--*/
{
PNAME_GROUP_ROUTINES Group;
TCHAR NewName[MEMDB_MAX];
Group = pGetNameGroupById (MSG_COMPUTERDOMAIN_CATEGORY);
MYASSERT (Group);
//
// Look in MemDb for a replacement name
//
if (Group && MemDbGetEndpointValueEx (
MEMDB_CATEGORY_NEWNAMES,
Group->GroupName,
MEMDB_FIELD_NEW,
NewName
)) {
return FALSE;
}
return TRUE;
}
| 22.522519 | 128 | 0.579981 | [
"object"
] |
50277b07ffa3722e4c06e5fe4e7921580ba52c29 | 14,891 | h | C | native/cocos/bindings/auto/jsb_physics_auto.h | SteveLau-GameDeveloper/engine | 159e5acd0f5115a878d59ed59f924ce7627a5466 | [
"Apache-2.0",
"MIT"
] | null | null | null | native/cocos/bindings/auto/jsb_physics_auto.h | SteveLau-GameDeveloper/engine | 159e5acd0f5115a878d59ed59f924ce7627a5466 | [
"Apache-2.0",
"MIT"
] | null | null | null | native/cocos/bindings/auto/jsb_physics_auto.h | SteveLau-GameDeveloper/engine | 159e5acd0f5115a878d59ed59f924ce7627a5466 | [
"Apache-2.0",
"MIT"
] | null | null | null | // clang-format off
#pragma once
#include <type_traits>
#include "cocos/bindings/jswrapper/SeApi.h"
#include "cocos/bindings/manual/jsb_conversions.h"
#include "cocos/bindings/auto/jsb_gfx_auto.h"
#include "cocos/bindings/auto/jsb_scene_auto.h"
#include "cocos/physics/PhysicsSDK.h"
bool register_all_physics(se::Object *obj); // NOLINT
JSB_REGISTER_OBJECT_TYPE(cc::physics::RevoluteJoint);
JSB_REGISTER_OBJECT_TYPE(cc::physics::DistanceJoint);
JSB_REGISTER_OBJECT_TYPE(cc::physics::RigidBody);
JSB_REGISTER_OBJECT_TYPE(cc::physics::SphereShape);
JSB_REGISTER_OBJECT_TYPE(cc::physics::BoxShape);
JSB_REGISTER_OBJECT_TYPE(cc::physics::CapsuleShape);
JSB_REGISTER_OBJECT_TYPE(cc::physics::PlaneShape);
JSB_REGISTER_OBJECT_TYPE(cc::physics::TrimeshShape);
JSB_REGISTER_OBJECT_TYPE(cc::physics::CylinderShape);
JSB_REGISTER_OBJECT_TYPE(cc::physics::ConeShape);
JSB_REGISTER_OBJECT_TYPE(cc::physics::TerrainShape);
JSB_REGISTER_OBJECT_TYPE(cc::physics::World);
extern se::Object *__jsb_cc_physics_RevoluteJoint_proto; // NOLINT
extern se::Class * __jsb_cc_physics_RevoluteJoint_class; // NOLINT
bool js_register_cc_physics_RevoluteJoint(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_physics_RevoluteJoint_getImpl);
SE_DECLARE_FUNC(js_physics_RevoluteJoint_initialize);
SE_DECLARE_FUNC(js_physics_RevoluteJoint_onDestroy);
SE_DECLARE_FUNC(js_physics_RevoluteJoint_onDisable);
SE_DECLARE_FUNC(js_physics_RevoluteJoint_onEnable);
SE_DECLARE_FUNC(js_physics_RevoluteJoint_setAxis);
SE_DECLARE_FUNC(js_physics_RevoluteJoint_setConnectedBody);
SE_DECLARE_FUNC(js_physics_RevoluteJoint_setEnableCollision);
SE_DECLARE_FUNC(js_physics_RevoluteJoint_setPivotA);
SE_DECLARE_FUNC(js_physics_RevoluteJoint_setPivotB);
SE_DECLARE_FUNC(js_physics_RevoluteJoint_RevoluteJoint);
extern se::Object *__jsb_cc_physics_DistanceJoint_proto; // NOLINT
extern se::Class * __jsb_cc_physics_DistanceJoint_class; // NOLINT
bool js_register_cc_physics_DistanceJoint(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_physics_DistanceJoint_getImpl);
SE_DECLARE_FUNC(js_physics_DistanceJoint_initialize);
SE_DECLARE_FUNC(js_physics_DistanceJoint_onDestroy);
SE_DECLARE_FUNC(js_physics_DistanceJoint_onDisable);
SE_DECLARE_FUNC(js_physics_DistanceJoint_onEnable);
SE_DECLARE_FUNC(js_physics_DistanceJoint_setConnectedBody);
SE_DECLARE_FUNC(js_physics_DistanceJoint_setEnableCollision);
SE_DECLARE_FUNC(js_physics_DistanceJoint_setPivotA);
SE_DECLARE_FUNC(js_physics_DistanceJoint_setPivotB);
SE_DECLARE_FUNC(js_physics_DistanceJoint_DistanceJoint);
extern se::Object *__jsb_cc_physics_RigidBody_proto; // NOLINT
extern se::Class * __jsb_cc_physics_RigidBody_class; // NOLINT
bool js_register_cc_physics_RigidBody(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_physics_RigidBody_applyForce);
SE_DECLARE_FUNC(js_physics_RigidBody_applyImpulse);
SE_DECLARE_FUNC(js_physics_RigidBody_applyLocalForce);
SE_DECLARE_FUNC(js_physics_RigidBody_applyLocalImpulse);
SE_DECLARE_FUNC(js_physics_RigidBody_applyLocalTorque);
SE_DECLARE_FUNC(js_physics_RigidBody_applyTorque);
SE_DECLARE_FUNC(js_physics_RigidBody_clearForces);
SE_DECLARE_FUNC(js_physics_RigidBody_clearState);
SE_DECLARE_FUNC(js_physics_RigidBody_clearVelocity);
SE_DECLARE_FUNC(js_physics_RigidBody_getAngularVelocity);
SE_DECLARE_FUNC(js_physics_RigidBody_getGroup);
SE_DECLARE_FUNC(js_physics_RigidBody_getImpl);
SE_DECLARE_FUNC(js_physics_RigidBody_getLinearVelocity);
SE_DECLARE_FUNC(js_physics_RigidBody_getMask);
SE_DECLARE_FUNC(js_physics_RigidBody_getNodeHandle);
SE_DECLARE_FUNC(js_physics_RigidBody_getSleepThreshold);
SE_DECLARE_FUNC(js_physics_RigidBody_initialize);
SE_DECLARE_FUNC(js_physics_RigidBody_isAwake);
SE_DECLARE_FUNC(js_physics_RigidBody_isSleeping);
SE_DECLARE_FUNC(js_physics_RigidBody_isSleepy);
SE_DECLARE_FUNC(js_physics_RigidBody_onDestroy);
SE_DECLARE_FUNC(js_physics_RigidBody_onDisable);
SE_DECLARE_FUNC(js_physics_RigidBody_onEnable);
SE_DECLARE_FUNC(js_physics_RigidBody_setAllowSleep);
SE_DECLARE_FUNC(js_physics_RigidBody_setAngularDamping);
SE_DECLARE_FUNC(js_physics_RigidBody_setAngularFactor);
SE_DECLARE_FUNC(js_physics_RigidBody_setAngularVelocity);
SE_DECLARE_FUNC(js_physics_RigidBody_setGroup);
SE_DECLARE_FUNC(js_physics_RigidBody_setLinearDamping);
SE_DECLARE_FUNC(js_physics_RigidBody_setLinearFactor);
SE_DECLARE_FUNC(js_physics_RigidBody_setLinearVelocity);
SE_DECLARE_FUNC(js_physics_RigidBody_setMask);
SE_DECLARE_FUNC(js_physics_RigidBody_setMass);
SE_DECLARE_FUNC(js_physics_RigidBody_setSleepThreshold);
SE_DECLARE_FUNC(js_physics_RigidBody_setType);
SE_DECLARE_FUNC(js_physics_RigidBody_sleep);
SE_DECLARE_FUNC(js_physics_RigidBody_useCCD);
SE_DECLARE_FUNC(js_physics_RigidBody_useGravity);
SE_DECLARE_FUNC(js_physics_RigidBody_wakeUp);
SE_DECLARE_FUNC(js_physics_RigidBody_RigidBody);
extern se::Object *__jsb_cc_physics_SphereShape_proto; // NOLINT
extern se::Class * __jsb_cc_physics_SphereShape_class; // NOLINT
bool js_register_cc_physics_SphereShape(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_physics_SphereShape_getAABB);
SE_DECLARE_FUNC(js_physics_SphereShape_getBoundingSphere);
SE_DECLARE_FUNC(js_physics_SphereShape_getGroup);
SE_DECLARE_FUNC(js_physics_SphereShape_getImpl);
SE_DECLARE_FUNC(js_physics_SphereShape_getMask);
SE_DECLARE_FUNC(js_physics_SphereShape_initialize);
SE_DECLARE_FUNC(js_physics_SphereShape_onDestroy);
SE_DECLARE_FUNC(js_physics_SphereShape_onDisable);
SE_DECLARE_FUNC(js_physics_SphereShape_onEnable);
SE_DECLARE_FUNC(js_physics_SphereShape_setAsTrigger);
SE_DECLARE_FUNC(js_physics_SphereShape_setCenter);
SE_DECLARE_FUNC(js_physics_SphereShape_setGroup);
SE_DECLARE_FUNC(js_physics_SphereShape_setMask);
SE_DECLARE_FUNC(js_physics_SphereShape_setMaterial);
SE_DECLARE_FUNC(js_physics_SphereShape_setRadius);
SE_DECLARE_FUNC(js_physics_SphereShape_updateEventListener);
SE_DECLARE_FUNC(js_physics_SphereShape_SphereShape);
extern se::Object *__jsb_cc_physics_BoxShape_proto; // NOLINT
extern se::Class * __jsb_cc_physics_BoxShape_class; // NOLINT
bool js_register_cc_physics_BoxShape(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_physics_BoxShape_getAABB);
SE_DECLARE_FUNC(js_physics_BoxShape_getBoundingSphere);
SE_DECLARE_FUNC(js_physics_BoxShape_getGroup);
SE_DECLARE_FUNC(js_physics_BoxShape_getImpl);
SE_DECLARE_FUNC(js_physics_BoxShape_getMask);
SE_DECLARE_FUNC(js_physics_BoxShape_initialize);
SE_DECLARE_FUNC(js_physics_BoxShape_onDestroy);
SE_DECLARE_FUNC(js_physics_BoxShape_onDisable);
SE_DECLARE_FUNC(js_physics_BoxShape_onEnable);
SE_DECLARE_FUNC(js_physics_BoxShape_setAsTrigger);
SE_DECLARE_FUNC(js_physics_BoxShape_setCenter);
SE_DECLARE_FUNC(js_physics_BoxShape_setGroup);
SE_DECLARE_FUNC(js_physics_BoxShape_setMask);
SE_DECLARE_FUNC(js_physics_BoxShape_setMaterial);
SE_DECLARE_FUNC(js_physics_BoxShape_setSize);
SE_DECLARE_FUNC(js_physics_BoxShape_updateEventListener);
SE_DECLARE_FUNC(js_physics_BoxShape_BoxShape);
extern se::Object *__jsb_cc_physics_CapsuleShape_proto; // NOLINT
extern se::Class * __jsb_cc_physics_CapsuleShape_class; // NOLINT
bool js_register_cc_physics_CapsuleShape(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_physics_CapsuleShape_getAABB);
SE_DECLARE_FUNC(js_physics_CapsuleShape_getBoundingSphere);
SE_DECLARE_FUNC(js_physics_CapsuleShape_getGroup);
SE_DECLARE_FUNC(js_physics_CapsuleShape_getImpl);
SE_DECLARE_FUNC(js_physics_CapsuleShape_getMask);
SE_DECLARE_FUNC(js_physics_CapsuleShape_initialize);
SE_DECLARE_FUNC(js_physics_CapsuleShape_onDestroy);
SE_DECLARE_FUNC(js_physics_CapsuleShape_onDisable);
SE_DECLARE_FUNC(js_physics_CapsuleShape_onEnable);
SE_DECLARE_FUNC(js_physics_CapsuleShape_setAsTrigger);
SE_DECLARE_FUNC(js_physics_CapsuleShape_setCenter);
SE_DECLARE_FUNC(js_physics_CapsuleShape_setCylinderHeight);
SE_DECLARE_FUNC(js_physics_CapsuleShape_setDirection);
SE_DECLARE_FUNC(js_physics_CapsuleShape_setGroup);
SE_DECLARE_FUNC(js_physics_CapsuleShape_setMask);
SE_DECLARE_FUNC(js_physics_CapsuleShape_setMaterial);
SE_DECLARE_FUNC(js_physics_CapsuleShape_setRadius);
SE_DECLARE_FUNC(js_physics_CapsuleShape_updateEventListener);
SE_DECLARE_FUNC(js_physics_CapsuleShape_CapsuleShape);
extern se::Object *__jsb_cc_physics_PlaneShape_proto; // NOLINT
extern se::Class * __jsb_cc_physics_PlaneShape_class; // NOLINT
bool js_register_cc_physics_PlaneShape(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_physics_PlaneShape_getAABB);
SE_DECLARE_FUNC(js_physics_PlaneShape_getBoundingSphere);
SE_DECLARE_FUNC(js_physics_PlaneShape_getGroup);
SE_DECLARE_FUNC(js_physics_PlaneShape_getImpl);
SE_DECLARE_FUNC(js_physics_PlaneShape_getMask);
SE_DECLARE_FUNC(js_physics_PlaneShape_initialize);
SE_DECLARE_FUNC(js_physics_PlaneShape_onDestroy);
SE_DECLARE_FUNC(js_physics_PlaneShape_onDisable);
SE_DECLARE_FUNC(js_physics_PlaneShape_onEnable);
SE_DECLARE_FUNC(js_physics_PlaneShape_setAsTrigger);
SE_DECLARE_FUNC(js_physics_PlaneShape_setCenter);
SE_DECLARE_FUNC(js_physics_PlaneShape_setConstant);
SE_DECLARE_FUNC(js_physics_PlaneShape_setGroup);
SE_DECLARE_FUNC(js_physics_PlaneShape_setMask);
SE_DECLARE_FUNC(js_physics_PlaneShape_setMaterial);
SE_DECLARE_FUNC(js_physics_PlaneShape_setNormal);
SE_DECLARE_FUNC(js_physics_PlaneShape_updateEventListener);
SE_DECLARE_FUNC(js_physics_PlaneShape_PlaneShape);
extern se::Object *__jsb_cc_physics_TrimeshShape_proto; // NOLINT
extern se::Class * __jsb_cc_physics_TrimeshShape_class; // NOLINT
bool js_register_cc_physics_TrimeshShape(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_physics_TrimeshShape_getAABB);
SE_DECLARE_FUNC(js_physics_TrimeshShape_getBoundingSphere);
SE_DECLARE_FUNC(js_physics_TrimeshShape_getGroup);
SE_DECLARE_FUNC(js_physics_TrimeshShape_getImpl);
SE_DECLARE_FUNC(js_physics_TrimeshShape_getMask);
SE_DECLARE_FUNC(js_physics_TrimeshShape_initialize);
SE_DECLARE_FUNC(js_physics_TrimeshShape_onDestroy);
SE_DECLARE_FUNC(js_physics_TrimeshShape_onDisable);
SE_DECLARE_FUNC(js_physics_TrimeshShape_onEnable);
SE_DECLARE_FUNC(js_physics_TrimeshShape_setAsTrigger);
SE_DECLARE_FUNC(js_physics_TrimeshShape_setCenter);
SE_DECLARE_FUNC(js_physics_TrimeshShape_setGroup);
SE_DECLARE_FUNC(js_physics_TrimeshShape_setMask);
SE_DECLARE_FUNC(js_physics_TrimeshShape_setMaterial);
SE_DECLARE_FUNC(js_physics_TrimeshShape_setMesh);
SE_DECLARE_FUNC(js_physics_TrimeshShape_updateEventListener);
SE_DECLARE_FUNC(js_physics_TrimeshShape_useConvex);
SE_DECLARE_FUNC(js_physics_TrimeshShape_TrimeshShape);
extern se::Object *__jsb_cc_physics_CylinderShape_proto; // NOLINT
extern se::Class * __jsb_cc_physics_CylinderShape_class; // NOLINT
bool js_register_cc_physics_CylinderShape(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_physics_CylinderShape_getAABB);
SE_DECLARE_FUNC(js_physics_CylinderShape_getBoundingSphere);
SE_DECLARE_FUNC(js_physics_CylinderShape_getGroup);
SE_DECLARE_FUNC(js_physics_CylinderShape_getImpl);
SE_DECLARE_FUNC(js_physics_CylinderShape_getMask);
SE_DECLARE_FUNC(js_physics_CylinderShape_initialize);
SE_DECLARE_FUNC(js_physics_CylinderShape_onDestroy);
SE_DECLARE_FUNC(js_physics_CylinderShape_onDisable);
SE_DECLARE_FUNC(js_physics_CylinderShape_onEnable);
SE_DECLARE_FUNC(js_physics_CylinderShape_setAsTrigger);
SE_DECLARE_FUNC(js_physics_CylinderShape_setCenter);
SE_DECLARE_FUNC(js_physics_CylinderShape_setConvex);
SE_DECLARE_FUNC(js_physics_CylinderShape_setCylinder);
SE_DECLARE_FUNC(js_physics_CylinderShape_setGroup);
SE_DECLARE_FUNC(js_physics_CylinderShape_setMask);
SE_DECLARE_FUNC(js_physics_CylinderShape_setMaterial);
SE_DECLARE_FUNC(js_physics_CylinderShape_updateEventListener);
SE_DECLARE_FUNC(js_physics_CylinderShape_CylinderShape);
extern se::Object *__jsb_cc_physics_ConeShape_proto; // NOLINT
extern se::Class * __jsb_cc_physics_ConeShape_class; // NOLINT
bool js_register_cc_physics_ConeShape(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_physics_ConeShape_getAABB);
SE_DECLARE_FUNC(js_physics_ConeShape_getBoundingSphere);
SE_DECLARE_FUNC(js_physics_ConeShape_getGroup);
SE_DECLARE_FUNC(js_physics_ConeShape_getImpl);
SE_DECLARE_FUNC(js_physics_ConeShape_getMask);
SE_DECLARE_FUNC(js_physics_ConeShape_initialize);
SE_DECLARE_FUNC(js_physics_ConeShape_onDestroy);
SE_DECLARE_FUNC(js_physics_ConeShape_onDisable);
SE_DECLARE_FUNC(js_physics_ConeShape_onEnable);
SE_DECLARE_FUNC(js_physics_ConeShape_setAsTrigger);
SE_DECLARE_FUNC(js_physics_ConeShape_setCenter);
SE_DECLARE_FUNC(js_physics_ConeShape_setCone);
SE_DECLARE_FUNC(js_physics_ConeShape_setConvex);
SE_DECLARE_FUNC(js_physics_ConeShape_setGroup);
SE_DECLARE_FUNC(js_physics_ConeShape_setMask);
SE_DECLARE_FUNC(js_physics_ConeShape_setMaterial);
SE_DECLARE_FUNC(js_physics_ConeShape_updateEventListener);
SE_DECLARE_FUNC(js_physics_ConeShape_ConeShape);
extern se::Object *__jsb_cc_physics_TerrainShape_proto; // NOLINT
extern se::Class * __jsb_cc_physics_TerrainShape_class; // NOLINT
bool js_register_cc_physics_TerrainShape(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_physics_TerrainShape_getAABB);
SE_DECLARE_FUNC(js_physics_TerrainShape_getBoundingSphere);
SE_DECLARE_FUNC(js_physics_TerrainShape_getGroup);
SE_DECLARE_FUNC(js_physics_TerrainShape_getImpl);
SE_DECLARE_FUNC(js_physics_TerrainShape_getMask);
SE_DECLARE_FUNC(js_physics_TerrainShape_initialize);
SE_DECLARE_FUNC(js_physics_TerrainShape_onDestroy);
SE_DECLARE_FUNC(js_physics_TerrainShape_onDisable);
SE_DECLARE_FUNC(js_physics_TerrainShape_onEnable);
SE_DECLARE_FUNC(js_physics_TerrainShape_setAsTrigger);
SE_DECLARE_FUNC(js_physics_TerrainShape_setCenter);
SE_DECLARE_FUNC(js_physics_TerrainShape_setGroup);
SE_DECLARE_FUNC(js_physics_TerrainShape_setMask);
SE_DECLARE_FUNC(js_physics_TerrainShape_setMaterial);
SE_DECLARE_FUNC(js_physics_TerrainShape_setTerrain);
SE_DECLARE_FUNC(js_physics_TerrainShape_updateEventListener);
SE_DECLARE_FUNC(js_physics_TerrainShape_TerrainShape);
extern se::Object *__jsb_cc_physics_World_proto; // NOLINT
extern se::Class * __jsb_cc_physics_World_class; // NOLINT
bool js_register_cc_physics_World(se::Object *obj); // NOLINT
SE_DECLARE_FUNC(js_physics_World_createConvex);
SE_DECLARE_FUNC(js_physics_World_createHeightField);
SE_DECLARE_FUNC(js_physics_World_createMaterial);
SE_DECLARE_FUNC(js_physics_World_createTrimesh);
SE_DECLARE_FUNC(js_physics_World_destroy);
SE_DECLARE_FUNC(js_physics_World_emitEvents);
SE_DECLARE_FUNC(js_physics_World_getContactEventPairs);
SE_DECLARE_FUNC(js_physics_World_getTriggerEventPairs);
SE_DECLARE_FUNC(js_physics_World_raycast);
SE_DECLARE_FUNC(js_physics_World_raycastClosest);
SE_DECLARE_FUNC(js_physics_World_raycastClosestResult);
SE_DECLARE_FUNC(js_physics_World_raycastResult);
SE_DECLARE_FUNC(js_physics_World_setAllowSleep);
SE_DECLARE_FUNC(js_physics_World_setCollisionMatrix);
SE_DECLARE_FUNC(js_physics_World_setGravity);
SE_DECLARE_FUNC(js_physics_World_step);
SE_DECLARE_FUNC(js_physics_World_syncSceneToPhysics);
SE_DECLARE_FUNC(js_physics_World_syncSceneWithCheck);
SE_DECLARE_FUNC(js_physics_World_World);
// clang-format on
| 46.389408 | 71 | 0.895843 | [
"object"
] |
50282931842ddc6c99d381a922c0827ae43e8b69 | 2,713 | h | C | component/oai-nssf/src/api-server/model/RestrictedSnssai.h | kukkalli/oai-cn5g-fed | 15634fac935ac8671b61654bdf75bf8af07d3c3a | [
"Apache-2.0"
] | null | null | null | component/oai-nssf/src/api-server/model/RestrictedSnssai.h | kukkalli/oai-cn5g-fed | 15634fac935ac8671b61654bdf75bf8af07d3c3a | [
"Apache-2.0"
] | null | null | null | component/oai-nssf/src/api-server/model/RestrictedSnssai.h | kukkalli/oai-cn5g-fed | 15634fac935ac8671b61654bdf75bf8af07d3c3a | [
"Apache-2.0"
] | null | null | null | /**
* NSSF NSSAI Availability
* NSSF NSSAI Availability Service. © 2021, 3GPP Organizational Partners (ARIB,
* ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.4
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* RestrictedSnssai.h
*
*
*/
#ifndef RestrictedSnssai_H_
#define RestrictedSnssai_H_
#include "ExtSnssai.h"
#include "PlmnId.h"
#include <nlohmann/json.hpp>
#include <vector>
namespace oai {
namespace nssf_server {
namespace model {
/// <summary>
///
/// </summary>
class RestrictedSnssai {
public:
RestrictedSnssai();
virtual ~RestrictedSnssai() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on
/// failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes
/// an error message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and
/// calls it's validate. Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const RestrictedSnssai& rhs) const;
bool operator!=(const RestrictedSnssai& rhs) const;
/////////////////////////////////////////////
/// RestrictedSnssai members
/// <summary>
///
/// </summary>
PlmnId getHomePlmnId() const;
void setHomePlmnId(PlmnId const& value);
/// <summary>
///
/// </summary>
std::vector<ExtSnssai> getSNssaiList() const;
void setSNssaiList(std::vector<ExtSnssai> const& value);
/// <summary>
///
/// </summary>
std::vector<PlmnId> getHomePlmnIdList() const;
void setHomePlmnIdList(std::vector<PlmnId> const& value);
bool homePlmnIdListIsSet() const;
void unsetHomePlmnIdList();
/// <summary>
///
/// </summary>
bool isRoamingRestriction() const;
void setRoamingRestriction(bool const value);
bool roamingRestrictionIsSet() const;
void unsetRoamingRestriction();
friend void to_json(nlohmann::json& j, const RestrictedSnssai& o);
friend void from_json(const nlohmann::json& j, RestrictedSnssai& o);
protected:
PlmnId m_HomePlmnId;
std::vector<ExtSnssai> m_SNssaiList;
std::vector<PlmnId> m_HomePlmnIdList;
bool m_HomePlmnIdListIsSet;
bool m_RoamingRestriction;
bool m_RoamingRestrictionIsSet;
};
} // namespace model
} // namespace nssf_server
} // namespace oai
#endif /* RestrictedSnssai_H_ */
| 25.35514 | 80 | 0.690748 | [
"vector",
"model"
] |
5031cc1166608c6d2cc2bf38ac1674d0aadb7852 | 4,133 | h | C | dali/kernels/imgproc/flip_cpu.h | cyyever/DALI | e2b2d5a061da605e3e9e681017a7b2d53fe41a62 | [
"ECL-2.0",
"Apache-2.0"
] | 3,967 | 2018-06-19T04:39:09.000Z | 2022-03-31T10:57:53.000Z | dali/kernels/imgproc/flip_cpu.h | cyyever/DALI | e2b2d5a061da605e3e9e681017a7b2d53fe41a62 | [
"ECL-2.0",
"Apache-2.0"
] | 3,494 | 2018-06-21T07:09:58.000Z | 2022-03-31T19:44:51.000Z | dali/kernels/imgproc/flip_cpu.h | cyyever/DALI | e2b2d5a061da605e3e9e681017a7b2d53fe41a62 | [
"ECL-2.0",
"Apache-2.0"
] | 531 | 2018-06-19T23:53:10.000Z | 2022-03-30T08:35:59.000Z | // Copyright (c) 2019, NVIDIA 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 DALI_KERNELS_IMGPROC_FLIP_CPU_H_
#define DALI_KERNELS_IMGPROC_FLIP_CPU_H_
#include "dali/util/ocv.h"
#include "dali/core/common.h"
#include "dali/core/error_handling.h"
#include "dali/kernels/kernel.h"
namespace dali {
namespace kernels {
constexpr int sample_ndim = 5;
namespace detail {
namespace cpu {
template <typename Type>
inline int GetOcvType(size_t channels) {
if (channels * sizeof(Type) > CV_CN_MAX) {
DALI_FAIL("Pixel size must not be greater than " + std::to_string(CV_CN_MAX) + " bytes.");
}
return CV_MAKE_TYPE(cv::DataType<Type>::type, channels);
}
template <typename Type>
void OcvFlip(Type *output, const Type *input,
size_t depth, size_t height, size_t width, size_t channels,
bool flip_z, bool flip_y, bool flip_x) {
assert(flip_x || flip_y);
int flip_flag = -1;
if (!flip_y)
flip_flag = 1;
else if (!flip_x)
flip_flag = 0;
// coerce data to uint8_t - flip won't look at the type anyway
auto ocv_type = GetOcvType<uint8_t>(channels * sizeof(Type));
size_t plane_size = height * width * channels;
for (size_t plane = 0; plane < depth; ++plane) {
auto output_plane = flip_z ? depth - plane - 1 : plane;
auto input_mat = CreateMatFromPtr(height, width, ocv_type, input + plane * plane_size);
auto output_mat = CreateMatFromPtr(height, width, ocv_type,
output + output_plane * plane_size);
cv::flip(input_mat, output_mat, flip_flag);
}
}
template <typename Type>
void FlipZAxis(Type *output, const Type *input, size_t depth, size_t height, size_t width,
size_t channels, bool flip_z) {
if (!flip_z) {
std::copy(input, input + depth * height * width * channels, output);
return;
}
size_t plane_size = height * width * channels;
for (size_t plane = 0; plane < depth; ++plane) {
auto out_plane = depth - plane - 1;
std::copy(input + plane * plane_size, input + (plane + 1) * plane_size,
output + out_plane * plane_size);
}
}
template <typename Type>
void FlipImpl(Type *output, const Type *input,
TensorShape<sample_ndim> shape, bool flip_z, bool flip_y, bool flip_x) {
auto frame_size = volume(&shape[1], &shape[sample_ndim]);
if (flip_x || flip_y) {
for (Index f = 0; f < shape[0]; ++f) {
OcvFlip(output, input, shape[1], shape[2], shape[3], shape[4], flip_z, flip_y, flip_x);
output += frame_size;
input += frame_size;
}
} else {
for (Index f = 0; f < shape[0]; ++f) {
FlipZAxis(output, input, shape[1], shape[2], shape[3], shape[4], flip_z);
output += frame_size;
input += frame_size;
}
}
}
} // namespace cpu
} // namespace detail
template <typename Type>
class DLL_PUBLIC FlipCPU {
public:
DLL_PUBLIC FlipCPU() = default;
DLL_PUBLIC KernelRequirements Setup(KernelContext &context,
const InTensorCPU<Type, sample_ndim> &in) {
KernelRequirements req;
req.output_shapes = {TensorListShape<DynamicDimensions>({in.shape})};
return req;
}
DLL_PUBLIC void Run(KernelContext &Context, OutTensorCPU<Type, sample_ndim> &out,
const InTensorCPU<Type, sample_ndim> &in, bool flip_z, bool flip_y, bool flip_x) {
auto in_data = in.data;
auto out_data = out.data;
detail::cpu::FlipImpl(out_data, in_data, in.shape, flip_z, flip_y, flip_x);
}
};
} // namespace kernels
} // namespace dali
#endif // DALI_KERNELS_IMGPROC_FLIP_CPU_H_
| 33.601626 | 94 | 0.668522 | [
"shape"
] |
504088044ce348b4dea85c107d18868a3db86ca4 | 3,898 | h | C | fbpcf/scheduler/gate_keeper/GateKeeper.h | wenhaizhu/fbpcf | b0cc078d548a40370dcdde15466e701f12117b11 | [
"MIT"
] | 1 | 2022-03-13T21:30:03.000Z | 2022-03-13T21:30:03.000Z | fbpcf/scheduler/gate_keeper/GateKeeper.h | wenhaizhu/fbpcf | b0cc078d548a40370dcdde15466e701f12117b11 | [
"MIT"
] | null | null | null | fbpcf/scheduler/gate_keeper/GateKeeper.h | wenhaizhu/fbpcf | b0cc078d548a40370dcdde15466e701f12117b11 | [
"MIT"
] | null | null | null | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <deque>
#include <memory>
#include "fbpcf/scheduler/gate_keeper/IGateKeeper.h"
namespace fbpcf::scheduler {
class GateKeeper : public IGateKeeper {
public:
explicit GateKeeper(std::shared_ptr<IWireKeeper> wireKeeper);
/**
* @inherit doc
*/
IScheduler::WireId<IScheduler::Boolean> inputGate(
BoolType<false> initialValue) override;
/**
* @inherit doc
*/
IScheduler::WireId<IScheduler::Boolean> inputGateBatch(
BoolType<true> initialValue) override;
/**
* @inherit doc
*/
IScheduler::WireId<IScheduler::Boolean> outputGate(
IScheduler::WireId<IScheduler::Boolean> src,
int partyID) override;
/**
* @inherit doc
*/
IScheduler::WireId<IScheduler::Boolean> outputGateBatch(
IScheduler::WireId<IScheduler::Boolean> src,
int partyID) override;
/**
* @inherit doc
*/
IScheduler::WireId<IScheduler::Boolean> normalGate(
INormalGate<IScheduler::Boolean>::GateType gateType,
IScheduler::WireId<IScheduler::Boolean> left,
IScheduler::WireId<IScheduler::Boolean> right =
IScheduler::WireId<IScheduler::Boolean>()) override;
/**
* @inherit doc
*/
IScheduler::WireId<IScheduler::Boolean> normalGateBatch(
INormalGate<IScheduler::Boolean>::GateType gateType,
IScheduler::WireId<IScheduler::Boolean> left,
IScheduler::WireId<IScheduler::Boolean> right =
IScheduler::WireId<IScheduler::Boolean>()) override;
/**
* @inherit doc
*/
std::vector<IScheduler::WireId<IScheduler::Boolean>> compositeGate(
ICompositeGate::GateType gateType,
IScheduler::WireId<IScheduler::Boolean> left,
std::vector<IScheduler::WireId<IScheduler::Boolean>> rights) override;
/**
* @inherit doc
*/
std::vector<IScheduler::WireId<IScheduler::Boolean>> compositeGateBatch(
ICompositeGate::GateType gateType,
IScheduler::WireId<IScheduler::Boolean> left,
std::vector<IScheduler::WireId<IScheduler::Boolean>> rights) override;
/**
* @inherit doc
*/
uint32_t getFirstUnexecutedLevel() const override;
/**
* @inherit doc
*/
std::vector<std::unique_ptr<IGate>> popFirstUnexecutedLevel() override;
/**
* @inherit doc
*/
bool hasReachedBatchingLimit() const override;
private:
template <bool isCompositeWire>
using GateClass = typename std::conditional<
isCompositeWire,
ICompositeGate,
INormalGate<IScheduler::Boolean>>::type;
template <bool isCompositeWire>
using GateType = typename std::conditional<
isCompositeWire,
ICompositeGate::GateType,
INormalGate<IScheduler::Boolean>::GateType>::type;
template <bool isCompositeWire>
using RightWireType = typename std::conditional<
isCompositeWire,
std::vector<IScheduler::WireId<IScheduler::Boolean>>,
IScheduler::WireId<IScheduler::Boolean>>::type;
template <bool usingBatch, bool isCompositeWire>
RightWireType<isCompositeWire> addGate(
GateType<isCompositeWire> gateType,
IScheduler::WireId<IScheduler::Boolean> left,
RightWireType<isCompositeWire> right,
BoolType<usingBatch> initialValue,
int partyID = 0);
template <bool usingBatch, bool isCompositeWire>
uint32_t getFirstAvailableLevelForNewWire(
GateType<isCompositeWire> gateType,
IScheduler::WireId<IScheduler::Boolean> left,
RightWireType<isCompositeWire> right) const;
std::deque<std::vector<std::unique_ptr<IGate>>> gatesByLevelOffset_;
std::shared_ptr<IWireKeeper> wireKeeper_;
uint32_t firstUnexecutedLevel_ = 0;
uint32_t numUnexecutedGates_ = 0;
const uint32_t kMaxUnexecutedGates = 100000;
};
} // namespace fbpcf::scheduler
| 28.043165 | 76 | 0.705233 | [
"vector"
] |
50423c49f84ac996a5835ea30b57cd9410ba40ae | 11,320 | c | C | btgecl/base/clui_widget.c | cr88192/bgbtech_engine | 03869a92fbf3197dd176d311f3b917f4f4e88d1a | [
"MIT"
] | 1 | 2019-07-02T22:53:52.000Z | 2019-07-02T22:53:52.000Z | btgecl/base/clui_widget.c | cr88192/bgbtech_engine | 03869a92fbf3197dd176d311f3b917f4f4e88d1a | [
"MIT"
] | 5 | 2015-11-17T05:45:50.000Z | 2015-11-26T18:36:51.000Z | btgecl/base/clui_widget.c | cr88192/bgbtech_engine | 03869a92fbf3197dd176d311f3b917f4f4e88d1a | [
"MIT"
] | null | null | null | #include <btgecl.h>
BTCLUI_Event *BTCLUI_Widget_AddEvent(BTCLUI_Widget *obj, char *event)
{
BTCLUI_Event *tmp;
// char *s;
// s=obj->id;
// if(obj->name)s=obj->name;
tmp=BTCLUI_Forms_AddEvent(obj->form, obj, event);
// btgeclui_context->widget_lastevent=tmp;
return(tmp);
}
//void BTCLUI_Widget_SetEventIVal(int val)
//{
// btgeclui_context->widget_lastevent->ival=val;
//}
//void BTCLUI_Widget_SetEventSVal(char *val)
//{
// btgeclui_context->widget_lastevent->sval=dystrdup(val);
//}
int BTCLUI_Widget_BindForm(BTCLUI_Widget *obj, BTCLUI_Form *form)
{
BTCLUI_Widget *cur;
obj->form=form;
cur=obj->wchild;
while(cur)
{
BTCLUI_Widget_BindForm(cur, form);
cur=cur->wnext;
}
return(0);
}
int BTCLUI_Widget_HandleInput(BTCLUI_Widget *obj,
BTCLUI_InputState *state, int ox, int oy)
{
int i;
if(obj->vt && obj->vt->HandleInput)
{
i=obj->vt->HandleInput(obj, state, ox, oy);
return(i);
}
return(-1);
}
int BTCLUI_Widget_Render(BTCLUI_Widget *obj, int ox, int oy)
{
int i;
if(obj->vt && obj->vt->Render)
{
i=obj->vt->Render(obj, ox, oy);
return(i);
}
return(-1);
}
int BTCLUI_Widget_SizeWidget(BTCLUI_Widget *obj)
{
int i;
if(obj->vt && obj->vt->Size)
{
i=obj->vt->Size(obj);
return(i);
}
return(-1);
}
int BTCLUI_Widget_CheckFocus(int ox, int oy,
BTCLUI_InputState *state, BTCLUI_Widget *obj)
{
if( (state->mx>=(obj->ox+ox)) &&
(state->my>=(obj->oy+oy)) &&
(state->mx<=(obj->ox+ox+obj->xs)) &&
(state->my<=(obj->oy+oy+obj->ys)))
return(1);
if( (state->lmx>=(obj->ox+ox)) &&
(state->lmy>=(obj->oy+oy)) &&
(state->lmx<=(obj->ox+ox+obj->xs)) &&
(state->lmy<=(obj->oy+oy+obj->ys)))
return(1);
if(obj->flags&3)return(1);
return(0);
}
int BTCLUI_Widget_CheckClick(int ox, int oy,
BTCLUI_InputState *state, BTCLUI_Widget *obj)
{
if( (state->mx>=(obj->ox+ox)) &&
(state->my>=(obj->oy+oy)) &&
(state->mx<=(obj->ox+ox+obj->xs)) &&
(state->my<=(obj->oy+oy+obj->ys)) &&
(state->mb&1))
return(1);
return(0);
}
int BTCLUI_Widget_CheckClicked(int ox, int oy,
BTCLUI_InputState *state, BTCLUI_Widget *obj)
{
if( (state->mx>=(obj->ox+ox)) &&
(state->my>=(obj->oy+oy)) &&
(state->mx<=(obj->ox+ox+obj->xs)) &&
(state->my<=(obj->oy+oy+obj->ys)) &&
(state->mb&1) && !(state->lmb&1))
return(1);
return(0);
}
int BTCLUI_Widget_CheckClickedBox(int ox, int oy, int xs, int ys,
BTCLUI_InputState *state)
{
if( (state->mx>=ox) && (state->my>=oy) &&
(state->mx<=(ox+xs)) && (state->my<=(oy+ys)) &&
(state->mb&1) && !(state->lmb&1))
return(1);
return(0);
}
int BTCLUI_Widget_CheckDragBox(int ox, int oy, int xs, int ys,
BTCLUI_InputState *state)
{
if( (state->lmx>=ox) && (state->lmy>=oy) &&
(state->lmx<=(ox+xs)) && (state->lmy<=(oy+ys)) &&
(state->mb&1) && (state->lmb&1))
return(1);
return(0);
}
int BTCLUI_Widget_CheckMClick(int ox, int oy,
BTCLUI_InputState *state, BTCLUI_Widget *obj)
{
if( (state->mx>=(obj->ox+ox)) &&
(state->my>=(obj->oy+oy)) &&
(state->mx<=(obj->ox+ox+obj->xs)) &&
(state->my<=(obj->oy+oy+obj->ys)) &&
(state->mb&2))
return(1);
return(0);
}
int BTCLUI_Widget_CheckMClicked(int ox, int oy,
BTCLUI_InputState *state, BTCLUI_Widget *obj)
{
if( (state->mx>=(obj->ox+ox)) &&
(state->my>=(obj->oy+oy)) &&
(state->mx<=(obj->ox+ox+obj->xs)) &&
(state->my<=(obj->oy+oy+obj->ys)) &&
(state->mb&2) && !(state->lmb&2))
return(1);
return(0);
}
int BTCLUI_Widget_CheckMClickedBox(int ox, int oy, int xs, int ys,
BTCLUI_InputState *state)
{
if( (state->mx>=ox) && (state->my>=oy) &&
(state->mx<=(ox+xs)) && (state->my<=(oy+ys)) &&
(state->mb&2) && !(state->lmb&2))
return(1);
return(0);
}
int BTCLUI_Widget_CheckMDragBox(int ox, int oy, int xs, int ys,
BTCLUI_InputState *state)
{
if( (state->lmx>=ox) && (state->lmy>=oy) &&
(state->lmx<=(ox+xs)) && (state->lmy<=(oy+ys)) &&
(state->mb&2) && (state->lmb&2))
return(1);
return(0);
}
int BTCLUI_Widget_CheckRClick(int ox, int oy,
BTCLUI_InputState *state, BTCLUI_Widget *obj)
{
if( (state->mx>=(obj->ox+ox)) &&
(state->my>=(obj->oy+oy)) &&
(state->mx<=(obj->ox+ox+obj->xs)) &&
(state->my<=(obj->oy+oy+obj->ys)) &&
(state->mb&4))
return(1);
return(0);
}
int BTCLUI_Widget_CheckRClicked(int ox, int oy,
BTCLUI_InputState *state, BTCLUI_Widget *obj)
{
if( (state->mx>=(obj->ox+ox)) &&
(state->my>=(obj->oy+oy)) &&
(state->mx<=(obj->ox+ox+obj->xs)) &&
(state->my<=(obj->oy+oy+obj->ys)) &&
(state->mb&4) && !(state->lmb&4))
return(1);
return(0);
}
int BTCLUI_Widget_CheckRClickedBox(int ox, int oy, int xs, int ys,
BTCLUI_InputState *state)
{
if( (state->mx>=ox) && (state->my>=oy) &&
(state->mx<=(ox+xs)) && (state->my<=(oy+ys)) &&
(state->mb&4) && !(state->lmb&4))
return(1);
return(0);
}
int BTCLUI_Widget_CheckRDragBox(int ox, int oy, int xs, int ys,
BTCLUI_InputState *state)
{
if( (state->lmx>=ox) && (state->lmy>=oy) &&
(state->lmx<=(ox+xs)) && (state->lmy<=(oy+ys)) &&
(state->mb&4) && (state->lmb&4))
return(1);
return(0);
}
int BTCLUI_Widget_CheckHKey(BTCLUI_InputState *state, int key)
{
ushort *ks;
int ki;
if((key>='A') && (key<='Z'))key=key-'A'+'a';
if(!BTCLUI_KeyDown(state, K_ALT))return(0);
ks=state->keys;
while(*ks)
{
ki=*ks++;
if((ki>='A') && (ki<='Z'))ki=ki-'A'+'a';
if(ki==key)return(1);
}
return(0);
}
int BTCLUI_Widget_CheckHKeyString(BTCLUI_InputState *state, char *str)
{
char *s;
int i;
if(!BTCLUI_KeyDown(state, K_ALT))return(0);
s=str;
while(*s)
{
if((s[0]=='&') && (s[1]!='&'))
{
i=BTCLUI_Widget_CheckHKey(state, s[1]);
if(i)return(i);
s+=2;
continue;
}
s++;
}
return(0);
}
BTCLUI_Widget *BTCLUI_Widget_FindName(BTCLUI_Widget *parent, char *name)
{
BTCLUI_Widget *first, *last, *cur, *tmp;
first=NULL;
last=NULL;
cur=parent->wchild;
while(cur)
{
if(cur->name)
if(!strcmp(cur->name, name))
{
if(last)
{
last->chain=cur;
last=cur;
}else
{
first=cur;
last=cur;
}
}
tmp=BTCLUI_Widget_FindName(cur, name);
if(tmp)
{
if(last)
{
last->chain=tmp;
last=tmp;
}else
{
first=tmp;
last=tmp;
}
while(last->chain)last=last->chain;
}
cur=cur->wnext;
}
return(first);
}
BTCLUI_Widget *BTCLUI_Widget_LookupID(BTCLUI_Widget *parent, char *name)
{
BTCLUI_Widget *cur, *tmp;
if(parent->id)if(!strcmp(parent->id, name))
return(parent);
cur=parent->wchild;
while(cur)
{
if(cur->id)if(!strcmp(cur->id, name))
return(cur);
tmp=BTCLUI_Widget_LookupID(cur, name);
if(tmp)return(tmp);
cur=cur->wnext;
}
return(NULL);
}
BTCL_API int BTCLUI_Forms_RenderColor(int c, int a)
{
float r, g, b;
r=((c>>16)&0xff)/255.0;
g=((c>>8)&0xff)/255.0;
b=(c&0xff)/255.0;
pdglColor4f(r, g, b, a/255.0);
return(0);
}
BTCL_API int BTCLUI_Forms_RenderDarkColor(int c, int a)
{
float r, g, b;
r=((c>>16)&0xff)/255.0;
g=((c>>8)&0xff)/255.0;
b=(c&0xff)/255.0;
r*=2.0/3.0;
g*=2.0/3.0;
b*=2.0/3.0;
pdglColor4f(r, g, b, a/255.0);
return(0);
}
BTCL_API int BTCLUI_Forms_RenderLightColor(int c, int a)
{
float r, g, b;
r=((c>>16)&0xff)/255.0;
g=((c>>8)&0xff)/255.0;
b=(c&0xff)/255.0;
r*=4.0/3.0;
g*=4.0/3.0;
b*=4.0/3.0;
pdglColor4f(r, g, b, a/255.0);
return(0);
}
BTCL_API int BTCLUI_Forms_CalcColor(int c, int *rr, int *gr, int *br)
{
*rr=((c>>16)&0xff);
*gr=((c>>8)&0xff);
*br=(c&0xff);
return(0);
}
BTCL_API int BTCLUI_Forms_CalcDarkColor(int c, int *rr, int *gr, int *br)
{
*rr=((c>>16)&0xff)-64;
*gr=((c>>8)&0xff)-64;
*br=(c&0xff)-64;
if(*rr<0)*rr=0;
if(*gr<0)*gr=0;
if(*br<0)*br=0;
return(0);
}
BTCL_API int BTCLUI_Forms_CalcLightColor(int c, int *rr, int *gr, int *br)
{
*rr=((c>>16)&0xff);
*gr=((c>>8)&0xff);
*br=(c&0xff);
if(*rr>255)*rr=255;
if(*gr>255)*gr=255;
if(*br>255)*br=255;
return(0);
}
int BTCLUI_Widget_Render3DBorder(int ox, int oy, int xs, int ys,
int wbgcolor, int ind)
{
int i;
pdglDisable(GL_TEXTURE_2D);
pdglBegin(PDGL_LINES);
if(ind)BTCLUI_Forms_RenderDarkColor(wbgcolor, 255);
else BTCLUI_Forms_RenderLightColor(wbgcolor, 255);
for(i=0; i<2; i++)
{
pdglVertex2f(ox+i, oy+i);
pdglVertex2f(ox+i, oy+ys-i);
pdglVertex2f(ox+i, oy+ys-i);
pdglVertex2f(ox+xs-i, oy+ys-i);
}
if(ind)BTCLUI_Forms_RenderLightColor(wbgcolor, 255);
else BTCLUI_Forms_RenderDarkColor(wbgcolor, 255);
for(i=0; i<2; i++)
{
pdglVertex2f(ox+i, oy+i);
pdglVertex2f(ox+xs-i, oy+i);
pdglVertex2f(ox+xs-i, oy+i);
pdglVertex2f(ox+xs-i, oy+ys-i);
}
pdglEnd();
return(0);
}
int BTCLUI_Widget_Render3DBox(int ox, int oy, int xs, int ys,
int wbgcolor, int ind)
{
pdglDisable(GL_TEXTURE_2D);
BTCLUI_Forms_RenderColor(wbgcolor, 255);
pdglBegin(PDGL_QUADS);
pdglVertex2f(ox, oy);
pdglVertex2f(ox+xs, oy);
pdglVertex2f(ox+xs, oy+ys);
pdglVertex2f(ox, oy+ys);
pdglEnd();
BTCLUI_Widget_Render3DBorder(ox, oy, xs, ys, wbgcolor, ind);
return(0);
}
int BTCLUI_Widget_RenderLight3DBorder(int ox, int oy, int xs, int ys,
int wbgcolor, int ind)
{
int i;
pdglDisable(GL_TEXTURE_2D);
pdglBegin(PDGL_LINES);
if(ind)BTCLUI_Forms_RenderDarkColor(wbgcolor, 255);
else BTCLUI_Forms_RenderLightColor(wbgcolor, 255);
pdglVertex2f(ox, oy);
pdglVertex2f(ox, oy+ys);
pdglVertex2f(ox, oy+ys);
pdglVertex2f(ox+xs, oy+ys);
if(ind)BTCLUI_Forms_RenderLightColor(wbgcolor, 255);
else BTCLUI_Forms_RenderDarkColor(wbgcolor, 255);
pdglVertex2f(ox, oy);
pdglVertex2f(ox+xs, oy);
pdglVertex2f(ox+xs, oy);
pdglVertex2f(ox+xs, oy+ys);
pdglEnd();
return(0);
}
int BTCLUI_Widget_RenderContent(int ox, int oy, int xs, int ys,
dyxNode *body, int fgc)
{
dyxNode *cur;
int xp, yp, lh;
int r, g, b;
xp=ox;
yp=oy+ys;
lh=12;
cur=body;
while(cur)
{
if(!dyxTextP(cur))
{
GfxFont_SetFont("fixed", 0);
BTCLUI_Forms_CalcColor(fgc, &r, &g, &b);
GfxFont_DrawString(dyxText(cur), xp, yp-12,
8, 12, r, g, b, 255);
xp+=8*strlen(dyxText(cur));
cur=dyxNext(cur);
continue;
}
if(!dyxTagIsP(cur, "br"))
{
yp-=lh;
xp=ox;
lh=12;
}
cur=dyxNext(cur);
}
return(0);
}
int BTCLUI_Widget_RSizeWidget(BTCLUI_Widget *obj)
{
BTCLUI_Widget *cur;
cur=obj;
while(cur)
{
BTCLUI_Widget_SizeWidget(cur);
cur=cur->wparent;
}
return(0);
}
int BTCLUI_Widget_SizeContent(dyxNode *body, int *xs, int *ys)
{
dyxNode *cur;
int xp, yp, lh;
xp=0;
yp=0;
lh=12;
cur=body;
while(cur)
{
if(!dyxTextP(cur))
{
xp+=8*strlen(dyxText(cur));
if(xp>*xs)*xs=xp;
if(yp>*ys)*ys=yp;
cur=dyxNext(cur);
continue;
}
if(!dyxTagIsP(cur, "br"))
{
yp+=lh;
xp=0;
lh=12;
}
if(xp>*xs)*xs=xp;
if(yp>*ys)*ys=yp;
cur=dyxNext(cur);
}
return(0);
}
int BTCLUI_Widget_SizeText(char *str, int *xs, int *ys)
{
char *s;
int xp, yp;
xp=0;
yp=0;
s=str;
while(*s)
{
if((*s>=' ') && (*s<='~'))
{
xp+=8;
if(xp>*xs)*xs=xp;
if(yp>*ys)*ys=yp;
s++;
continue;
}
if(*s=='\n')
{
yp+=8;
xp=0;
if(xp>*xs)*xs=xp;
if(yp>*ys)*ys=yp;
s++;
continue;
}
if(*s=='\t')
{
xp=(xp+64)&(~63);
if(xp>*xs)*xs=xp;
if(yp>*ys)*ys=yp;
s++;
continue;
}
s++;
}
return(0);
}
int BTCLUI_Widget_Init()
{
BTCLUI_WidgetInput_Init();
BTCLUI_WidgetBox_Init();
BTCLUI_WidgetUnion_Init();
BTCLUI_WidgetLabel_Init();
BTCLUI_WidgetScroll_Init();
BTCLUI_WidgetList_Init();
BTCLUI_WidgetTree_Init();
BTCLUI_TextArea_Init();
return(0);
}
| 18.025478 | 74 | 0.611396 | [
"render"
] |
504b6ecb043186a2016c9086d7b0155eedfba986 | 8,529 | h | C | src/vm/frame.h | dartino/fletch | aa7aba8473f405dd49b9c81b0faeeebfa6e94fc8 | [
"BSD-3-Clause"
] | 144 | 2016-01-29T00:14:04.000Z | 2021-02-20T09:36:11.000Z | src/vm/frame.h | akashfoss/sdk | aa7aba8473f405dd49b9c81b0faeeebfa6e94fc8 | [
"BSD-3-Clause"
] | 241 | 2016-01-27T15:37:56.000Z | 2016-09-09T07:34:07.000Z | src/vm/frame.h | akashfoss/sdk | aa7aba8473f405dd49b9c81b0faeeebfa6e94fc8 | [
"BSD-3-Clause"
] | 30 | 2016-02-23T18:14:54.000Z | 2020-10-18T13:49:34.000Z | // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE.md file.
#ifndef SRC_VM_FRAME_H_
#define SRC_VM_FRAME_H_
#include "src/shared/globals.h"
#include "src/vm/object.h"
#include "src/vm/process.h"
namespace dartino {
// General stack layout:
//
// Growing down:
//
// | |
// | Frame pointer |<--+
// | | |
// +----------------+ |
// | | |
// | | |
// +----------------+ |
// | . | |
// | . | |
// | . | |
// | Arguments | |
// +----------------+ |
// | Return address | |
// | Frame pointer +---+ <--- FramePointer()
// | BCP |
// +----------------+
// | . |
// | . |
// | . |
// | Locals |
// +----------------+
// | |
//
// A frame is used to navigate a stack, frame by frame.
//
// The return-address slot is usually empty, and is only set, if the stack is
// set up for a restore-state.
//
// Note that the BCP is not always present. In particular, saving the state only
// stores the resume address of the interpreter:
//
// Before `saveState`: `after saveState`:
//
// | Arguments | | | Arguments | |
// +----------------+ | +----------------+ |
// | Return address | | | Return address | |
// | Frame pointer +---+ <-- FramePointer() | Frame pointer +<--+
// | BCP | | BCP | |
// +----------------+ +----------------+ |
// | . | | . | |
// | . | | . | |
// | Locals | <-- stack->top() | Locals | |
// +----------------+ +----------------+ |
// | | | Resume address | |
// stack->top()--> | Frame pointer +---+
// FramePointer()
//
// Note: `stack->top()` points to the index of the slot, whereas
// `FramePointer()` points to the address of the stack.
//
// After `saveState()`, `stack->top()` and `FramePointer()` point to the same
// slot. The return-address slot, is used as resume-address, where the
// interpreter should continue when restoring the state.
//
// Note: a `saveState()` also updates the BCP slot of the current frame.
class Frame {
public:
explicit Frame(Stack* stack)
: stack_(stack),
frame_pointer_(stack->Pointer(stack->top())),
size_(-1) {}
// Creates the initial frames for a fresh stack.
//
// Adds three frames: a sentinel frame, and a frame supporting
// [number_of_arguments] arguments, which are the arguments to the Dart
// function at [bcp], and the save-state frame.
//
// The initial sentinel frame that is initialized to all `NULL`.
//
// The second frame is an empty (valid) frame, set up for execution of the
// the Dart function at [bcp].
//
// The third frame is the save-state frame, which is setup so that a
// `restoreState()` can continue (or start) the Dart function at [bcp].
//
// When this function returns, the stack top is set to the frame pointer of
// the third frame.
void PushInitialDartEntryFrames(int number_of_arguments, uint8_t* bcp,
void* start_address) {
ASSERT(stack_->top() == 0);
PushSentinelFrame();
int number_of_locals = 0;
PushFrame(number_of_arguments, number_of_locals);
PushSafePoint(bcp, start_address);
}
// Installs a sentinel frame.
//
// The return-address, the previous-framepointer and the bcp-slot are set to
// 0.
//
// Updates the frame pointer, and the stack's top. The top includes space for
// the bcp..
void PushSentinelFrame() {
word top = stack_->length();
// Return-address.
stack_->set(--top, NULL);
// Push previous frame-pointer, and update the frame-pointer field.
stack_->set(--top, NULL);
frame_pointer_ = stack_->Pointer(top);
// Push BCP.
stack_->set(--top, NULL);
stack_->set_top(top);
}
// Pushes a new frame onto the stack.
//
// Initializes [number_of_arguments] arguments and [number_of_locals] locals
// to 0.
//
// The return address and bcp of the new frame are initialized to 0.
//
// Updates the frame pointer and the stack's top.
void PushFrame(int number_of_arguments, int number_of_locals) {
word top = stack_->top();
// Push the arguments.
for (int i = 0; i < number_of_arguments; i++) {
stack_->set(--top, reinterpret_cast<Object*>(Smi::zero()));
}
// Push the return-address.
stack_->set(--top, NULL);
// Push the previous frame pointer and update the frame-pointer field.
stack_->set(--top, reinterpret_cast<Object*>(FramePointer()));
frame_pointer_ = stack_->Pointer(top);
// Push NULL as bcp.
stack_->set(--top, NULL);
// Push the locals.
for (int i = 0; i < number_of_locals; i++) {
stack_->set(--top, reinterpret_cast<Object*>(Smi::zero()));
}
stack_->set_top(top);
}
// Prepares the current stack for a restore-state action.
//
// Updates the current frame with the given [bcp], pushes a new frame, and
// stores the [resume_address] as return-address of the new frame.
//
// A restore-state will execute the resume_address, continuing at the given
// bcp.
//
// See `interpreter_X.cc` for `restoreState`.
void PushSafePoint(uint8_t* bcp, void* resume_address) {
ASSERT(stack_->top() != 0);
SetByteCodePointer(bcp);
// Don't use [PushFrame], because we don't need to push the bcp slot.
word top = stack_->top();
stack_->set(--top, reinterpret_cast<Object*>(resume_address));
stack_->set(--top, reinterpret_cast<Object*>(FramePointer()));
frame_pointer_ = stack_->Pointer(top);
stack_->set_top(top);
}
bool MovePrevious() {
Object** current_frame_pointer = frame_pointer_;
frame_pointer_ = PreviousFramePointer();
if (frame_pointer_ == NULL) return false;
size_ = frame_pointer_ - current_frame_pointer;
return true;
}
Object** FramePointer() const { return frame_pointer_; }
uint8* ByteCodePointer() const {
return reinterpret_cast<uint8*>(*(frame_pointer_ - 1));
}
void SetByteCodePointer(uint8* return_address) {
*(frame_pointer_ - 1) = reinterpret_cast<Object*>(return_address);
}
Object** PreviousFramePointer() const {
return reinterpret_cast<Object**>(*frame_pointer_);
}
void* ReturnAddress() const {
return reinterpret_cast<void*>(*(frame_pointer_ + 1));
}
void SetReturnAddress(void* address) {
*(frame_pointer_ + 1) = reinterpret_cast<Object*>(address);
}
// Find the function of the bcp, by searching through the bytecodes
// for the MethodEnd bytecode. This operation is linear to the size of the
// bytecode; O(n).
//
// Returns `NULL` if the bcp is `NULL`.
Function* FunctionFromByteCodePointer(
int* frame_ranges_offset_result = NULL) const {
uint8* bcp = ByteCodePointer();
if (bcp == NULL) return NULL;
return Function::FromBytecodePointer(bcp, frame_ranges_offset_result);
}
word FirstLocalIndex() const {
return FirstLocalAddress() - stack_->Pointer(0);
}
word LastLocalIndex() const {
return LastLocalAddress() - stack_->Pointer(0);
}
word LastArgumentIndex() const {
return LastArgumentAddress() - stack_->Pointer(0);
}
// Returns the address of the first local.
//
// The first slot after the frame pointer is reserved for the BCP. Therefore,
// the first local is at an offset of two.
Object** FirstLocalAddress() const { return FramePointer() - 2; }
Object** LastLocalAddress() const { return FramePointer() - size_ + 2; }
Object** NextFramePointer() const { return FramePointer() - size_; }
// Returns the address of the last argument.
//
// The first slot before the frame pointer is reserved for the return address.
// Therefore, the last argument is at an offset of two.
Object** LastArgumentAddress() const { return FramePointer() + 2; }
private:
Stack* stack_;
Object** frame_pointer_;
word size_;
};
} // namespace dartino
#endif // SRC_VM_FRAME_H_
| 33.447059 | 80 | 0.584945 | [
"object"
] |
504c3a330b39267a17d77bc5f40d9edc68ee83ed | 2,082 | h | C | Engine/Source/ThirdParty/HairWorks/Nv/Common/NvCoCommon.h | windystrife/UnrealEngine_NVIDIAGameWork | b50e6338a7c5b26374d66306ebc7807541ff815e | [
"MIT"
] | 1 | 2022-01-29T18:36:12.000Z | 2022-01-29T18:36:12.000Z | Engine/Source/ThirdParty/HairWorks/Nv/Common/NvCoCommon.h | windystrife/UnrealEngine_NVIDIAGameWork | b50e6338a7c5b26374d66306ebc7807541ff815e | [
"MIT"
] | null | null | null | Engine/Source/ThirdParty/HairWorks/Nv/Common/NvCoCommon.h | windystrife/UnrealEngine_NVIDIAGameWork | b50e6338a7c5b26374d66306ebc7807541ff815e | [
"MIT"
] | null | null | null | /* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited. */
#ifndef NV_CO_COMMON_H
#define NV_CO_COMMON_H
// check that exactly one of NDEBUG and _DEBUG is defined
#if !defined(NDEBUG) ^ defined(_DEBUG)
# error Exactly one of NDEBUG and _DEBUG needs to be defined!
#endif
#ifndef NV_DEBUG
# ifdef NDEBUG
# define NV_DEBUG 0
# else
# define NV_DEBUG 1
# endif
#endif // NV_DEBUG
// make sure NV_CHECKED is defined in all _DEBUG configurations as well
#if !defined(NV_CHECKED) && defined _DEBUG
# define NV_CHECKED 1
#endif
#include <Nv/Core/1.0/NvDefines.h>
#include <Nv/Core/1.0/NvTypes.h>
#include <Nv/Core/1.0/NvAssert.h>
#include <Nv/Core/1.0/NvResult.h>
/** \defgroup common Common Support Library
@{
*/
namespace nvidia {
namespace Common {
/*! \namespace nvidia::Common
\brief The Common Support Libraries namespace
\details The Common Support Library provides containers, smart pointers, a simple object model, and other
algorithms generally useful in development. It also contains functionality specifically for different
platforms in the Nv/Common/Platform folder.
The types, and functions of the Common Support Library can be accessed via the fully qualified namespace
of nvidia::Common, but it often easier and more readable to use the shortened namespace alias NvCo.
*/
// Op namespace is for simple/small global operations. Namespace is used to make distinct from common method names.
namespace Op {
/// Swap two items through a temporary.
template<class T>
NV_CUDA_CALLABLE NV_FORCE_INLINE Void swap(T& x, T& y)
{
const T tmp = x;
x = y;
y = tmp;
}
} // namespace Op
} // namespace Common
} // namespace nvidia
namespace NvCo = nvidia::Common;
/** @} */
#endif // NV_CO_COMMON_H
| 29.742857 | 115 | 0.764169 | [
"object",
"model"
] |
505287f1c48bdf20e0fe7fbb71bada30579b5168 | 871 | h | C | JaraffeEngine_ComponentSystem/Jaraffe/Engine/Source/Core/Object/Component/MeshRenderer.h | Jaraffe-github/Old_Engines | 0586d383af99cfcf076b18dace49e779a55b88e8 | [
"BSD-3-Clause"
] | null | null | null | JaraffeEngine_ComponentSystem/Jaraffe/Engine/Source/Core/Object/Component/MeshRenderer.h | Jaraffe-github/Old_Engines | 0586d383af99cfcf076b18dace49e779a55b88e8 | [
"BSD-3-Clause"
] | null | null | null | JaraffeEngine_ComponentSystem/Jaraffe/Engine/Source/Core/Object/Component/MeshRenderer.h | Jaraffe-github/Old_Engines | 0586d383af99cfcf076b18dace49e779a55b88e8 | [
"BSD-3-Clause"
] | null | null | null | #pragma once
namespace JF
{
namespace Component
{
class MeshRenderer : public Renderer
{
//=============================================================================
// Constructor/Destructor)
//=============================================================================
public:
MeshRenderer();
virtual ~MeshRenderer();
//=============================================================================
// Component IDENTIFIER)
//=============================================================================
public:
COMPONENT_IDENTIFIER(MeshRenderer, Renderer, false);
//=============================================================================
// override)
//=============================================================================
public:
virtual void Reset();
virtual void Update(float t);
virtual void Render();
virtual void Release();
};
}
} | 25.617647 | 79 | 0.328358 | [
"render"
] |
5066572a126e8166e073ccd1fe5eb9d1a04ffa3d | 1,292 | h | C | ShadowCast/src/testApp.h | elekezem/ProCamToolkit | 09e17bec6b79e614090720a94134b28876021bd9 | [
"MIT"
] | 163 | 2015-01-14T18:32:32.000Z | 2022-03-12T03:35:10.000Z | ShadowCast/src/testApp.h | scotty007/ProCamToolkit | 5088bd240888f5ada78641faa7244d7edce3a002 | [
"MIT"
] | 1 | 2022-03-31T09:32:37.000Z | 2022-03-31T09:32:37.000Z | ShadowCast/src/testApp.h | scotty007/ProCamToolkit | 5088bd240888f5ada78641faa7244d7edce3a002 | [
"MIT"
] | 46 | 2015-01-27T02:28:58.000Z | 2021-11-23T07:05:01.000Z | #pragma once
#include "ofMain.h"
#include "Remap.h"
#include "ofxBlur.h"
#include "ofxKinect.h"
#include "OrigScene.h"
#include "GridScene.h"
#include "LensScene.h"
#include "BallScene.h"
#include "VoroScene.h"
#include "FracScene.h"
#include "WindScene.h"
#include "BoidScene.h"
#include "WallScene.h"
#include "RectScene.h"
#include "DotsScene.h"
#include "ofxAutoControlPanel.h"
#include "ofxCv.h"
class testApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void findUserLocations();
void keyPressed(int key);
void pickNextScene();
void setFade();
void updateScene();
void drawScene();
void drawShoji();
void drawOverlay();
ofxAutoControlPanel panel;
static const int tw = 1024;
static const int th = 768;
// has to match sceneSize in remap shader
static const int sceneWidth = 1024;
static const int sceneHeight = 1024;
ofxBlur shojiBlur;
ofFbo sceneFbo;
Remap leftRemap, rightRemap;
bool showDebug, whiteScene;
vector<Scene*> scenes;
int curScene;
ofxKinect kinect;
cv::Mat kinectAccumulator, kinectAccumulator8u;
ofxCv::ContourFinder contourFinder;
ofImage filled;
vector<ofVec3f> users, usersBefore;
vector<unsigned int> userLabels;
float startFadeTime;
float presence, lastPresence;
float fadeState;
};
| 18.457143 | 48 | 0.735294 | [
"vector"
] |
506ddc3a2330817b40f3ac97c1909b564e2bcaa1 | 8,394 | h | C | aws-cpp-sdk-discovery/include/aws/discovery/model/NeighborConnectionDetail.h | curiousjgeorge/aws-sdk-cpp | 09b65deba03cfbef9a1e5d5986aa4de71bc03cd8 | [
"Apache-2.0"
] | 1 | 2020-03-11T05:36:20.000Z | 2020-03-11T05:36:20.000Z | aws-cpp-sdk-discovery/include/aws/discovery/model/NeighborConnectionDetail.h | curiousjgeorge/aws-sdk-cpp | 09b65deba03cfbef9a1e5d5986aa4de71bc03cd8 | [
"Apache-2.0"
] | null | null | null | aws-cpp-sdk-discovery/include/aws/discovery/model/NeighborConnectionDetail.h | curiousjgeorge/aws-sdk-cpp | 09b65deba03cfbef9a1e5d5986aa4de71bc03cd8 | [
"Apache-2.0"
] | null | null | null | /*
* 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/discovery/ApplicationDiscoveryService_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Json
{
class JsonValue;
class JsonView;
} // namespace Json
} // namespace Utils
namespace ApplicationDiscoveryService
{
namespace Model
{
/**
* <p>Details about neighboring servers.</p><p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/discovery-2015-11-01/NeighborConnectionDetail">AWS
* API Reference</a></p>
*/
class AWS_APPLICATIONDISCOVERYSERVICE_API NeighborConnectionDetail
{
public:
NeighborConnectionDetail();
NeighborConnectionDetail(Aws::Utils::Json::JsonView jsonValue);
NeighborConnectionDetail& operator=(Aws::Utils::Json::JsonView jsonValue);
Aws::Utils::Json::JsonValue Jsonize() const;
/**
* <p>The ID of the server that opened the network connection.</p>
*/
inline const Aws::String& GetSourceServerId() const{ return m_sourceServerId; }
/**
* <p>The ID of the server that opened the network connection.</p>
*/
inline bool SourceServerIdHasBeenSet() const { return m_sourceServerIdHasBeenSet; }
/**
* <p>The ID of the server that opened the network connection.</p>
*/
inline void SetSourceServerId(const Aws::String& value) { m_sourceServerIdHasBeenSet = true; m_sourceServerId = value; }
/**
* <p>The ID of the server that opened the network connection.</p>
*/
inline void SetSourceServerId(Aws::String&& value) { m_sourceServerIdHasBeenSet = true; m_sourceServerId = std::move(value); }
/**
* <p>The ID of the server that opened the network connection.</p>
*/
inline void SetSourceServerId(const char* value) { m_sourceServerIdHasBeenSet = true; m_sourceServerId.assign(value); }
/**
* <p>The ID of the server that opened the network connection.</p>
*/
inline NeighborConnectionDetail& WithSourceServerId(const Aws::String& value) { SetSourceServerId(value); return *this;}
/**
* <p>The ID of the server that opened the network connection.</p>
*/
inline NeighborConnectionDetail& WithSourceServerId(Aws::String&& value) { SetSourceServerId(std::move(value)); return *this;}
/**
* <p>The ID of the server that opened the network connection.</p>
*/
inline NeighborConnectionDetail& WithSourceServerId(const char* value) { SetSourceServerId(value); return *this;}
/**
* <p>The ID of the server that accepted the network connection.</p>
*/
inline const Aws::String& GetDestinationServerId() const{ return m_destinationServerId; }
/**
* <p>The ID of the server that accepted the network connection.</p>
*/
inline bool DestinationServerIdHasBeenSet() const { return m_destinationServerIdHasBeenSet; }
/**
* <p>The ID of the server that accepted the network connection.</p>
*/
inline void SetDestinationServerId(const Aws::String& value) { m_destinationServerIdHasBeenSet = true; m_destinationServerId = value; }
/**
* <p>The ID of the server that accepted the network connection.</p>
*/
inline void SetDestinationServerId(Aws::String&& value) { m_destinationServerIdHasBeenSet = true; m_destinationServerId = std::move(value); }
/**
* <p>The ID of the server that accepted the network connection.</p>
*/
inline void SetDestinationServerId(const char* value) { m_destinationServerIdHasBeenSet = true; m_destinationServerId.assign(value); }
/**
* <p>The ID of the server that accepted the network connection.</p>
*/
inline NeighborConnectionDetail& WithDestinationServerId(const Aws::String& value) { SetDestinationServerId(value); return *this;}
/**
* <p>The ID of the server that accepted the network connection.</p>
*/
inline NeighborConnectionDetail& WithDestinationServerId(Aws::String&& value) { SetDestinationServerId(std::move(value)); return *this;}
/**
* <p>The ID of the server that accepted the network connection.</p>
*/
inline NeighborConnectionDetail& WithDestinationServerId(const char* value) { SetDestinationServerId(value); return *this;}
/**
* <p>The destination network port for the connection.</p>
*/
inline int GetDestinationPort() const{ return m_destinationPort; }
/**
* <p>The destination network port for the connection.</p>
*/
inline bool DestinationPortHasBeenSet() const { return m_destinationPortHasBeenSet; }
/**
* <p>The destination network port for the connection.</p>
*/
inline void SetDestinationPort(int value) { m_destinationPortHasBeenSet = true; m_destinationPort = value; }
/**
* <p>The destination network port for the connection.</p>
*/
inline NeighborConnectionDetail& WithDestinationPort(int value) { SetDestinationPort(value); return *this;}
/**
* <p>The network protocol used for the connection.</p>
*/
inline const Aws::String& GetTransportProtocol() const{ return m_transportProtocol; }
/**
* <p>The network protocol used for the connection.</p>
*/
inline bool TransportProtocolHasBeenSet() const { return m_transportProtocolHasBeenSet; }
/**
* <p>The network protocol used for the connection.</p>
*/
inline void SetTransportProtocol(const Aws::String& value) { m_transportProtocolHasBeenSet = true; m_transportProtocol = value; }
/**
* <p>The network protocol used for the connection.</p>
*/
inline void SetTransportProtocol(Aws::String&& value) { m_transportProtocolHasBeenSet = true; m_transportProtocol = std::move(value); }
/**
* <p>The network protocol used for the connection.</p>
*/
inline void SetTransportProtocol(const char* value) { m_transportProtocolHasBeenSet = true; m_transportProtocol.assign(value); }
/**
* <p>The network protocol used for the connection.</p>
*/
inline NeighborConnectionDetail& WithTransportProtocol(const Aws::String& value) { SetTransportProtocol(value); return *this;}
/**
* <p>The network protocol used for the connection.</p>
*/
inline NeighborConnectionDetail& WithTransportProtocol(Aws::String&& value) { SetTransportProtocol(std::move(value)); return *this;}
/**
* <p>The network protocol used for the connection.</p>
*/
inline NeighborConnectionDetail& WithTransportProtocol(const char* value) { SetTransportProtocol(value); return *this;}
/**
* <p>The number of open network connections with the neighboring server.</p>
*/
inline long long GetConnectionsCount() const{ return m_connectionsCount; }
/**
* <p>The number of open network connections with the neighboring server.</p>
*/
inline bool ConnectionsCountHasBeenSet() const { return m_connectionsCountHasBeenSet; }
/**
* <p>The number of open network connections with the neighboring server.</p>
*/
inline void SetConnectionsCount(long long value) { m_connectionsCountHasBeenSet = true; m_connectionsCount = value; }
/**
* <p>The number of open network connections with the neighboring server.</p>
*/
inline NeighborConnectionDetail& WithConnectionsCount(long long value) { SetConnectionsCount(value); return *this;}
private:
Aws::String m_sourceServerId;
bool m_sourceServerIdHasBeenSet;
Aws::String m_destinationServerId;
bool m_destinationServerIdHasBeenSet;
int m_destinationPort;
bool m_destinationPortHasBeenSet;
Aws::String m_transportProtocol;
bool m_transportProtocolHasBeenSet;
long long m_connectionsCount;
bool m_connectionsCountHasBeenSet;
};
} // namespace Model
} // namespace ApplicationDiscoveryService
} // namespace Aws
| 35.719149 | 145 | 0.702526 | [
"model"
] |
507cffdc9df42f1af10254fcf77849eb8dcae12d | 4,651 | h | C | src/util/system.h | FromHDDtoSSD/SorachanCoin_Server | 6601f18767187f0b6c3bb0c30eee4820f2c2e4ff | [
"MIT"
] | 10 | 2018-08-14T08:53:37.000Z | 2021-03-14T02:28:44.000Z | src/util/system.h | FromHDDtoSSD/SorachanCoin_Server | 6601f18767187f0b6c3bb0c30eee4820f2c2e4ff | [
"MIT"
] | 1 | 2021-06-09T16:12:49.000Z | 2021-10-15T18:57:59.000Z | src/util/system.h | FromHDDtoSSD/SorachanCoin_Server | 6601f18767187f0b6c3bb0c30eee4820f2c2e4ff | [
"MIT"
] | 3 | 2020-07-09T22:35:26.000Z | 2022-01-17T18:44:13.000Z | // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2018 The Bitcoin Core developers
// Copyright (c) 2018-2021 The SorachanCoin developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
/**
* Server/client environment: argument handling, config file parsing,
* startup time
*/
#ifndef BITCOIN_UTIL_SYSTEM_H
#define BITCOIN_UTIL_SYSTEM_H
#if defined(HAVE_CONFIG_H)
# include <config/bitcoin-config.h>
#endif
#include <const/assumptions.h>
//#include <const/attributes.h>
#include <compat.h>
#include <file_operate/fs.h>
#include <util/logging.h>
#include <sync/lsync.h>
#include <util/tinyformat.h>
#include <util/memory.h>
#include <util/time.h>
#include <atomic>
#include <exception>
#include <map>
#include <set>
#include <stdint.h>
#include <string>
#include <unordered_set>
#include <utility>
#include <vector>
#include <boost/thread/condition_variable.hpp> // for boost::thread_interrupted
namespace lutil { // old core: uilt, latest core: lutil
// Application startup time (used for uptime calculation)
inline int64_t GetStartupTime() noexcept {
const static int64_t nStartupTime = util::GetTime();
return nStartupTime;
}
inline std::string BITCOIN_CONF_FILENAME() noexcept {
return "SorachanCoin.conf";
}
/** Translate a message to the native language of the user. */
const extern std::function<std::string(const char *)> G_TRANSLATION_FUN;
/**
* Translation function.
* If no translation function is set, simply return the input.
*/
inline std::string _(const char *psz) noexcept {
return G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(psz) : psz;
}
void SetupEnvironment();
bool SetupNetworking() noexcept;
template<typename... Args>
bool error(const char* fmt, const Args&... args) noexcept {
logging::LogPrintf("ERROR: %s\n", tfm::format(fmt, args...));
return false;
}
bool FileCommit(FILE *file);
bool TruncateFile(FILE *file, unsigned int length) noexcept;
int RaiseFileDescriptorLimit(int nMinFD) noexcept;
void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length);
bool RenameOver(fs::path src, fs::path dest);
bool LockDirectory(const fs::path &directory, const std::string lockfile_name, bool probe_only=false);
void UnlockDirectory(const fs::path &directory, const std::string &lockfile_name);
bool DirIsWritable(const fs::path &directory);
fs::path AbsPathForConfigVal(const fs::path &path, bool net_specific=true, bool ftestnet=false);
/** Release all directory locks. This is used for unit testing only, at runtime
* the global destructor will take care of the locks.
*/
void ReleaseDirectoryLocks();
bool TryCreateDirectories(const fs::path& p);
fs::path GetDefaultDataDir();
// The blocks directory is always net specific.
const fs::path &GetBlocksDir();
const fs::path &GetDataDir(bool fNetSpecific = true);
void ClearDatadirCache();
#ifdef WIN32
fs::path GetSpecialFolderPath(int nFolder, bool fCreate = true) noexcept;
#endif
void runCommand(const std::string &strCommand);
inline bool IsSwitchChar(char c)
{
#ifdef WIN32
return c == '-' || c == '/';
#else
return c == '-';
#endif
}
/**
* Return the number of cores available on the current system.
* @note This does count virtual cores, such as those provided by HyperThreading.
*/
int GetNumCores();
//std::string CopyrightHolders(const std::string &strPrefix) noexcept;
/**
* On platforms that support it, tell the kernel the calling thread is
* CPU-intensive and non-interactive. See SCHED_BATCH in sched(7) for details.
*
* @return The return value of sched_setschedule(), or 1 on systems without
* sched_setschedule().
*/
int ScheduleBatchPriority();
//! Simplification of std insertion
template <typename Tdst, typename Tsrc>
inline void insert(Tdst &dst, const Tsrc &src) {
dst.insert(dst.begin(), src.begin(), src.end());
}
template <typename TsetT, typename Tsrc>
inline void insert(std::set<TsetT> &dst, const Tsrc &src) {
dst.insert(src.begin(), src.end());
}
#ifdef WIN32
bool wchartochar(const wchar_t *source, std::string &dest) noexcept;
class WinCmdLineArgs
{
public:
WinCmdLineArgs();
~WinCmdLineArgs();
std::pair<int, char **> get();
private:
WinCmdLineArgs(const WinCmdLineArgs &)=delete;
WinCmdLineArgs(WinCmdLineArgs &&)=delete;
WinCmdLineArgs &operator=(const WinCmdLineArgs &)=delete;
WinCmdLineArgs &operator=(WinCmdLineArgs &&)=delete;
bool operator==(const WinCmdLineArgs &)=delete;
int argc_;
char **argv_;
std::vector<std::string> args_;
};
#endif
} // namespace lutil
#endif // BITCOIN_UTIL_SYSTEM_H
| 29.436709 | 102 | 0.735971 | [
"vector"
] |
507e3d0c8a701d62bb5f9fbeac7dcfd91cb98254 | 3,489 | h | C | src/DownloadSettings.h | junhoryu/luna-downloadmgr | 47c7c3cc9e425fed4da71e62e7f6e6c08a197f7f | [
"Apache-2.0"
] | null | null | null | src/DownloadSettings.h | junhoryu/luna-downloadmgr | 47c7c3cc9e425fed4da71e62e7f6e6c08a197f7f | [
"Apache-2.0"
] | null | null | null | src/DownloadSettings.h | junhoryu/luna-downloadmgr | 47c7c3cc9e425fed4da71e62e7f6e6c08a197f7f | [
"Apache-2.0"
] | 1 | 2018-08-24T06:57:08.000Z | 2018-08-24T06:57:08.000Z | // Copyright (c) 2012-2018 LG Electronics, 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.
//
// SPDX-License-Identifier: Apache-2.0
#ifndef __Settings_h__
#define __Settings_h__
#include <string>
#include <vector>
#include <set>
#include <glib.h>
#include <stdint.h>
#include "Singleton.hpp"
#include "webospaths.h"
// low mark is hard-defaulted to 80%
#define FREESPACE_LOWMARK_FULL_PCT 90
// medium mark at 90%
#define FREESPACE_MEDMARK_FULL_PCT 95
// high (warning) mark is hard defaulted to 95%
#define FREESPACE_HIGHMARK_FULL_PCT 98
//the critical mark is 99%
#define FREESPACE_CRITICALMARK_FULL_PCT 99
class DownloadSettings : public Singleton<DownloadSettings>
{
public:
std::string downloadPathMedia; //default >> /media/internal/downloads
std::string schemaPath; //default >> @WEBOS_INSTALL_WEBOS_SYSCONFDIR@/schemas/luna-downloadmgr/
std::string wiredInterfaceName; //eth0
std::string wifiInterfaceName; //wlan0
std::string wanInterfaceName; //ppp0
std::string btpanInterfaceName; //bsl0
bool autoResume; //false
bool resumeAggression; //true
bool appCompatibilityMode; //true
bool preemptiveFreeSpaceCheck; //true
bool dbg_fake1xForWan; //false. set to true to make it look like any connected WAN status is a 1x connection (for testing low coverage/1x scenarios)
bool dbg_forceNovacomOnAtStartup; //false. set to true to make the downloadmanager service flip novacom access to enabled (aka dev mode switch) to debug "full erase" scenarios where
// the erase disables it
bool localPackageInstallNoSafety; //false. set to true to not check for status of a previous install of a package of the same name, when performing a local install of that package
// (in essence a hard override of the system to force an install to complete. Use with extreme caution. BARLEYWINE HACKATHON )
unsigned int maxDownloadManagerQueueLength;
int maxDownloadManagerConcurrent;
unsigned int maxDownloadManagerRecvSpeed;
uint32_t freespaceLowmarkFullPercent;
uint32_t freespaceMedmarkFullPercent;
uint32_t freespaceHighmarkFullPercent;
uint32_t freespaceCriticalmarkFullPercent;
uint64_t freespaceStopmarkRemainingKBytes;
bool dbg_useStatfsFake;
uint64_t dbg_statfsFakeFreeSizeBytes;
static DownloadSettings* Settings();
private:
void load();
DownloadSettings();
~DownloadSettings();
friend class Singleton<DownloadSettings>;
static bool validateDownloadPath(const std::string& path);
};
#endif // Settings
| 41.047059 | 199 | 0.66552 | [
"vector"
] |
508450801c0b8454ab0854b09e45ac52175f2f98 | 4,057 | c | C | lib/wiringPi/examples/PiFace/reaction.c | Haransis/gpio-map | 908c0ad7dbfd17e69e75cb778b7634129545a5c6 | [
"MIT"
] | 47 | 2018-07-30T12:05:15.000Z | 2022-03-31T04:12:03.000Z | lib/wiringPi/examples/PiFace/reaction.c | Haransis/gpio-map | 908c0ad7dbfd17e69e75cb778b7634129545a5c6 | [
"MIT"
] | 17 | 2015-01-05T21:06:22.000Z | 2015-12-07T20:45:44.000Z | lib/wiringPi/examples/PiFace/reaction.c | Haransis/gpio-map | 908c0ad7dbfd17e69e75cb778b7634129545a5c6 | [
"MIT"
] | 16 | 2019-07-09T07:59:00.000Z | 2022-02-25T15:49:06.000Z | /*
* reaction.c:
* Simple test for the PiFace interface board.
*
* Copyright (c) 2012-2013 Gordon Henderson. <projects@drogon.net>
***********************************************************************
* This file is part of wiringPi:
* https://projects.drogon.net/raspberry-pi/wiringpi/
*
* wiringPi is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* wiringPi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
***********************************************************************
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <wiringPi.h>
#include <piFace.h>
int outputs [4] = { 0,0,0,0 } ;
#define PIFACE 200
/*
* light:
* Light up the given LED - actually lights up a pair
*********************************************************************************
*/
void light (int led, int value)
{
led *= 2 ;
digitalWrite (PIFACE + led + 0, value) ;
digitalWrite (PIFACE + led + 1, value) ;
}
/*
* lightAll:
* All On or Off
*********************************************************************************
*/
void lightAll (int onoff)
{
light (0, onoff) ;
light (1, onoff) ;
light (2, onoff) ;
light (3, onoff) ;
}
/*
* waitForNoButtons:
* Wait for all buttons to be released
*********************************************************************************
*/
void waitForNoButtons (void)
{
int i, button ;
for (;;)
{
button = 0 ;
for (i = 0 ; i < 4 ; ++i)
button += digitalRead (PIFACE + i) ;
if (button == 4)
break ;
}
}
void scanButton (int button)
{
if (digitalRead (PIFACE + button) == LOW)
{
outputs [button] ^= 1 ;
digitalWrite (PIFACE + button, outputs [button]) ;
}
while (digitalRead (PIFACE + button) == LOW)
delay (1) ;
}
int main (void)
{
int i, j ;
int led, button ;
unsigned int start, stop ;
printf ("Raspberry Pi PiFace Reaction Timer\n") ;
printf ("==================================\n") ;
if (piFaceSetup (PIFACE) == -1)
exit (1) ;
// Enable internal pull-ups
for (i = 0 ; i < 8 ; ++i)
pullUpDnControl (PIFACE + i, PUD_UP) ;
// Main game loop:
// Put some random LED pairs up for a few seconds, then blank ...
for (;;)
{
printf ("Press any button to start ... \n") ; fflush (stdout) ;
for (;;)
{
led = rand () % 4 ;
light (led, 1) ;
delay (10) ;
light (led, 0) ;
button = 0 ;
for (j = 0 ; j < 4 ; ++j)
button += digitalRead (PIFACE + j) ;
if (button != 4)
break ;
}
waitForNoButtons () ;
printf ("Wait for it ... ") ; fflush (stdout) ;
led = rand () % 4 ;
delay (rand () % 500 + 1000) ;
light (led, 1) ;
start = millis () ;
for (button = -1 ; button == -1 ; )
{
for (j = 0 ; j < 4 ; ++j)
if (digitalRead (PIFACE + j) == 0) // Pushed
{
button = j ;
break ;
}
}
stop = millis () ;
button = 3 - button ; // Correct for the buttons/LEDs reversed
light (led, 0) ;
waitForNoButtons () ;
light (led, 1) ;
if (button == led)
{
printf ("You got it in %3d mS\n", stop - start) ;
}
else
{
printf ("Missed: You pushed %d - LED was %d\n", button, led) ;
for (;;)
{
light (button, 1) ;
delay (100) ;
light (button, 0) ;
delay (100) ;
i = 0 ;
for (j = 0 ; j < 4 ; ++j)
i += digitalRead (PIFACE + j) ;
if (i != 4)
break ;
}
waitForNoButtons () ;
}
light (led, 0) ;
delay (4000) ;
}
return 0 ;
}
| 20.805128 | 82 | 0.50456 | [
"3d"
] |
50858bcd720c4eb4422ea4cd40fbaa24deea497c | 6,006 | h | C | src/evonet/include/EvoNet/simulator/EMGModel.h | dmccloskey/smartPeak_cpp | 47a19a804b65daef712418b4e278704b340d20b9 | [
"MIT"
] | null | null | null | src/evonet/include/EvoNet/simulator/EMGModel.h | dmccloskey/smartPeak_cpp | 47a19a804b65daef712418b4e278704b340d20b9 | [
"MIT"
] | 7 | 2018-01-11T20:39:09.000Z | 2018-01-11T21:02:31.000Z | src/evonet/include/EvoNet/simulator/EMGModel.h | dmccloskey/smartPeak_cpp | 47a19a804b65daef712418b4e278704b340d20b9 | [
"MIT"
] | null | null | null | /**TODO: Add copyright*/
#ifndef EVONET_EMGMODEL_H
#define EVONET_EMGMODEL_H
//.cpp
#include <cmath>
namespace EvoNet
{
/**
@brief A class to generate points following an EMG distribution.
References:
Kalambet, Y.; Kozmin, Y.; Mikhailova, K.; Nagaev, I.; Tikhonov, P. (2011).
"Reconstruction of chromatographic peaks using the exponentially modified Gaussian function".
Journal of Chemometrics. 25 (7): 352. doi:10.1002/cem.1343
Delley, R (1985).
"Series for the Exponentially Modified Gaussian Peak Shape".
Anal. Chem. 57: 388. doi:10.1021/ac00279a094.
Dyson, N. A. (1998).
Chromatographic Integration Methods.
Royal Society of Chemistry, Information Services. p. 27. ISBN 9780854045105. Retrieved 2015-05-15.
*/
template <typename TensorT>
class EMGModel
{
/**
Notes on potential optimizations:
1. make a virtual class called StatisticalModel
2. make a virtual class called PDF
3. make a virtual class called CDF
4. setters/getters would be unique to each derived class
*/
public:
EMGModel() = default; ///< Default constructor
EMGModel(const TensorT& h,
const TensorT& tau,
const TensorT& mu,
const TensorT& sigma); ///< Explicit constructor
~EMGModel() = default; ///< Default destructor
void setH(const TensorT& h); ///< EMG h setter
TensorT getH() const; ///< EMG h getter
void setTau(const TensorT& tau); ///< EMG tau setter
TensorT getTau() const; ///< EMG tau getter
void setMu(const TensorT& mu); ///< EMG mu setter
TensorT getMu() const; ///< EMG mu getter
void setSigma(const TensorT& sigma); ///< EMG sigma setter
TensorT getSigma() const; ///< EMG sigma getter
/**
@brief Calculates points from an EMG PDF
@param[in] x_I X value of the EMG PDF
@returns Y value of the EMG PDF.
*/
TensorT PDF(const TensorT& x_I) const;
protected:
/**
@brief Calculates points from an EMG PDF using method 1
@param[in] x_I X value of the EMG PDF
@returns Y value of the EMG PDF.
*/
TensorT EMGPDF1_(const TensorT& x_I) const;
/**
@brief Calculates points from an EMG PDF using method 2
@param[in] x_I X value of the EMG PDF
@returns Y value of the EMG PDF.
*/
TensorT EMGPDF2_(const TensorT& x_I) const;
/**
@brief Calculates points from an EMG PDF using method 3
@param[in] x_I X value of the EMG PDF
@returns Y value of the EMG PDF.
*/
TensorT EMGPDF3_(const TensorT& x_I) const;
/**
@brief Calculates the parameter z, which is used to decide
which formulation of the EMG PDF to use for calculation.
@param[in] x_I X value of the EMG PDF
@returns z parameter.
*/
TensorT z_(const TensorT& x_I) const;
private:
TensorT emg_h_ = (TensorT)1.0; ///< Amplitude of the Gaussian peak
TensorT emg_tau_ = (TensorT)0.1; ///< Exponential relaxation time
TensorT emg_mu_ = (TensorT)0.0; ///< Mean of the EMG
TensorT emg_sigma_ = (TensorT)1.0; ///< Standard deviation of the EGM
};
template <typename TensorT>
EMGModel<TensorT>::EMGModel(const TensorT& h,
const TensorT& tau,
const TensorT& mu,
const TensorT& sigma)
{
emg_h_ = h;
emg_tau_ = tau;
emg_mu_ = mu;
emg_sigma_ = sigma;
}
template <typename TensorT>
void EMGModel<TensorT>::setH(const TensorT& h)
{
emg_h_ = h;
}
template <typename TensorT>
TensorT EMGModel<TensorT>::getH() const
{
return emg_h_;
}
template <typename TensorT>
void EMGModel<TensorT>::setTau(const TensorT& tau)
{
emg_tau_ = tau;
}
template <typename TensorT>
TensorT EMGModel<TensorT>::getTau() const
{
return emg_tau_;
}
template <typename TensorT>
void EMGModel<TensorT>::setMu(const TensorT& mu)
{
emg_mu_ = mu;
}
template <typename TensorT>
TensorT EMGModel<TensorT>::getMu() const
{
return emg_mu_;
}
template <typename TensorT>
void EMGModel<TensorT>::setSigma(const TensorT& sigma)
{
emg_sigma_ = sigma;
}
template <typename TensorT>
TensorT EMGModel<TensorT>::getSigma() const
{
return emg_sigma_;
}
template <typename TensorT>
TensorT EMGModel<TensorT>::z_(const TensorT& x_I) const
{
TensorT z = TensorT(1 / std::sqrt(2)*(emg_sigma_ / emg_tau_ - (x_I - emg_mu_) / emg_sigma_));
return z;
}
template <typename TensorT>
TensorT EMGModel<TensorT>::EMGPDF1_(const TensorT& x_I) const
{
const TensorT PI = TensorT(3.141592653589793);
const TensorT term1a = TensorT(emg_h_ * emg_sigma_ / emg_tau_ * std::sqrt(PI / 2));
const TensorT term2a = TensorT(0.5*std::pow(emg_sigma_ / emg_tau_, 2) - (x_I - emg_mu_) / emg_tau_);
const TensorT term3a = TensorT(1 / sqrt(2)*(emg_sigma_ / emg_tau_ - (x_I - emg_mu_) / emg_sigma_));
const TensorT y = TensorT(term1a * std::exp(term2a)*std::erfc(term3a));
return y;
}
template <typename TensorT>
TensorT EMGModel<TensorT>::EMGPDF2_(const TensorT& x_I) const
{
const TensorT PI = TensorT(3.141592653589793);
const TensorT term1a = TensorT(emg_h_ * emg_sigma_ / emg_tau_ * std::sqrt(PI / 2));
const TensorT term2b = TensorT(-0.5*std::pow((x_I - emg_mu_) / emg_sigma_, 2));
const TensorT term3a = TensorT(1 / sqrt(2)*(emg_sigma_ / emg_tau_ - (x_I - emg_mu_) / emg_sigma_));
const TensorT y = TensorT(term1a * std::exp(term2b)*std::exp(std::pow(term3a, 2))*std::erfc(term3a));
return y;
}
template <typename TensorT>
TensorT EMGModel<TensorT>::EMGPDF3_(const TensorT& x_I) const
{
const TensorT term1b = TensorT(emg_h_);
const TensorT term2b = TensorT(-0.5*std::pow((x_I - emg_mu_) / emg_sigma_, 2));
const TensorT term3b = TensorT(1 - (x_I - emg_mu_)*emg_tau_ / std::pow(emg_sigma_, 2));
const TensorT y = TensorT(term1b * std::exp(term2b) / term3b);
return y;
}
template <typename TensorT>
TensorT EMGModel<TensorT>::PDF(const TensorT& x_I) const
{
const TensorT z = z_(x_I);
TensorT y = (TensorT)0;
if (z < 0)
{
y = EMGPDF1_(x_I);
}
else if (z >= 0 && z <= 6.71e7)
{
y = EMGPDF2_(x_I);
}
else if (z > 6.71e7)
{
y = EMGPDF3_(x_I);
}
return y;
}
}
#endif //EVONET_EMGMODEL_H | 26.45815 | 105 | 0.681818 | [
"shape"
] |
5088a1812712f9f676d40896418551301865b5a0 | 9,305 | c | C | app/src/main/c/bluez-5.60/mesh/appkey.c | IllusionMan1212/ShockPair | 0ad1fbd7edfcbf51e4b677d10ab3e137efec0b88 | [
"MIT"
] | 1 | 2021-07-12T00:34:11.000Z | 2021-07-12T00:34:11.000Z | app/src/main/c/bluez-5.60/mesh/appkey.c | IllusionMan1212/ShockPair | 0ad1fbd7edfcbf51e4b677d10ab3e137efec0b88 | [
"MIT"
] | null | null | null | app/src/main/c/bluez-5.60/mesh/appkey.c | IllusionMan1212/ShockPair | 0ad1fbd7edfcbf51e4b677d10ab3e137efec0b88 | [
"MIT"
] | null | null | null | // SPDX-License-Identifier: LGPL-2.1-or-later
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2017-2019 Intel Corporation. All rights reserved.
*
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#define _GNU_SOURCE
#include <ell/ell.h>
#include "mesh/mesh-defs.h"
#include "mesh/node.h"
#include "mesh/net.h"
#include "mesh/crypto.h"
#include "mesh/util.h"
#include "mesh/model.h"
#include "mesh/mesh-config.h"
#include "mesh/appkey.h"
struct mesh_app_key {
uint16_t net_idx;
uint16_t app_idx;
uint8_t key[16];
uint8_t key_aid;
uint8_t new_key[16];
uint8_t new_key_aid;
};
static bool match_key_index(const void *a, const void *b)
{
const struct mesh_app_key *key = a;
uint16_t idx = L_PTR_TO_UINT(b);
return key->app_idx == idx;
}
static bool match_bound_key(const void *a, const void *b)
{
const struct mesh_app_key *key = a;
uint16_t idx = L_PTR_TO_UINT(b);
return key->net_idx == idx;
}
static void finalize_key(void *a, void *b)
{
struct mesh_app_key *key = a;
uint16_t net_idx = L_PTR_TO_UINT(b);
if (key->net_idx != net_idx)
return;
if (key->new_key_aid == APP_AID_INVALID)
return;
key->key_aid = key->new_key_aid;
key->new_key_aid = APP_AID_INVALID;
memcpy(key->key, key->new_key, 16);
}
void appkey_finalize(struct mesh_net *net, uint16_t net_idx)
{
struct l_queue *app_keys;
app_keys = mesh_net_get_app_keys(net);
if (!app_keys)
return;
l_queue_foreach(app_keys, finalize_key, L_UINT_TO_PTR(net_idx));
}
static struct mesh_app_key *app_key_new(void)
{
struct mesh_app_key *key = l_new(struct mesh_app_key, 1);
key->new_key_aid = APP_AID_INVALID;
return key;
}
static bool set_key(struct mesh_app_key *key, uint16_t app_idx,
const uint8_t *key_value, bool is_new)
{
uint8_t key_aid;
if (!mesh_crypto_k4(key_value, &key_aid))
return false;
key_aid = KEY_ID_AKF | (key_aid << KEY_AID_SHIFT);
if (!is_new)
key->key_aid = key_aid;
else
key->new_key_aid = key_aid;
memcpy(is_new ? key->new_key : key->key, key_value, 16);
return true;
}
void appkey_key_free(void *data)
{
struct mesh_app_key *key = data;
if (!key)
return;
l_free(key);
}
bool appkey_key_init(struct mesh_net *net, uint16_t net_idx, uint16_t app_idx,
uint8_t *key_value, uint8_t *new_key_value)
{
struct mesh_app_key *key;
struct l_queue *app_keys;
if (net_idx > MAX_KEY_IDX || app_idx > MAX_KEY_IDX)
return false;
app_keys = mesh_net_get_app_keys(net);
if (!app_keys)
return NULL;
if (!mesh_net_have_key(net, net_idx))
return false;
key = app_key_new();
if (!key)
return false;
key->net_idx = net_idx;
key->app_idx = app_idx;
if (key_value && !set_key(key, app_idx, key_value, false))
return false;
if (new_key_value && !set_key(key, app_idx, new_key_value, true))
return false;
l_queue_push_tail(app_keys, key);
return true;
}
const uint8_t *appkey_get_key(struct mesh_net *net, uint16_t app_idx,
uint8_t *key_aid)
{
struct mesh_app_key *app_key;
uint8_t phase;
struct l_queue *app_keys;
app_keys = mesh_net_get_app_keys(net);
if (!app_keys)
return NULL;
app_key = l_queue_find(app_keys, match_key_index,
L_UINT_TO_PTR(app_idx));
if (!app_key)
return NULL;
if (mesh_net_key_refresh_phase_get(net, app_key->net_idx, &phase) !=
MESH_STATUS_SUCCESS)
return NULL;
if (phase != KEY_REFRESH_PHASE_TWO) {
*key_aid = app_key->key_aid;
return app_key->key;
}
if (app_key->new_key_aid == APP_AID_INVALID)
return NULL;
*key_aid = app_key->new_key_aid;
return app_key->new_key;
}
int appkey_get_key_idx(struct mesh_app_key *app_key,
const uint8_t **key, uint8_t *key_aid,
const uint8_t **new_key, uint8_t *new_key_aid)
{
if (!app_key)
return -1;
if (key && key_aid) {
*key = app_key->key;
*key_aid = app_key->key_aid;
}
if (new_key && new_key_aid) {
*new_key = app_key->new_key;
*new_key_aid = app_key->new_key_aid;
}
return app_key->app_idx;
}
bool appkey_have_key(struct mesh_net *net, uint16_t app_idx)
{
struct mesh_app_key *key;
struct l_queue *app_keys;
app_keys = mesh_net_get_app_keys(net);
if (!app_keys)
return false;
key = l_queue_find(app_keys, match_key_index, L_UINT_TO_PTR(app_idx));
if (!key)
return false;
else
return true;
}
uint16_t appkey_net_idx(struct mesh_net *net, uint16_t app_idx)
{
struct mesh_app_key *key;
struct l_queue *app_keys;
app_keys = mesh_net_get_app_keys(net);
if (!app_keys)
return NET_IDX_INVALID;
key = l_queue_find(app_keys, match_key_index, L_UINT_TO_PTR(app_idx));
if (!key)
return NET_IDX_INVALID;
else
return key->net_idx;
}
int appkey_key_update(struct mesh_net *net, uint16_t net_idx, uint16_t app_idx,
const uint8_t *new_key)
{
struct mesh_app_key *key;
struct l_queue *app_keys;
uint8_t phase = KEY_REFRESH_PHASE_NONE;
struct mesh_node *node;
app_keys = mesh_net_get_app_keys(net);
if (!app_keys)
return MESH_STATUS_INSUFF_RESOURCES;
if (!mesh_net_have_key(net, net_idx))
return MESH_STATUS_INVALID_NETKEY;
key = l_queue_find(app_keys, match_key_index, L_UINT_TO_PTR(app_idx));
if (!key)
return MESH_STATUS_INVALID_APPKEY;
if (key->net_idx != net_idx)
return MESH_STATUS_INVALID_BINDING;
mesh_net_key_refresh_phase_get(net, net_idx, &phase);
if (phase != KEY_REFRESH_PHASE_ONE)
return MESH_STATUS_CANNOT_UPDATE;
/* Check if the key has been already successfully updated */
if (memcmp(new_key, key->new_key, 16) == 0)
return MESH_STATUS_SUCCESS;
if (!set_key(key, app_idx, new_key, true))
return MESH_STATUS_INSUFF_RESOURCES;
node = mesh_net_node_get(net);
if (!mesh_config_app_key_update(node_config_get(node), app_idx,
new_key))
return MESH_STATUS_STORAGE_FAIL;
return MESH_STATUS_SUCCESS;
}
int appkey_key_add(struct mesh_net *net, uint16_t net_idx, uint16_t app_idx,
const uint8_t *new_key)
{
struct mesh_app_key *key;
struct l_queue *app_keys;
struct mesh_node *node;
app_keys = mesh_net_get_app_keys(net);
if (!app_keys)
return MESH_STATUS_INSUFF_RESOURCES;
key = l_queue_find(app_keys, match_key_index, L_UINT_TO_PTR(app_idx));
if (key) {
if (memcmp(new_key, key->key, 16) == 0)
return MESH_STATUS_SUCCESS;
else
return MESH_STATUS_IDX_ALREADY_STORED;
}
if (!mesh_net_have_key(net, net_idx))
return MESH_STATUS_INVALID_NETKEY;
if (l_queue_length(app_keys) >= MAX_APP_KEYS)
return MESH_STATUS_INSUFF_RESOURCES;
key = app_key_new();
if (!set_key(key, app_idx, new_key, false)) {
appkey_key_free(key);
return MESH_STATUS_INSUFF_RESOURCES;
}
node = mesh_net_node_get(net);
if (!mesh_config_app_key_add(node_config_get(node), net_idx, app_idx,
new_key)) {
appkey_key_free(key);
return MESH_STATUS_STORAGE_FAIL;
}
key->net_idx = net_idx;
key->app_idx = app_idx;
l_queue_push_tail(app_keys, key);
return MESH_STATUS_SUCCESS;
}
int appkey_key_delete(struct mesh_net *net, uint16_t net_idx,
uint16_t app_idx)
{
struct mesh_app_key *key;
struct l_queue *app_keys;
struct mesh_node *node;
app_keys = mesh_net_get_app_keys(net);
if (!app_keys)
return MESH_STATUS_INVALID_APPKEY;
key = l_queue_find(app_keys, match_key_index, L_UINT_TO_PTR(app_idx));
if (!key)
return MESH_STATUS_SUCCESS;
if (key->net_idx != net_idx)
return MESH_STATUS_INVALID_NETKEY;
node = mesh_net_node_get(net);
node_app_key_delete(node, net_idx, app_idx);
l_queue_remove(app_keys, key);
appkey_key_free(key);
if (!mesh_config_app_key_del(node_config_get(node), net_idx, app_idx))
return MESH_STATUS_STORAGE_FAIL;
return MESH_STATUS_SUCCESS;
}
void appkey_delete_bound_keys(struct mesh_net *net, uint16_t net_idx)
{
struct l_queue *app_keys;
struct mesh_node *node;
struct mesh_app_key *key;
app_keys = mesh_net_get_app_keys(net);
if (!app_keys)
return;
node = mesh_net_node_get(net);
key = l_queue_remove_if(app_keys, match_bound_key,
L_UINT_TO_PTR(net_idx));
while (key) {
node_app_key_delete(node, net_idx, key->app_idx);
mesh_config_app_key_del(node_config_get(node), net_idx,
key->app_idx);
appkey_key_free(key);
key = l_queue_remove_if(app_keys, match_bound_key,
L_UINT_TO_PTR(net_idx));
}
}
uint8_t appkey_list(struct mesh_net *net, uint16_t net_idx, uint8_t *buf,
uint16_t buf_size, uint16_t *size)
{
const struct l_queue_entry *entry;
uint32_t idx_pair;
int i;
uint16_t datalen;
struct l_queue *app_keys;
*size = 0;
if (!mesh_net_have_key(net, net_idx))
return MESH_STATUS_INVALID_NETKEY;
app_keys = mesh_net_get_app_keys(net);
if (!app_keys || l_queue_isempty(app_keys))
return MESH_STATUS_SUCCESS;
idx_pair = 0;
i = 0;
datalen = 0;
entry = l_queue_get_entries(app_keys);
for (; entry; entry = entry->next) {
struct mesh_app_key *key = entry->data;
if (net_idx != key->net_idx)
continue;
if (!(i & 0x1)) {
idx_pair = key->app_idx;
} else {
idx_pair <<= 12;
idx_pair += key->app_idx;
/* Unlikely, but check for overflow*/
if ((datalen + 3) > buf_size) {
l_warn("Appkey list too large");
goto done;
}
l_put_le32(idx_pair, buf);
buf += 3;
datalen += 3;
}
i++;
}
/* Process the last app key if present */
if (i & 0x1 && ((datalen + 2) <= buf_size)) {
l_put_le16(idx_pair, buf);
datalen += 2;
}
done:
*size = datalen;
return MESH_STATUS_SUCCESS;
}
| 20.957207 | 79 | 0.724772 | [
"mesh",
"model"
] |
508ad315f018b04b21ef1908b825f76f188ce1e4 | 1,818 | h | C | browser/notification_presenter_mac.h | paulcbetts/brightray | 4f04cc8121dd05ed61a8c94edfa66201e12f0abb | [
"BSD-3-Clause",
"MIT"
] | 1 | 2015-11-08T22:37:26.000Z | 2015-11-08T22:37:26.000Z | browser/notification_presenter_mac.h | paulcbetts/brightray | 4f04cc8121dd05ed61a8c94edfa66201e12f0abb | [
"BSD-3-Clause",
"MIT"
] | null | null | null | browser/notification_presenter_mac.h | paulcbetts/brightray | 4f04cc8121dd05ed61a8c94edfa66201e12f0abb | [
"BSD-3-Clause",
"MIT"
] | null | null | null | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Copyright (c) 2013 Adam Roben <adam@roben.org>. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE-CHROMIUM file.
#ifndef BRIGHTRAY_BROWSER_NOTIFICATION_PRESENTER_MAC_H_
#define BRIGHTRAY_BROWSER_NOTIFICATION_PRESENTER_MAC_H_
#import "browser/notification_presenter.h"
#import "base/mac/scoped_nsobject.h"
#import <map>
@class BRYUserNotificationCenterDelegate;
namespace brightray {
class NotificationPresenterMac : public NotificationPresenter {
public:
NotificationPresenterMac();
~NotificationPresenterMac();
virtual void ShowNotification(
const content::ShowDesktopNotificationHostMsgParams&,
scoped_ptr<content::DesktopNotificationDelegate> delegate,
base::Closure* cancel_callback) override;
// Get the delegate accroding from the notification object.
content::DesktopNotificationDelegate* GetDelegateFromNotification(
NSUserNotification* notification);
// Remove the notification object accroding to its delegate.
void RemoveNotification(content::DesktopNotificationDelegate* delegate);
private:
void CancelNotification(content::DesktopNotificationDelegate* delegate);
// The userInfo of NSUserNotification can not store pointers (because they are
// not in property list), so we have to track them in a C++ map.
// Also notice that the delegate acts as "ID" or "Key", because it is certain
// that each notification has a unique delegate.
typedef std::map<content::DesktopNotificationDelegate*, base::scoped_nsobject<NSUserNotification>>
NotificationsMap;
NotificationsMap notifications_map_;
base::scoped_nsobject<BRYUserNotificationCenterDelegate> delegate_;
};
} // namespace brightray
#endif
| 34.961538 | 100 | 0.789329 | [
"object"
] |
508ceecf81b04885546abb305186250100a0846a | 7,685 | c | C | src/common.c | jomael/libmixed | a60bbb14eddb1196d0712e5f80b16388ade6ae2d | [
"Zlib"
] | 18 | 2017-05-09T13:20:08.000Z | 2022-02-12T04:36:36.000Z | src/common.c | jomael/libmixed | a60bbb14eddb1196d0712e5f80b16388ade6ae2d | [
"Zlib"
] | 8 | 2017-11-14T15:13:54.000Z | 2020-07-24T17:13:39.000Z | src/common.c | jomael/libmixed | a60bbb14eddb1196d0712e5f80b16388ade6ae2d | [
"Zlib"
] | 5 | 2018-11-07T20:15:38.000Z | 2021-05-02T15:50:31.000Z | #ifndef _WIN32
# include <dlfcn.h>
#else
# include <windows.h>
#endif
#include "internal.h"
MIXED_EXPORT uint8_t mixed_samplesize(enum mixed_encoding encoding){
switch(encoding){
case MIXED_INT8: return 1;
case MIXED_UINT8: return 1;
case MIXED_INT16: return 2;
case MIXED_UINT16: return 2;
case MIXED_INT24: return 3;
case MIXED_UINT24: return 3;
case MIXED_INT32: return 4;
case MIXED_UINT32: return 4;
case MIXED_FLOAT: return 4;
case MIXED_DOUBLE: return 8;
default: return -1;
}
}
int mix_noop(struct mixed_segment *segment){
IGNORE(segment);
return 1;
}
thread_local int errorcode = 0;
void mixed_err(int code){
errorcode = code;
}
MIXED_EXPORT int mixed_error(){
return errorcode;
}
MIXED_EXPORT char *mixed_error_string(int code){
if(code < 0) code = errorcode;
switch(code){
case MIXED_NO_ERROR:
return "No error has occurred.";
case MIXED_OUT_OF_MEMORY:
return "An allocation has failed. You are likely out of memory.";
case MIXED_UNKNOWN_ENCODING:
return "The specified sample encoding is unknown.";
case MIXED_MIXING_FAILED:
return "An error occurred during the mixing of a segment.";
case MIXED_NOT_IMPLEMENTED:
return "The segment function you tried to call was not provided.";
case MIXED_NOT_INITIALIZED:
return "An attempt was made to use an object without initializing it properly first.";
case MIXED_INVALID_LOCATION:
return "Cannot set the field at the specified location in the segment.";
case MIXED_INVALID_FIELD:
return "A field that the segment does not recognise was requested.";
case MIXED_INVALID_VALUE:
return "A value that is not within the valid range for a field was attempted to be set.";
case MIXED_SEGMENT_ALREADY_STARTED:
return "Cannot start the segment as it is already started.";
case MIXED_SEGMENT_ALREADY_ENDED:
return "Cannot end the segment as it is already ended.";
case MIXED_DYNAMIC_OPEN_FAILED:
return "Failed to open the plugin library. Most likely the file could not be read.";
case MIXED_BAD_DYNAMIC_LIBRARY:
return "The plugin library was found but does not seem to be a valid library as it is missing its initialisation function.";
case MIXED_LADSPA_NO_PLUGIN_AT_INDEX:
return "The LADSPA plugin library does not have a plugin at the requested index.";
case MIXED_LADSPA_INSTANTIATION_FAILED:
return "Instantiation of the LADSPA plugin has failed.";
case MIXED_RESAMPLE_FAILED:
return "An error happened in the libsamplerate library.";
case MIXED_BUFFER_EMPTY:
return "A read was requested on a buffer with no committed write data.";
case MIXED_BUFFER_FULL:
return "A write was requested on a buffer with no available space.";
case MIXED_BUFFER_OVERCOMMIT:
return "More data was attempted to be committed to the buffer than was requested.";
case MIXED_BAD_RESAMPLE_FACTOR:
return "The requested change in the sample rates is too big.";
case MIXED_BAD_CHANNEL_CONFIGURATION:
return "An unsupported channel conversion configuration was requested.";
case MIXED_BUFFER_ALLOCATED:
return "An allocated buffer was passed when an unallocated one was expected.";
case MIXED_BUFFER_MISSING:
return "An input or output port is missing a buffer.";
case MIXED_DUPLICATE_SEGMENT:
return "A segment with the requested name had already been registered.";
case MIXED_BAD_SEGMENT:
return "A segment with the requested name is not registered.";
default:
return "Unknown error code.";
}
}
MIXED_EXPORT char *mixed_type_string(int code){
switch(code){
case MIXED_UNKNOWN:
return "unknown";
case MIXED_INT8:
return "int8";
case MIXED_UINT8:
return "uint8";
case MIXED_INT16:
return "int16";
case MIXED_UINT16:
return "uint16";
case MIXED_INT24:
return "int24";
case MIXED_UINT24:
return "uint24";
case MIXED_INT32:
return "int32";
case MIXED_UINT32:
return "uint32";
case MIXED_FLOAT:
return "float";
case MIXED_DOUBLE:
return "double";
case MIXED_BOOL:
return "bool";
case MIXED_SIZE_T:
return "size_t";
case MIXED_STRING:
return "string";
case MIXED_FUNCTION:
return "function";
case MIXED_POINTER:
return "pointer";
case MIXED_SEGMENT_POINTER:
return "segment pointer";
case MIXED_BUFFER_POINTER:
return "buffer pointer";
case MIXED_PACK_POINTER:
return "pack pointer";
case MIXED_SEGMENT_SEQUENCE_POINTER:
return "segment sequence pointer";
case MIXED_LOCATION_ENUM:
return "location";
case MIXED_BIQUAD_FILTER_ENUM:
return "frequency pass";
case MIXED_REPEAT_MODE_ENUM:
return "repeat mode";
case MIXED_NOISE_TYPE_ENUM:
return "noise type";
case MIXED_GENERATOR_TYPE_ENUM:
return "generator type";
case MIXED_FADE_TYPE_ENUM:
return "fade type";
case MIXED_ATTENUATION_ENUM:
return "attenuation";
case MIXED_ENCODING_ENUM:
return "encoding";
case MIXED_ERROR_ENUM:
return "error";
case MIXED_RESAMPLE_TYPE_ENUM:
return "resample type";
default:
return "unknown";
}
}
MIXED_EXPORT char *mixed_version(){
return MIXED_VERSION;
}
void *crealloc(void *ptr, size_t oldcount, size_t newcount, size_t size){
size_t newsize = newcount*size;
size_t oldsize = oldcount*size;
ptr = realloc(ptr, newsize);
if(ptr && oldsize < newsize){
memset(((char*)ptr)+oldsize, 0, newsize-oldsize);
}
return ptr;
}
void set_info_field(struct mixed_segment_field_info *info, uint32_t field, enum mixed_segment_field_type type, uint32_t count, enum mixed_segment_info_flags flags, char*description){
info->field = field;
info->description = description;
info->flags = flags;
info->type = type;
info->type_count = count;
}
void clear_info_field(struct mixed_segment_field_info *info){
info->field = 0;
info->description = 0;
info->flags = 0;
info->type = 0;
info->type_count = 0;
}
void *open_library(char *file){
#ifdef _WIN32
void *lib = LoadLibrary(file);
if(!lib){
mixed_err(MIXED_DYNAMIC_OPEN_FAILED);
return 0;
}
return lib;
#else
void *lib = dlopen(file, RTLD_NOW);
if(!lib){
fprintf(stderr, "MIXED: DYLD error: %s\n", dlerror());
mixed_err(MIXED_DYNAMIC_OPEN_FAILED);
return 0;
}
dlerror();
return lib;
#endif
}
void close_library(void *handle){
if(handle)
#ifdef _WIN32
FreeLibrary(handle);
#else
dlclose(handle);
#endif
}
void *load_symbol(void *handle, char *name){
#ifdef _WIN32
void *function = GetProcAddress(handle, "mixed_make_plugin");
if(!function){
mixed_err(MIXED_BAD_DYNAMIC_LIBRARY);
return 0;
}
return function;
#else
void *function = dlsym(handle, name);
char *error = dlerror();
if(error != 0){
fprintf(stderr, "MIXED: DYLD error: %s\n", error);
mixed_err(MIXED_BAD_DYNAMIC_LIBRARY);
return 0;
}
return function;
#endif
}
float mixed_random_rdrand();
float mixed_random_m(){
return (float)rand()/(float)RAND_MAX;
}
float (*mixed_random)() = mixed_random_m;
#ifdef __RDRND__
uint8_t rdrand_available(){
const unsigned int flag_RDRAND = (1 << 30);
unsigned int eax, ebx, ecx, edx;
__cpuid(1, eax, ebx, ecx, edx);
return ((ecx & flag_RDRAND) == flag_RDRAND);
}
float mixed_random_rdrand(){
int retries = 10;
uint32_t random;
while(retries--){
if (_rdrand32_step(&random)) {
return (float)(random/UINT32_MAX);
}
}
return mixed_random_m();
}
#else
uint8_t rdrand_available(){
return 0;
}
float mixed_random_rdrand(){
return 0.0f;
}
#endif
static void init() __attribute__((constructor));
void init(){
srand(time(NULL));
if(rdrand_available())
mixed_random = mixed_random_rdrand;
}
| 26.964912 | 182 | 0.722576 | [
"object"
] |
5092ee6e150f578e8d8a836986a92d1de5b98439 | 20,404 | c | C | util/list.c | clayne/Convert-Binary-C | 159625dc6355f55d16c74df0a9e0526c650bff75 | [
"FSFAP"
] | 5 | 2015-03-12T03:01:01.000Z | 2020-11-22T18:30:25.000Z | util/list.c | clayne/Convert-Binary-C | 159625dc6355f55d16c74df0a9e0526c650bff75 | [
"FSFAP"
] | 5 | 2017-01-30T13:21:04.000Z | 2021-02-09T12:03:08.000Z | util/list.c | clayne/Convert-Binary-C | 159625dc6355f55d16c74df0a9e0526c650bff75 | [
"FSFAP"
] | 10 | 2015-07-24T19:19:37.000Z | 2020-11-22T18:30:27.000Z | /*******************************************************************************
*
* MODULE: list
*
********************************************************************************
*
* DESCRIPTION: Generic routines for a doubly linked ring list
*
********************************************************************************
*
* Copyright (c) 2002-2020 Marcus Holland-Moritz. All rights reserved.
* This program is free software; you can redistribute it and/or modify
* it under the same terms as Perl itself.
*
*******************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "ccattr.h"
#include "memalloc.h"
#include "list.h"
/*----------*/
/* Typedefs */
/*----------*/
typedef struct _link Link;
struct _link {
void *pObj;
Link *prev;
Link *next;
};
struct _linkedList {
Link link;
int size;
#ifdef DEBUG_UTIL_LIST
unsigned state;
#endif
};
#ifdef DEBUG_UTIL_LIST
# define CHANGE_STATE(list) (list)->state++
#else
# define CHANGE_STATE(list) (void) 0
#endif
/*------------------*/
/* Static Functions */
/*------------------*/
static inline Link *GetLink( LinkedList list, int item );
static inline void *Extract( LinkedList list, Link *pLink );
static inline Link *Insert( LinkedList list, Link *pLink, void *pObj );
static void QuickSort( Link *l, Link *r, int size, LLCompareFunc cmp );
/************************************************************
*
* S T A T I C F U N C T I O N S
*
************************************************************/
/*
* GetLink
*
* Get a link by item number.
*
* 0 <= item < list->size
* returns a pointer to the (item)th link
*
* -(list->size) <= item < 0
* returns a pointer to the (list->size+item)th link
*
* otherwise
* return NULL
*/
static inline Link *GetLink( LinkedList list, int item )
{
Link *pLink = &list->link;
if( item < 0 ) {
if( -item > list->size ) /* -1 is last item */
return NULL;
while( item++ < 0 )
pLink = pLink->prev;
}
else { /* item > 0 */
if( item >= list->size ) /* 0 is first item */
return NULL;
while( item-- >= 0 )
pLink = pLink->next;
}
return pLink;
}
/*
* Extract
*
* Extracts a link from its list, frees its
* resources and returns a pointer to the
* associated object.
*/
static inline void *Extract( LinkedList list, Link *pLink )
{
void *pObj = pLink->pObj;
pLink->prev->next = pLink->next;
pLink->next->prev = pLink->prev;
list->size--;
Free( pLink );
return pObj;
}
/*
* Insert
*
* Inserts a new link associated with pObj _before_
* the link pointed to by pLink and returns a pointer
* to the inserted link.
*/
static inline Link *Insert( LinkedList list, Link *pLink, void *pObj )
{
Link *pLinkNew;
AllocF( Link *, pLinkNew, sizeof( Link ) );
pLinkNew->pObj = pObj;
pLinkNew->prev = pLink->prev;
pLinkNew->next = pLink;
pLink->prev->next = pLinkNew;
pLink->prev = pLinkNew;
list->size++;
return pLinkNew;
}
/*
* QuickSort
*
* Adapted quick sort algorithm.
*/
static void QuickSort( Link *l, Link *r, int size, LLCompareFunc cmp )
{
Link *i, *j;
void *p, *t;
int lp, rp;
/* determine pivot */
lp = size / 2;
for( i=l; --lp > 0; i=i->next );
p = i->pObj;
/* initialize vars */
i = l; j = r;
lp = 0; rp = size-1;
/* sort */
for(;;) {
while( cmp( i->pObj, p ) < 0 )
i = i->next, lp++;
if( lp > rp ) break;
while( cmp( j->pObj, p ) > 0 )
j = j->prev, rp--;
if( lp > rp ) break;
/* swap elements */
t = i->pObj;
i->pObj = j->pObj;
j->pObj = t;
i = i->next; lp++;
j = j->prev; rp--;
}
if( rp+1 > 1 )
QuickSort( l, j, rp+1, cmp );
if( size-lp > 1 )
QuickSort( i, r, size-lp, cmp );
}
/************************************************************
*
* G L O B A L F U N C T I O N S
*
************************************************************/
/**
* Constructor
*
* Using the LL_new() function you create an empty linked
* list. If the term linked list scares you, just think of
* it as a flexible array, because the Linked List Library
* won't let you deal with links at all.
*
* \return A handle to the newly created linked list.
*
* \see LL_delete() and LL_destroy()
*/
LinkedList LL_new( void )
{
LinkedList list;
AllocF( LinkedList, list, sizeof( struct _linkedList ) );
list->link.prev = list->link.next = &list->link;
list->link.pObj = NULL;
list->size = 0;
#ifdef DEBUG_UTIL_LIST
list->state = 0;
#endif
return list;
}
/**
* Destructor
*
* LL_delete() will free the resources occupied by a
* linked list. The function will fail silently if the
* associated list is not empty.
* You can also delete a list that is not empty by
* using the LL_destroy() function.
*
* \param list Handle to an existing linked list.
*
* \see LL_new() and LL_destroy()
*/
void LL_delete( LinkedList list )
{
if( list == NULL || list->size )
return;
CHANGE_STATE(list);
Free( list );
}
/**
* Remove all elements from a list
*
* LL_flush() will remove all elements from a linked list,
* optionally calling a destructor function. It will not
* free the resources occupied by the list itself.
*
* \param list Handle to an existing linked list.
*
* \param destroy Pointer to the destructor function
* of the objects contained in the list.
* You can pass NULL if you don't want
* LL_flush() to call object destructors.
*
* \see LL_destroy()
*/
void LL_flush( LinkedList list, LLDestroyFunc destroy )
{
void *pObj;
if( list == NULL )
return;
CHANGE_STATE(list);
while( (pObj = LL_shift( list )) != NULL )
if( destroy ) destroy( pObj );
}
/**
* Extended Destructor
*
* LL_destroy() will, like LL_delete(), free the resources
* occupied by a linked list. However, it will empty the
* the list prior to deleting it, like LL_flush().
*
* \param list Handle to an existing linked list.
*
* \param destroy Pointer to the destructor function
* of the objects contained in the list.
* You can pass NULL if you don't want
* LL_destroy() to call object destructors.
*
* \see LL_new(), LL_delete() and LL_flush()
*/
void LL_destroy( LinkedList list, LLDestroyFunc destroy )
{
if( list == NULL )
return;
CHANGE_STATE(list);
LL_flush( list, destroy );
LL_delete( list );
}
/**
* Cloning a linked list
*
* Using the LL_clone() function to create an exact copy
* of a linked list. If the objects stored in the list
* need to be cloned as well, you can pass a pointer to
* a function that clones each element.
*
* \param list Handle to an existing linked list.
*
* \param func Pointer to the cloning function of
* the objects contained in the list.
* If you pass NULL, the original
* object is stored in the cloned list
* instead of a cloned object.
*
* \return A handle to the cloned linked list.
*
* \see LL_new()
*/
LinkedList LL_clone( ConstLinkedList list, LLCloneFunc func )
{
ListIterator li;
LinkedList clone;
void *pObj;
if( list == NULL )
return NULL;
clone = LL_new();
LL_foreach(pObj, li, list)
LL_push(clone, func ? func(pObj) : pObj);
return clone;
}
/**
* Current size of a list
*
* LL_count() will return the the number of objects that
* a linked list contains.
*
* \param list Handle to an existing linked list.
*
* \return The size of the list or -1 if an invalid handle
* was passed.
*/
int LL_count( ConstLinkedList list )
{
if( list == NULL )
return -1;
AssertValidPtr( list );
return list->size;
}
/**
* Add element to the end of a list.
*
* LL_push() will add a new element to the end of a list.
* If you think of the list as a stack, the function pushes
* a new element on top of the stack.
*
* \param list Handle to an existing linked list.
*
* \param pObj Pointer to an object associated with
* the new list element. The function
* will not add a new element if this
* is NULL.
*
* \see LL_pop()
*/
void LL_push( LinkedList list, void *pObj )
{
if( list == NULL || pObj == NULL )
return;
AssertValidPtr( list );
CHANGE_STATE(list);
(void) Insert( list, &list->link, pObj );
}
/**
* Remove element from the end of a list.
*
* LL_pop() will remove the last element from a list.
* If you think of the list as a stack, the function pops
* an element of the stack.
*
* \param list Handle to an existing linked list.
*
* \return Pointer to the object that was associated with
* the element removed from the list. If the list
* is empty, NULL will be returned.
*
* \see LL_push()
*/
void *LL_pop( LinkedList list )
{
if( list == NULL || list->size == 0 )
return NULL;
AssertValidPtr( list );
CHANGE_STATE(list);
return Extract( list, list->link.prev );
}
/**
* Add element to the start of a list.
*
* LL_unshift() will add a new element to the beginning of a
* list, right before the first element. For an empty list
* this is equivalent to calling LL_push().
*
* \param list Handle to an existing linked list.
*
* \param pObj Pointer to an object associated with
* the new list element. The function
* will not add a new element if this
* is NULL.
*
* \see LL_shift()
*/
void LL_unshift( LinkedList list, void *pObj )
{
if( list == NULL || pObj == NULL )
return;
AssertValidPtr( list );
CHANGE_STATE(list);
(void) Insert( list, list->link.next, pObj );
}
/**
* Remove element from the start of a list.
*
* LL_shift() will remove the first element from a list.
* If the list contains only a single element, this is
* equivalent to calling LL_pop().
*
* \param list Handle to an existing linked list.
*
* \return Pointer to the object that was associated with
* the element removed from the list. If the list
* is empty, NULL will be returned.
*
* \see LL_unshift()
*/
void *LL_shift( LinkedList list )
{
if( list == NULL || list->size == 0 )
return NULL;
AssertValidPtr( list );
CHANGE_STATE(list);
return Extract( list, list->link.next );
}
/**
* Insert a new element into a list.
*
* Using LL_insert(), you can insert a new element at an
* arbitrary position in the list.
* If \a item is out of the valid range, the element will
* not be added.
*
* \param list Handle to an existing linked list.
*
* \param item Position where the new element should
* be inserted.\n
* A value of 0 will insert
* the new element at the start of the
* list, like LL_unshift() would do. A
* value of LL_count() would insert the
* element at the end of the list, like
* LL_push() would do. A negative value
* will count backwards from the end of
* the list. So a value of -1 would also
* add the new element to the end of the
* list.
*
* \param pObj Pointer to an object associated with
* the new list element. The function
* will not add a new element if this
* is NULL.
*
* \see LL_extract()
*/
void LL_insert( LinkedList list, int item, void *pObj )
{
Link *pLink;
if( list == NULL || pObj == NULL )
return;
AssertValidPtr( list );
CHANGE_STATE(list);
/*
* We have to do some faking here because adding to the end
* of the list is a more natural result for item == -1 than
* adding to the position _before_ the last element would be
*/
if( item < 0 )
pLink = item == -1 ? &list->link : GetLink( list, item+1 );
else
pLink = item == list->size ? &list->link : GetLink( list, item );
if( pLink == NULL )
return;
(void) Insert( list, pLink, pObj );
}
/**
* Extract an element from a list.
*
* LL_extract() will remove an arbitrary element from the
* list and return a pointer to the associated object.
*
* \param list Handle to an existing linked list.
*
* \param item Position of the element that should
* be extracted.\n
* A value of 0 will extract the first
* element, like LL_shift(). A negative
* value will count backwards from the
* end of the list. So a value of -1
* will extract the last element, which
* will be equivalent to LL_pop().
*
* \return Pointer to the object that was associated with
* the element removed from the list. If the list
* is empty or \a item is out of range, NULL will
* be returned.
*
* \see LL_insert()
*/
void *LL_extract( LinkedList list, int item )
{
Link *pLink;
if( list == NULL || list->size == 0 )
return NULL;
AssertValidPtr( list );
CHANGE_STATE(list);
pLink = GetLink( list, item );
if( pLink == NULL )
return NULL;
return Extract( list, pLink );
}
/**
* Get the element of a list.
*
* LL_get() will simply return a pointer to the object
* associated with a certain list element.
*
* \param list Handle to an existing linked list.
*
* \param item Position of the element. Negative
* positions count backwards from the
* end of the list, so -1 would refer
* to the last element.
*
* \return Pointer to the object that is associated with
* the element. If the list is empty or \a item
* is out of range, NULL will be returned.
*/
void *LL_get( ConstLinkedList list, int item )
{
Link *pLink;
if( list == NULL || list->size == 0 )
return NULL;
AssertValidPtr( list );
pLink = GetLink( (LinkedList) list, item );
return pLink ? pLink->pObj : NULL;
}
/**
* Perform different list transformations.
*
* LL_splice() can be used for a variety of list transformations
* and is similar to Perl's splice builtin. In brief,
* LL_splice() will extract \a length elements starting at
* \a offset from \a list, replace them by the elements in
* \a rlist and return a new list holding the extracted elements.
*
* \param list Handle to an existing linked list.
*
* \param offset Offset of the first element to extract.
* If negative, counts backwards from the
* end.
*
* \param length Length of the list to extract. If negative,
* all remaining elements will be extracted.
* If \a length is larger than the number of
* remaining elements, only the remaining
* elements will be extracted. If this is 0,
* no elements will be extracted. However,
* an empty list will still be returned.
*
* \param rlist List that will replace the extracted
* elements. If no elements were extracted,
* the elements of \a rlist will just be
* inserted at \a offset. If \a rlist is
* NULL, no replacement elements will be
* inserted. The list will be automatically
* destroyed after the elements have been
* inserted into \a list.
*
* \return Handle to a new list holding the extracted elements,
* if any. NULL if LL_splice() fails for some reason.
*/
LinkedList LL_splice( LinkedList list, int offset, int length, LinkedList rlist )
{
LinkedList nlist;
Link *pLink, *pLast;
if( list == NULL )
return NULL;
AssertValidPtr( list );
CHANGE_STATE(list);
pLink = offset == list->size ? &list->link : GetLink( list, offset );
if( pLink == NULL )
return NULL;
nlist = LL_new();
if( nlist == NULL )
return NULL;
if( length < 0 )
length = offset < 0 ? -offset : list->size - offset;
if( length > 0 ) {
pLast = pLink;
while( ++nlist->size < length && pLast->next->pObj )
pLast = pLast->next;
pLink->prev->next = pLast->next;
pLast->next->prev = pLink->prev;
nlist->link.next = pLink;
nlist->link.prev = pLast;
pLink->prev = &nlist->link;
pLink = pLast->next;
pLast->next = &nlist->link;
list->size -= nlist->size;
}
if( rlist ) {
pLast = pLink;
pLink = pLink->prev;
rlist->link.next->prev = pLink;
rlist->link.prev->next = pLast;
pLink->next = rlist->link.next;
pLast->prev = rlist->link.prev;
list->size += rlist->size;
Free( rlist );
}
return nlist;
}
/**
* Initialize list iterator.
*
* LI_init() will initialize a list iterator object.
* Keep in mind that modifying the list invalidates all
* list iterators.
*
* \param it Pointer to a list iterator object.
*
* \param list Handle to an existing linked list.
*
* \see LI_next(), LI_prev() and LI_curr()
*/
void LI_init(ListIterator *it, ConstLinkedList list)
{
it->list = list;
if (list)
{
AssertValidPtr(list);
it->cur = &list->link;
#ifdef DEBUG_UTIL_LIST
it->orig_state = list->state;
#endif
}
}
/**
* Move iterator to next list element.
*
* LI_next() will advance to the next element in the list.
*
* \param it Pointer to a list iterator object.
*
* \return Nonzero as long as the next element is valid,
* zero at the end of the list.
*
* \see LI_init(), LI_prev() and LI_curr()
*/
int LI_next(ListIterator *it)
{
if (it == NULL || it->list == NULL)
return 0;
AssertValidPtr(it->list);
#ifdef DEBUG_UTIL_LIST
assert(it->orig_state == it->list->state);
#endif
it->cur = it->cur->next;
return it->cur != &it->list->link;
}
/**
* Move iterator to previous list element.
*
* LI_prev() will advance to the previous element in the list.
*
* \param it Pointer to a list iterator object.
*
* \return Nonzero as long as the previous element is valid,
* zero at the beginning of the list.
*
* \see LI_init(), LI_next() and LI_curr()
*/
int LI_prev(ListIterator *it)
{
if (it == NULL || it->list == NULL)
return 0;
AssertValidPtr(it->list);
it->cur = it->cur->prev;
return it->cur != &it->list->link;
}
/**
* Return the object associated with the current list element.
*
* LI_curr() will return a pointer to the current object.
*
* \param it Pointer to a list iterator object.
*
* \return Pointer to the current object in the list.
*
* \see LI_init(), LI_next() and LI_prev()
*/
void *LI_curr(const ListIterator *it)
{
if (it == NULL || it->list == NULL)
return NULL;
AssertValidPtr(it->list);
return it->cur->pObj;
}
/**
* Sort list elements.
*
* LL_sort() will sort a list using a quicksort algorithm.
* The sorted list will be in ascending order.
*
* \param list Handle to an existing linked list.
*
* \param cmp Pointer to a comparison function.
* This function is called with a pair
* of pointers to objects in the list
* and must return
* - a negative value if the first
* argument is less than the second
* - a positive value if the first
* argument is greater than the second
* - zero if the first both arguments
* are considered to be equal
*/
void LL_sort( LinkedList list, LLCompareFunc cmp )
{
if( list == NULL || list->size <= 1 )
return;
AssertValidPtr( list );
QuickSort( list->link.next, list->link.prev, list->size, cmp );
}
| 23.864327 | 81 | 0.570427 | [
"object"
] |
50976fdf04daffff4b2bc90cb18cae4b4eeb9696 | 2,476 | h | C | src/rearrange_wavedec2.h | ludwigschmidt/tree_approx | 7e427e75a1d2a4f8e16de996d294893ae68c0685 | [
"MIT"
] | 2 | 2015-09-26T02:37:21.000Z | 2021-03-18T19:49:56.000Z | src/rearrange_wavedec2.h | ludwigschmidt/tree_approx | 7e427e75a1d2a4f8e16de996d294893ae68c0685 | [
"MIT"
] | null | null | null | src/rearrange_wavedec2.h | ludwigschmidt/tree_approx | 7e427e75a1d2a4f8e16de996d294893ae68c0685 | [
"MIT"
] | 6 | 2015-09-03T06:38:10.000Z | 2021-03-18T21:46:21.000Z | #ifndef __REARRANGE_WAVEDEC2_H__
#define __REARRANGE_WAVEDEC2_H__
#include <algorithm>
#include <cstdio>
#include <vector>
namespace treeapprox {
// returns two arrays for rearranging data from Matlab.
// when the data is rearranged via data[ii] = data_matlab[forward[ii]],
// the following properties hold:
// - the root is at index 0
// - the children of node x are at indices 4 * x, ..., 4 * x + 3 (for x != 0)
bool rearrange_wavedec2(size_t n,
std::vector<size_t>* forward,
std::vector<size_t>* backward) {
// check if n is a power of 4
size_t tmp = 1;
size_t num_levels = 1;
while (tmp < n) {
tmp *= 4;
num_levels += 1;
}
if (tmp != n) {
return false;
}
if (forward != NULL) {
forward->resize(n);
}
if (backward != NULL) {
backward->resize(n);
}
size_t num_identity = std::min(n, 16ul);
for (size_t ii = 0; ii < num_identity; ++ii) {
if (forward != NULL) {
(*forward)[ii] = ii;
}
if (backward != NULL) {
(*backward)[ii] = ii;
}
}
// we process the four children of node ii
size_t ii = 4;
size_t anchor = ii;
size_t next_anchor = anchor * 4;
size_t block_edge = 2;
size_t ichild = 0;
for (size_t ilevel = 2; ilevel < num_levels - 1; ++ilevel) {
for (size_t iblock = 0; iblock < 3; ++iblock) {
anchor = ii;
next_anchor = anchor * 4;
for (size_t x_offset = 0; x_offset < block_edge; ++x_offset) {
for (size_t y_offset = 0; y_offset < block_edge; ++y_offset) {
ichild = next_anchor + x_offset * 2 * (2 * block_edge) + 2 * y_offset;
if (forward != NULL) {
(*forward)[4 * ii] = ichild;
ichild += 1;
(*forward)[4 * ii + 1] = ichild;
ichild = ichild - 1 + (2 * block_edge);
(*forward)[4 * ii + 2] = ichild;
ichild += 1;
(*forward)[4 * ii + 3] = ichild;
}
ichild = next_anchor + x_offset * 2 * (2 * block_edge) + 2 * y_offset;
if (backward != NULL) {
(*backward)[ichild] = 4 * ii;
ichild += 1;
(*backward)[ichild] = 4 * ii + 1;
ichild = ichild - 1 + (2 * block_edge);
(*backward)[ichild] = 4 * ii + 2;
ichild += 1;
(*backward)[ichild] = 4 * ii + 3;
}
ii += 1;
}
}
}
block_edge *= 2;
}
return true;
}
}; // namespace treeapprox
#endif
| 26.340426 | 80 | 0.523425 | [
"vector"
] |
5097e3f5643f4e2e289bc65a2563ae02d7add1b0 | 9,673 | h | C | bkfdd/bkfddInt.h | XuanxiangHuang/bkfdd-1.0 | c8dfab1925cb4cb24b3f470702e83afe2fc4762a | [
"BSD-3-Clause"
] | 4 | 2021-01-10T16:52:55.000Z | 2022-03-15T07:13:07.000Z | bkfdd/bkfddInt.h | XuanxiangHuang/bkfdd-CUDD | 3e54abf5a71a06247063ad6be23657f1db99c09e | [
"BSD-3-Clause"
] | null | null | null | bkfdd/bkfddInt.h | XuanxiangHuang/bkfdd-CUDD | 3e54abf5a71a06247063ad6be23657f1db99c09e | [
"BSD-3-Clause"
] | null | null | null | /**
@file
@ingroup bkfdd
@brief Internal Functions of the BKFDD part.
@author Xuanxiang Huang
@copyright
Copyright (c) 2019-, Jinan University, Guangzhou, China.
All rights reserved.
======================================================================
All BKFDD's Functions are originated from CUDD's Functions.
======================================================================
**********************************************************************
@copyright@parblock
Copyright (c) 1995-2015, Regents of the University of Colorado
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University of Colorado nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
@endparblock
**********************************************************************
*/
#ifndef BKFDD_INT_H
#define BKFDD_INT_H
#include "cuddInt.h"
/* bkfdd expansion(decomposition) types */
// classical expansion
#define CS 1
#define CPD 2
#define CND 3
// biconditional expansion
#define BS 4
#define BPD 5
#define BND 6
// max number of davio expansions allowed to exist.
#define DAVIO_EXIST_BOUND 250
/* bkfdd mode */
#define MODE_SND 0 // only S and ND are introduced during building.
#define MODE_SD 1 // all expansions are introduced during building.
#define GROUP_SIZE 4 // maximum size of variable group
/* BKFDD check function type */
typedef int (*BKFDD_CHKFP)(DdManager *, int, int);
/*
In BKFDD'theory, the only terminal is logic 0, and low-edge must be regular.
To compatible with CUDD's implementation, the auxiliary
function of variable changed from 0 to 1, and terminal from logic 0 to logic 1.
These changes make strucure of BDD nodes and FDD nodes different from the BKFDD's theory.
For BDD node, we have (pv, aux_1, 1, 0), i.e. auxiliary function equal to 1,
and low terminal is 1, high terminal is 0.
CS: (x equiv. 1)*f_1 + !(x equiv. 1)*f_0
ND: f_1 xor !(x equiv. 1)*f_2
PD: f_0 xor (x equiv. 1)*f_2
where f_2 = f_1 xor f_0.
BS: (x equiv. y)*f_x=y + !(x equiv. y)*f_x=!y
BND: f_x=y + !(x equiv. y)*f_xor
BPD: f_x=!y + (x equiv. y)*f_xor
where f_xor = f_x=y xor f_x=!y.
Besides, there is a easy way to transform CUDD's BDD to BKFDD,
1. group sifting.
2. linear combine: BDD => BiDD
3. change expansion type: BiDD => BKFDD
*/
/* Functions of Kronecker functional decision diagrams(KFDDs).
based on paper "Ordered Kronecker Function Decision Diagrams--
A Data Structure for Representation and Manipulation of Boolean Functions"
author: Rolf Drechsler and Bernd Becker
The puma(KFDDs package) seems too diffcult to use, it is somewhat out-of-date.
===============================================================================
Functions of Biconditional binary decision diagrams(BBDDs).
based on paper "Biconditional Binary Decision Diagrams:
A Novel Canonical Logic Representation Form"
author: Luca Amaru, Pierre-Emmanuel Gaillardon, and Giovanni De Micheli
BBDD package(EPFL) is not highly optimized, but CUDD is.
And actually BBDD can be implemented by CUDD's tenique, like symmetric checking,
group-sifting, linear combination.
===============================================================================
Functions of Bi-Kronecker functional decision diagrams(BKFDDs).
based on paper "Bi-Kronecker Functional Decision Diagrams:
A Novel Canonical Representation of Boolean Functions"
author: Xuanxiang Huang, Kehang Fang, Liangda Fang, Qingliang Chen, etc.
email: cshxx@stu2016.edu.jnu.cn
*/
/*
===============================================================================
NOTE: if pD introduced to BKFDDs, vars[index]->ref is unpredictable,
one should use Cudd_Regular(vars[index]->ref) instead. Since
vars array may contain variables decomposed by pD, and these variables
are complemented.
===============================================================================
*/
/**
@brief Check expansion types
@detail Check given expansion type, is it classical-expansion,
biconditional-expansion, shannon-like expansion, or davio-like expansion.
return 1 if success, otherwise return 0.
*/
inline static int
isCla(int expn)
{
if (expn == CS) { return(1); }
if (expn == CND) { return(1); }
if (expn == CPD) { return(1); }
return(0);
}
inline static int
isBi(int expn)
{
if (expn == BS) { return(1); }
if (expn == BND) { return(1); }
if (expn == BPD) { return(1); }
return(0);
}
inline static int
isShan(int expn)
{
if (expn == CS) { return(1); }
if (expn == BS) { return(1); }
return(0);
}
inline static int
isNDavio(int expn)
{
if (expn == CND) { return(1); }
if (expn == BND) { return(1); }
return(0);
}
inline static int
isPDavio(int expn)
{
if (expn == CPD) { return(1); }
if (expn == BPD) { return(1); }
return(0);
}
/** bkfddTable.c */
/* Inner find or add nodes to unique table. */
extern DdNode * cuddUniqueInter_Inner(DdManager *unique, int index, DdNode *T, DdNode *E);
extern void garbageCollectSimple(DdManager * unique, int level);
/** bkfddCache.c */
/* Inner Cache lookups used in BKFDD. */
extern DdNode * cuddCacheLookup_Inner(DdManager *table, ptruint op, DdNode *f, DdNode *g, DdNode *h);
extern DdNode * cuddCacheLookup1_Inner(DdManager *table, DdNode * (*)(DdManager *, DdNode *), DdNode *f);
extern DdNode * cuddCacheLookup2_Inner(DdManager *table, DdNode * (*)(DdManager *, DdNode *, DdNode *), DdNode *f, DdNode *g);
/** bkfddIte.c */
/* Boolean operation. */
extern DdNode * Bkfdd_Ite(DdManager * dd, DdNode * f, DdNode * g, DdNode * h);
extern DdNode * Bkfdd_And(DdManager * dd, DdNode * f, DdNode * g);
extern DdNode * Bkfdd_Or(DdManager * dd, DdNode * f, DdNode * g);
extern DdNode * Bkfdd_Xor(DdManager * dd, DdNode * f, DdNode * g);
extern DdNode * BkfddAndRecur(DdManager *manager, DdNode *f, DdNode *g);
extern DdNode * BkfddXorRecur(DdManager *manager, DdNode *f, DdNode *g);
extern DdNode * BkfddIteRecur(DdManager * dd, DdNode * f, DdNode * g, DdNode * h);
/* Inner Boolean operation, used in expansion-types-change procedures. */
extern DdNode * BkfddAndRecur_Inner(DdManager *manager, DdNode *f, DdNode *g);
extern DdNode * BkfddXorRecur_Inner(DdManager *manager, DdNode *f, DdNode *g);
extern DdNode * BkfddIteRecur_Inner(DdManager * dd, DdNode * f, DdNode * g, DdNode * h);
/** bkfddChangeExpn.c */
/* Change expansion types. */
extern int changeExpnBetweenSND(DdManager * dd, int level);
extern int changeExpnBetweenNDPD(DdManager * dd, int level);
extern int changeExpnPDtoS(DdManager * dd, int level);
extern int changeExpnStoPD(DdManager * dd, int level);
extern int changeExpnBetweenBiCla(DdManager * dd, int level);
/** bkfddVarSwap.c */
/* Swap two adjacent variables with different expansions. */
extern int BkfddSwapInPlace(DdManager *table, int x, int y);
extern int NaiveSwap(DdManager *table, int x, int y);
/** bkfddGroup.c */
/* BKFDD, KFDD group sifting. */
extern int bkfddSymmSifting(DdManager * table, int lower, int upper);
extern int bkfddGroupSifting(DdManager * table, int lower, int upper, BKFDD_CHKFP checkFunction);
extern int bkfddGroupSifting_noMerge(DdManager * table, int lower, int upper);
extern int bkfddExtSymmCheck1(DdManager *table, int x, int y);
extern int bkfddExtSymmCheck2(DdManager *table, int x, int y);
/** bkfddSifting.c */
/* BKFDD oet sifting */
extern int oetSifting(DdManager * table, int lower, int upper);
/** bkfddTransform.c */
/* Choose Better expansions type. */
extern int chooseSND2(DdManager * table);
extern int chooseSND4(DdManager * table);
//extern int chooseBetterBiDD(DdManager * table);
extern int chooseSD3(DdManager * table);
extern int chooseSD6(DdManager * table);
extern int chooseSD3_restricted(DdManager * table);
extern int chooseSD6_restricted(DdManager * table);
//extern int bkfddTobdd(DdManager * table);
/** bkfddDump.c*/
/* Dump BKFDD to BLIF file. */
extern int Bkfdd_DumpBlif(DdManager * dd, int n, DdNode ** f, char const * const * inames, char const * const * onames, char * mname, FILE * fp);
extern int Bkfdd_DumpBlifBody(DdManager * dd, int n, DdNode ** f, char const * const * inames, char const * const * onames, FILE * fp);
/** bkfddChainReduction.c */
/* BKFDD chain reduction detection. */
extern int Bkfdd_RC_Detection(DdManager * table, int * detected, int * reduced);
#endif /** BKFDD_INT_H */
| 37.203846 | 145 | 0.684172 | [
"transform"
] |
509ae6b360234634eae83c9ccecf4d618d8b4034 | 1,101 | h | C | cxx_pubsub/LibKN/ComCe.2k/StdAfx.h | kragen/mod_pubsub | 9abcdb07b02b7979bf4538ac8047783100ecb7bc | [
"BSD-3-Clause-Clear"
] | 1 | 2021-04-05T14:53:29.000Z | 2021-04-05T14:53:29.000Z | cxx_pubsub/LibKN/ComCe/StdAfx.h | kragen/mod_pubsub | 9abcdb07b02b7979bf4538ac8047783100ecb7bc | [
"BSD-3-Clause-Clear"
] | null | null | null | cxx_pubsub/LibKN/ComCe/StdAfx.h | kragen/mod_pubsub | 9abcdb07b02b7979bf4538ac8047783100ecb7bc | [
"BSD-3-Clause-Clear"
] | 1 | 2021-04-05T14:53:41.000Z | 2021-04-05T14:53:41.000Z | // stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#if !defined(AFX_STDAFX_H__20F891EA_BE6E_4917_ADF6_FBF9CE402065__INCLUDED_)
#define AFX_STDAFX_H__20F891EA_BE6E_4917_ADF6_FBF9CE402065__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#ifndef STRICT
#define STRICT
#endif
#if _WIN32_WCE == 201
#error ATL is not supported for Palm-Size PC
#endif
#define _WIN32_WINNT 0x0400
#define _ATL_FREE_THREADED
#if defined(_WIN32_WCE)
#undef _WIN32_WINNT
#endif
#include <atlbase.h>
//You may derive a class from CComModule and use it if you want to override
//something, but do not change the name of _Module
extern CComModule _Module;
#include <atlcom.h>
#include <atlctl.h>
#include <wininet.h>
#include <vector>
using ::vector;
//{{AFX_INSERT_LOCATION}}
// Microsoft eMbedded Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__20F891EA_BE6E_4917_ADF6_FBF9CE402065__INCLUDED)
| 23.934783 | 106 | 0.776567 | [
"vector"
] |
50a5568e6092009558f5a54ba45cedeca693053a | 4,103 | h | C | src/sdbwinapi/sdb_api_instance.h | TizenTeam/sdb | b7954d2a3c580003aadc589d2a5082a87ac5af0f | [
"Apache-2.0"
] | 4 | 2017-01-28T15:38:20.000Z | 2020-10-16T11:23:55.000Z | src/sdbwinapi/sdb_api_instance.h | TizenTeam/sdb | b7954d2a3c580003aadc589d2a5082a87ac5af0f | [
"Apache-2.0"
] | 1 | 2021-04-26T08:26:17.000Z | 2021-04-26T08:46:47.000Z | src/sdbwinapi/sdb_api_instance.h | TizenTeam/sdb | b7954d2a3c580003aadc589d2a5082a87ac5af0f | [
"Apache-2.0"
] | 3 | 2017-12-14T20:11:53.000Z | 2021-11-03T23:45:04.000Z | /*
* Copyright (C) 2006 The Android Open Source Project
*
* 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 ANDROID_USB_API_SDB_API_INSTANCE_H__
#define ANDROID_USB_API_SDB_API_INSTANCE_H__
/** \file
This file consists of declaration of class SdbApiInstance that is a main
API object representing a device interface that is in the interest of
the API client. All device (interface) related operations go through this
class first.
*/
#include "sdb_api.h"
#include "sdb_api_private_defines.h"
/** Class SdbApiInstance is the main API interbal object representing a device
interface that is in the interest of the API client. All device (interface)
related operations go through this class first. So, before doing anything
meaningfull with the API a client must first create instance of the API
via CreateSdbApiInstance, select a device interface for that instance and
then do everything else.
Objects of this class are globally stored in the map that matches
SDBAPIINSTANCEHANDLE to the corresponded object.
This class is self-referenced with the following reference model:
1. When object of this class is created and added to the map, its recount
is set to 1.
2. Every time the client makes an API call that uses SDBAPIINSTANCEHANDLE
a corresponded SdbApiInstance object is looked up in the table and its
refcount is incremented. Upon return from the API call that incremented
the refcount refcount gets decremented.
3. When the client closes SDBAPIINSTANCEHANDLE via DeleteSdbApiInstance call
corresponded object gets deleted from the map and its refcount is
decremented.
So, at the end, this object destroys itself when refcount drops to zero.
*/
class SdbApiInstance {
public:
/** \brief Constructs the object
@param handle[in] Instance handle associated with this object
*/
SdbApiInstance();
private:
/// Destructs the object
~SdbApiInstance();
/** \brief
This method is called when last reference to this object has been released
In this method object is uninitialized and deleted (that is "delete this"
is called).
*/
void LastReferenceReleased();
public:
/// Gets name of the USB interface (device name) for this instance
const std::wstring& interface_name() const {
return interface_name_;
}
/// References the object and returns number of references
LONG AddRef() {
return InterlockedIncrement(&ref_count_);
}
/** \brief Dereferences the object and returns number of references
Object may be deleted in this method, so you cannot touch it after
this method returns, even if returned value is not zero, because object
can be deleted in another thread.
*/
LONG Release() {
LONG ret = InterlockedDecrement(&ref_count_);
if (0 == ret)
LastReferenceReleased();
return ret;
}
/// Checks if instance has been initialized
bool IsInitialized() const {
return !interface_name_.empty();
}
private:
/// Name of the USB interface (device name) for this instance
std::wstring interface_name_;
/// Instance handle for this object
SDBAPIINSTANCEHANDLE instance_handle_;
/// Reference counter for this instance
LONG ref_count_;
};
/// Defines map that matches SDBAPIINSTANCEHANDLE with SdbApiInstance object
typedef std::map< SDBAPIINSTANCEHANDLE, SdbApiInstance* > SdbApiInstanceMap;
#endif // ANDROID_USB_API_SDB_API_INSTANCE_H__
| 35.991228 | 79 | 0.720936 | [
"object",
"model"
] |
50a6c96b75d876b5eb60d3ad2f4c26276ab80c26 | 4,000 | h | C | orcm/test/mca/sensor/ipmi_ts/mockTest.h | ctrlsys/sensys | 58221bca169c95c300ecc5526aa00590f0ce5c2f | [
"BSD-3-Clause-Open-MPI"
] | 14 | 2016-09-06T17:02:20.000Z | 2020-03-30T14:34:59.000Z | orcm/test/mca/sensor/ipmi_ts/mockTest.h | ctrlsys/sensys | 58221bca169c95c300ecc5526aa00590f0ce5c2f | [
"BSD-3-Clause-Open-MPI"
] | 9 | 2017-04-25T20:45:11.000Z | 2017-07-20T14:58:03.000Z | orcm/test/mca/sensor/ipmi_ts/mockTest.h | ctrlsys/sensys | 58221bca169c95c300ecc5526aa00590f0ce5c2f | [
"BSD-3-Clause-Open-MPI"
] | 5 | 2016-10-11T03:28:26.000Z | 2019-07-31T00:36:02.000Z | /*
* Copyright (c) 2016 Intel Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef MOCK_IPMI_TS_FACTORY_TESTS_H
#define MOCK_IPMI_TS_FACTORY_TESTS_H
#include <iostream>
#include <stdexcept>
#include <dirent.h>
#include "orcm/common/dataContainerHelper.hpp"
#include "orcm/mca/sensor/ipmi_ts/ipmiSensorInterface.h"
typedef ipmiSensorInterface* (*sensorInstance)(std::string);
bool mock_plugin;
bool mock_do_collect;
bool mock_opal_pack;
bool mock_opal_unpack;
bool mock_analytics_base_send_data;
bool mock_serializeMap;
bool mock_deserializeMap;
bool do_collect_expected_value;
bool opal_pack_expected_value;
bool opal_secpack_expected_value;
bool opal_unpack_expected_value;
bool throwOnInit;
bool throwOnSample;
bool dlopenReturnHandler;
bool getPluginNameMock;
bool initPluginMock;
bool emptyContainer;
int n_mocked_plugins;
int n_opal_calls;
extern "C" {
#include "orte/include/orte/types.h"
#include "orcm/mca/analytics/analytics_types.h"
extern bool __real_orcm_sensor_base_runtime_metrics_do_collect(void*, const char*);
extern void __real__ZN19dataContainerHelper12serializeMapERSt3mapISs13dataContainerSt4lessISsESaISt4pairIKSsS1_EEEPv(dataContainerMap &cntMap, void* buffer);
extern void __real__ZN19dataContainerHelper14deserializeMapERSt3mapISs13dataContainerSt4lessISsESaISt4pairIKSsS1_EEEPv(dataContainerMap &cntMap, void* buffer);
extern int __real_opal_dss_pack(opal_buffer_t* buffer, const void* src, int32_t num_vals, opal_data_type_t type);
extern int __real_opal_dss_unpack(opal_buffer_t* buffer, void* dst, int32_t* num_vals, opal_data_type_t type);
bool __wrap_orcm_sensor_base_runtime_metrics_do_collect(void* runtime_metrics, const char* sensor_spec){
if (mock_do_collect) {
return do_collect_expected_value;
}
return __real_orcm_sensor_base_runtime_metrics_do_collect(runtime_metrics, sensor_spec);
}
int __wrap_opal_dss_pack(opal_buffer_t* buffer, const void* src, int32_t num_vals, opal_data_type_t type) {
if(mock_opal_pack) {
if(n_opal_calls == 0) {
n_opal_calls++;
return opal_pack_expected_value;
} else
return opal_secpack_expected_value;
} else {
__real_opal_dss_pack(buffer, src, num_vals, type);
}
}
int __wrap_opal_dss_unpack(opal_buffer_t* buffer, void* dst, int32_t* num_vals, opal_data_type_t type) {
if(mock_opal_unpack) {
return opal_unpack_expected_value;
} else {
__real_opal_dss_unpack(buffer, dst, num_vals, type);
}
}
void __wrap_orcm_analytics_base_send_data(orcm_analytics_value_t *data){
/*Dummy function*/
}
/* C++ dataContainerHelperSerializeMap object symbols */
void __wrap__ZN19dataContainerHelper12serializeMapERSt3mapISs13dataContainerSt4lessISsESaISt4pairIKSsS1_EEEPv(dataContainerMap &cntMap, void* buffer) {
if(mock_serializeMap){
throw ErrOpal("Failing on mockSerializeMap", -1);
} else {
__real__ZN19dataContainerHelper12serializeMapERSt3mapISs13dataContainerSt4lessISsESaISt4pairIKSsS1_EEEPv(cntMap, buffer);
}
}
/* C++ dataContainerHelperDeserializeMap object symbols */
void __wrap__ZN19dataContainerHelper14deserializeMapERSt3mapISs13dataContainerSt4lessISsESaISt4pairIKSsS1_EEEPv(dataContainerMap &cntMap, void* buffer) {
if(mock_deserializeMap){
throw ErrOpal("Failing on mockDeSerializeMap", -1);
} else {
__real__ZN19dataContainerHelper14deserializeMapERSt3mapISs13dataContainerSt4lessISsESaISt4pairIKSsS1_EEEPv(cntMap, buffer);
}
}
}
typedef int (*opal_dss_pack_fn_t)(opal_buffer_t* buffer, const void* src, int32_t num_vals, opal_data_type_t type);
typedef int (*opal_dss_unpack_fn_t)(opal_buffer_t* buffer, void* dst, int32_t* num_vals, opal_data_type_t type);
#endif
| 38.461538 | 163 | 0.75825 | [
"object"
] |
50b289d4b8f27dd21e101626c13d0a7828ba55d6 | 5,985 | h | C | src/fcgi_cmds.h | rodrigue10/ciyam | 80fa33c3e58eb17f508100e2d1d04081f6a00418 | [
"MIT"
] | null | null | null | src/fcgi_cmds.h | rodrigue10/ciyam | 80fa33c3e58eb17f508100e2d1d04081f6a00418 | [
"MIT"
] | null | null | null | src/fcgi_cmds.h | rodrigue10/ciyam | 80fa33c3e58eb17f508100e2d1d04081f6a00418 | [
"MIT"
] | null | null | null | // Copyright (c) 2011-2012 CIYAM Pty. Ltd. ACN 093 704 539
// Copyright (c) 2012-2022 CIYAM Developers
//
// Distributed under the MIT/X11 software license, please refer to the file license.txt
// in the root project directory or http://www.opensource.org/licenses/mit-license.php.
#ifndef FCGI_CMDS_H
# define FCGI_CMDS_H
# ifndef HAS_PRECOMPILED_STD_HEADERS
# include <map>
# include <set>
# include <string>
# include <vector>
# include <utility>
# endif
# include "fcgi_info.h"
class tcp_socket;
void read_module_strings( module_info& info, tcp_socket& socket );
bool simple_command( session_info& sess_info, const std::string& cmd, std::string* p_response = 0 );
bool perform_update( const std::string& module, const std::string& class_id,
const std::string& key, const std::vector< std::pair< std::string, std::string > >& field_value_pairs,
const session_info& sess_info, std::string* p_error_message = 0, std::string* p_fields_and_values_prefix = 0 );
bool perform_update( const std::string& module,
const std::string& class_id, const std::string& key, const std::string& field,
const std::string& old_value, const std::string& new_value, const session_info& sess_info, std::string& error );
bool perform_action( const std::string& module_name,
const std::string& class_id, const std::string& act, const std::string& app,
const std::string& field, const std::string& fieldlist, const std::string& exec,
const std::string& extra, row_error_container& row_errors, const session_info& sess_info );
bool fetch_item_info( const std::string& module, const module_info& mod_info,
const std::string& class_id, const std::string& item_key, const std::string& field_list,
const std::string& set_field_values, const std::string& query_info, const session_info& sess_info,
std::pair< std::string, std::string >& item_info, const std::string* p_owner = 0, const std::string* p_pdf_spec_name = 0,
const std::string* p_pdf_title = 0, const std::string* p_pdf_link_filename = 0, std::string* p_pdf_view_file_name = 0,
const std::map< std::string, std::string >* p_vext_items = 0 );
bool fetch_list_info( const std::string& module,
const module_info& mod_info, const std::string& class_id, const session_info& sess_info,
bool is_reverse, int row_limit, const std::string& key_info, const std::string& field_list,
const std::string& filters, const std::string& search_text, const std::string& search_query,
const std::string& set_field_values, data_container& rows,
const std::string& exclude_key, bool* p_prev = 0, std::string* p_perms = 0,
const std::string* p_security_info = 0, const std::string* p_extra_debug = 0,
const std::set< std::string >* p_exclude_keys = 0, const std::string* p_pdf_spec_name = 0,
const std::string* p_pdf_link_filename = 0, std::string* p_pdf_view_file_name = 0,
bool* p_can_delete_any = 0, bool is_printable = false );
bool fetch_parent_row_data( const std::string& module, const module_info& mod_info,
const std::string& record_key, const std::string& field_id, const std::string& pclass_id,
const std::string& parent_field, const std::string& parent_extras,
const session_info& sess_info, const std::string& parent_key, data_container& parent_row_data,
const values* p_key_values = 0, const values* p_fkey_values = 0, const values* p_skey_values = 0,
bool *p_has_view_id = 0, const std::set< std::string >* p_exclude_keys = 0, std::string* p_skey_required = 0 );
bool populate_list_info( list_source& list,
const std::map< std::string, std::string >& list_selections,
const std::map< std::string, std::string >& list_search_text,
const std::map< std::string, std::string >& list_search_values,
const std::string& listinfo, const std::string& listsort, const std::string& parent_key, bool is_printable,
const view_source* p_view, const std::string& view_pfield, const std::set< std::string >* p_specials,
const session_info& sess_info, const std::string* p_pdf_spec_name = 0, const std::string* p_pdf_link_filename = 0,
std::string* p_pdf_view_file_name = 0 );
void fetch_sys_record( const std::string& module_id, const module_info& mod_info, session_info& sess_info );
bool fetch_user_record( const std::string& gid,
const std::string& module_id, const std::string& module_name,
const module_info& mod_info, session_info& sess_info, bool is_authorised,
bool check_password, std::string& username, const std::string& userhash,
const std::string& password, const std::string& unique_data );
void fetch_user_quick_links( const module_info& mod_info, session_info& sess_info );
void add_user( const std::string& user_id, const std::string& user_name,
const std::string& email, const std::string& clone_key, const std::string& password,
std::string& error_message, const module_info& mod_info, session_info& sess_info,
std::string* p_new_key = 0, bool active = true, const std::string* p_gpg_key_file = 0 );
void add_quick_link( const std::string& module_ref,
const std::string& cmd, const std::string& data, const std::string& extra,
const std::string& listsrch, const std::string& listsort, const std::string& oident,
const std::string& uselect, std::string& error_message, bool& had_send_or_recv_error,
const module_info& mod_info, session_info& sess_info, const std::map< std::string, std::string >* p_list_selections = 0 );
void save_record( const std::string& module_id,
const std::string& flags, const std::string& app, const std::string& chk,
const std::string& field, const std::string& extra, const std::string& exec, const std::string& cont,
const std::string& fieldlist, bool is_new_record, const std::map< std::string, std::string >& new_field_and_values,
const std::map< std::string, std::string >& extra_field_info, view_info_const_iterator& vici,
const view_source& view, int vtab_num, session_info& sess_info, std::string& act, std::string& data,
std::string& new_key, std::string& error_message, bool& was_invalid, bool& had_send_or_recv_error );
#endif
| 58.106796 | 123 | 0.75188 | [
"vector"
] |
50b7d0f685b5071584e2bf53e405c46d8d6cbc0b | 481 | h | C | cs6375-machine-learning/homework2/homework2/NaiveBayesClassifier.h | gsteelman/utd | 65bf3b81b7a089612f6c7546aa0bbdfbdcdb334e | [
"Apache-2.0"
] | 3 | 2017-03-17T15:15:11.000Z | 2020-10-01T16:05:17.000Z | cs6375-machine-learning/homework2/homework2/NaiveBayesClassifier.h | gsteelman/utd | 65bf3b81b7a089612f6c7546aa0bbdfbdcdb334e | [
"Apache-2.0"
] | null | null | null | cs6375-machine-learning/homework2/homework2/NaiveBayesClassifier.h | gsteelman/utd | 65bf3b81b7a089612f6c7546aa0bbdfbdcdb334e | [
"Apache-2.0"
] | 7 | 2016-02-07T22:56:26.000Z | 2021-02-26T02:50:28.000Z | #ifndef NAIVE_BAYES_CLASSIFIER_H
#define NAIVE_BAYES_CLASSIFIER_H
#include <map>
#include <vector>
#include <string>
#include "DataSet.h"
#include "Document.h"
#include "Classifier.h"
using namespace std;
class NaiveBayesClassifier : public Classifier {
public:
void train( const DataSet& data );
float test( const DataSet& data );
unsigned int classify( const Document& doc );
protected:
vector<float> m_prior;
map<string, vector<float> > m_condProb;
};
#endif
| 19.24 | 49 | 0.740125 | [
"vector"
] |
50c089cb9260bb1d5f4332e161ab29b9b13c25cf | 2,251 | h | C | knowledgebase_creator/include/gui/SettingsDialog.h | StephanOpfer/symrock | 519f684374124707f684edceb9b53156fe3bafbc | [
"MIT"
] | 1 | 2018-12-04T16:16:41.000Z | 2018-12-04T16:16:41.000Z | knowledgebase_creator/include/gui/SettingsDialog.h | carpe-noctem-cassel/symrock | 519f684374124707f684edceb9b53156fe3bafbc | [
"MIT"
] | 2 | 2019-02-28T10:44:06.000Z | 2019-03-28T12:31:01.000Z | knowledgebase_creator/include/gui/SettingsDialog.h | carpe-noctem-cassel/symrock | 519f684374124707f684edceb9b53156fe3bafbc | [
"MIT"
] | null | null | null | /*
* SettingsDialog.h
*
* Created on: Jan 17, 2017
* Author: stefan
*/
#ifndef INCLUDE_SETTINGSDIALOG_H_
#define INCLUDE_SETTINGSDIALOG_H_
#include <QDialog>
#include <QtGui>
#include <QListWidget>
#include <string>
#include <memory>
namespace Ui
{
class SettingsDialog;
}
namespace kbcr
{
class SolverSettings;
class KnowledgebaseCreator;
/**
* Handler for setting ui
*/
class SettingsDialog : public QDialog
{
Q_OBJECT
public:
/**
* Constructor
*/
SettingsDialog(QWidget *parent = 0, KnowledgebaseCreator* gui = 0);
/**
* Destructor
*/
virtual ~SettingsDialog();
/**
* Get Pointer to Settings Dialog
*/
Ui::SettingsDialog* getUi();
/**
* Returns shared_ptr to default settings "Default", "clingo, -W, no-atom-undefined, --number=1"
*/
std::shared_ptr<SolverSettings> getDefaultSettings();
private slots:
/**
* Fills settings label with settings given by selected settings item
*/
void fillSettingsLabel(QListWidgetItem * item);
/**
* return settings to the main gui
*/
void applySettings();
/**
* Ok btn callback
*/
void onAddBtn();
/**
* remove btn callback
*/
void onRemoveBth();
private:
/**
* loads settings from json congfig file
*/
void loadSettingsFromConfig();
/**
* fill settings table with list items
*/
void fillSettingsList();
/**
* save settings to json file
*/
void writeSettings();
/**
* Connect every gui element
*/
void connectElements();
/**
* Pointer to file containing solver settings
*/
QFile* settingsFile;
/**
* Default settings "Default", "clingo, -W, no-atom-undefined, --number=1"
*/
std::shared_ptr<SolverSettings> defaultSettings;
/**
* Pointer to Settings Dialog
*/
Ui::SettingsDialog* ui;
/**
* Pointer to main gui
*/
KnowledgebaseCreator* mainGui;
/**
* Current settings pointer
*/
std::shared_ptr<SolverSettings> currentSettings;
/**
* List of Parameter names show in dialog
*/
std::shared_ptr<std::vector<std::string>> parameterSectionNames;
/**
* Mapping of names to settings
*/
std::map<std::string, std::shared_ptr<SolverSettings>> parameterMap;
};
}
#endif /* INCLUDE_SETTINGSDIALOG_H_ */
| 19.239316 | 98 | 0.655709 | [
"vector"
] |
f8832eedeb1855f919a1d6b6515579f5f9ce14bc | 3,765 | h | C | DQMServices/StreamerIO/plugins/TriggerSelector.h | NTrevisani/cmssw | a212a27526f34eb9507cf8b875c93896e6544781 | [
"Apache-2.0"
] | 1 | 2018-07-25T03:57:34.000Z | 2018-07-25T03:57:34.000Z | DQMServices/StreamerIO/plugins/TriggerSelector.h | NTrevisani/cmssw | a212a27526f34eb9507cf8b875c93896e6544781 | [
"Apache-2.0"
] | 7 | 2016-07-17T02:34:54.000Z | 2019-08-13T07:58:37.000Z | DQMServices/StreamerIO/plugins/TriggerSelector.h | NTrevisani/cmssw | a212a27526f34eb9507cf8b875c93896e6544781 | [
"Apache-2.0"
] | 2 | 2019-09-27T08:33:22.000Z | 2019-11-14T10:52:30.000Z | #ifndef DQMServices_StreamerIO_TriggerSelector_h
#define DQMServices_StreamerIO_TriggerSelector_h
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/Common/interface/HLTPathStatus.h"
#include "DataFormats/Common/interface/TriggerResults.h"
#include "DataFormats/Provenance/interface/ParameterSetID.h"
#include "FWCore/Framework/interface/EventSelector.h"
#include "boost/shared_ptr.hpp"
#include <vector>
#include <string>
namespace dqmservices {
/**
* Event selector allowing for and/not combination of triggers/paths
*
*/
class TriggerSelector {
public:
typedef std::vector<std::string> Strings;
/**
* Obsolete: Initializes TriggerSelector to use edm::EventSelector for
* selection.
*/
TriggerSelector(Strings const& pathspecs, Strings const& names);
/**
* Takes ParameterSet wth TriggerSelector string or EventSelection list, and a
* list of triggers.
* if old_ is true, it is forced to use EventSelection.
*/
TriggerSelector(edm::ParameterSet const& pset, Strings const& triggernames, bool old_ = false);
/**
* Takes selection string and list of triggers
*/
TriggerSelector(std::string const& expression, Strings const& triggernames);
~TriggerSelector(){};
/**
* Returns status of always positive bit
*/
bool wantAll() const {
// if (useOld_) return eventSelector_->wantAll();
return acceptAll_;
}
/**
* Evaluates if trigger results pass selection
*/
bool acceptEvent(edm::TriggerResults const&) const;
/*
* Takes array of trigger results and a number of triggers in array and
* returns
* if it passes selection
*/
bool acceptEvent(unsigned char const*, int) const;
/*
* Returns if HLTGlobalStatus passes selection
*/
bool returnStatus(edm::HLTGlobalStatus const& trStatus) const { return masterElement_->returnStatus(trStatus); }
/*
* Does XMl compatible formatting of the selection string
*/
static std::string makeXMLString(std::string const& input);
/*
* Obsolete: Returns SelectedEvents vector from ParameterSet
*/
static std::vector<std::string> getEventSelectionVString(edm::ParameterSet const& pset);
private:
bool acceptAll_;
/*
* Starts parsing selection string
*/
void init(std::string const& path, Strings const& triggernames);
/*
* Removes extra spaces from string
*/
static std::string trim(std::string input);
/*
* Class used for storing internal representation of the selection string
*/
class TreeElement {
enum TreeOperator { NonInit = 0, AND = 1, OR = 2, NOT = 3, BR = 4 };
public:
/*
* Parser of selection string. Splits string into tokens and initializes new
* elements to parse them.
*/
TreeElement(std::string const& inputString, Strings const& tr, TreeElement* parentElement = nullptr);
~TreeElement();
/*
* Returns selection status of current element calculated recursively from
* it's child elements
*/
bool returnStatus(edm::HLTGlobalStatus const& trStatus) const;
/*
* Returns operator type of the element
*/
TreeOperator op() const { return op_; }
/*
* Returns parent element
*/
TreeElement* parent() const { return parent_; }
private:
TreeElement* parent_;
std::vector<TreeElement*> children_;
TreeOperator op_;
int trigBit_;
};
boost::shared_ptr<TreeElement> masterElement_;
// keep a copy of initialization string
std::string expression_;
boost::shared_ptr<edm::EventSelector> eventSelector_;
bool useOld_;
static const bool debug_ = false;
};
} // namespace dqmservices
#endif
| 26.328671 | 116 | 0.683665 | [
"vector"
] |
f88ac0b3773a735fb957f4e4fd1aa8ada2acbe8e | 536 | h | C | src/orbis/video/Window.h | perezite/sfml-android | 4f9c10daa760fe86728e98e7a3e883b724ef984e | [
"MIT"
] | null | null | null | src/orbis/video/Window.h | perezite/sfml-android | 4f9c10daa760fe86728e98e7a3e883b724ef984e | [
"MIT"
] | null | null | null | src/orbis/video/Window.h | perezite/sfml-android | 4f9c10daa760fe86728e98e7a3e883b724ef984e | [
"MIT"
] | null | null | null | #pragma once
#include "Mesh.h"
#include "Transform.h"
#include "Renderer.h"
#include "OpenGL.h"
#include <SDL2/SDL.h>
#include <string>
namespace orb
{
class Window
{
public:
Window(unsigned int width, unsigned int height, std::string title);
bool isOpen() const { return true; }
void clear() { }
void draw(Mesh& mesh, const Transform& transform);
void display();
protected:
void initSDL();
private:
std::string m_title;
SDL_Window* m_sdlWindow;
SDL_GLContext m_glContext;
Renderer m_renderer;
};
}
| 14.105263 | 69 | 0.688433 | [
"mesh",
"transform"
] |
f88d1605a58b295a142b9e43954d5c846cc8f617 | 759 | h | C | src/rtcstatsreport.h | aeadigt/node-webrtc | 3e84e6157764aad35b0a04aa66f6c6e86ca00191 | [
"BSD-2-Clause"
] | 13 | 2017-06-04T21:07:42.000Z | 2021-04-20T07:50:14.000Z | src/rtcstatsreport.h | aeadigt/node-webrtc | 3e84e6157764aad35b0a04aa66f6c6e86ca00191 | [
"BSD-2-Clause"
] | 13 | 2017-02-22T17:26:25.000Z | 2019-08-15T01:17:27.000Z | src/rtcstatsreport.h | aeadigt/node-webrtc | 3e84e6157764aad35b0a04aa66f6c6e86ca00191 | [
"BSD-2-Clause"
] | 8 | 2016-12-12T15:59:20.000Z | 2019-01-21T13:20:58.000Z | #ifndef SRC_RTCSTATSREPORT_H_
#define SRC_RTCSTATSREPORT_H_
#include "nan.h"
#include "v8.h" // IWYU pragma: keep
#include "webrtc/api/statstypes.h" // IWYU pragma: keep
namespace node_webrtc {
class RTCStatsReport
: public Nan::ObjectWrap {
public:
explicit RTCStatsReport(webrtc::StatsReport* report);
~RTCStatsReport();
//
// Nodejs wrapping.
//
static void Init(v8::Handle<v8::Object> exports);
static Nan::Persistent<v8::Function> constructor;
static NAN_METHOD(New);
static NAN_METHOD(names);
static NAN_METHOD(stat);
static NAN_GETTER(GetTimestamp);
static NAN_GETTER(GetType);
static NAN_SETTER(ReadOnly);
private:
webrtc::StatsReport* report;
};
} // namespace node_webrtc
#endif // SRC_RTCSTATSREPORT_H_
| 19.461538 | 56 | 0.731225 | [
"object"
] |
f891f5b14d2b482c7707c4825f45ad751ff405f2 | 3,794 | c | C | code/bluetooth.c | ryan-mcclue/tra | c75a7bbc71fb7aaecd5a377752a320a59745715b | [
"Zlib"
] | null | null | null | code/bluetooth.c | ryan-mcclue/tra | c75a7bbc71fb7aaecd5a377752a320a59745715b | [
"Zlib"
] | null | null | null | code/bluetooth.c | ryan-mcclue/tra | c75a7bbc71fb7aaecd5a377752a320a59745715b | [
"Zlib"
] | null | null | null | // SPDX-License-Identifier: zlib-acknowledgement
// TODO(Ryan): Investigate how to power board externally through Vin
// IMPORTANT(Ryan): First thing to get an overview is to look at board pinout. Basically everything is user-configurable IO
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>
// dbus formalise IPC with discrete packet sizes as oppose to byte streams with say pipes
// for wifi, use esp8266?
// bluetooth, hm-10? require gatt profiles? FTDI chip could convert serial to USB, i.e. give us a COM port on the pc
// we want to know the baud and protocol of the bluetooth module so as to configure the UART pins on the STM32 to match
// #include <dbus/dbus.h>
#include <glib.h>
#include <gio/gio.h>
void on_remote_device_detection(GDBusConnection* connection,
const gchar* sender_name,
const gchar* object_path,
const gchar* interface_name,
const gchar* signal_name,
GVariant* parameters,
gpointer user_data)
{
if (strcmp(object_path, adapter_object_path) == 0) return;
if
}
int
main(int argc, char *argv[])
{
int dev_hci_id = hci_get_route(NULL);
if (dev_hci_id < 0)
{
fprintf(stderr, "Failed to get default bluetooth device hci id.\n");
return 1;
}
struct hci_dev_info dev_info = {0};
if (hci_devinfo(dev_hci_id, &dev_info) < 0)
{
fprintf(stderr, "Failed to get default bluetooth device information.\n");
return 1;
}
char object_path[64] = {0};
strcpy(object_path, "/org/bluez/");
strcat(object_path, dev_info.name);
GList *list;
GMainLoop *loop;
GError *err = NULL;
GDBusConnection *gdbus_conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
if (gdbus_conn == NULL)
{
fprintf(stderr, "Failed to connect to DBus system bus (%s).\n", err->message);
return 1;
}
// Listen to signal PropertiesChanged from any object indicated by NULL (this has to be the case as any device)
int subscription_id = g_dbus_connection_signal_subscribe(gdbus_conn, "org.bluez", "org.freedesktop.DBus.Properties",
"PropertiesChanged", NULL, NULL, G_DBUS_SIGNAL_FLAGS_NONE, on_remote_device_detection, NULL, NULL);
#define BUS_NAME "org.bluez"
#define INTERFACE_NAME "org.bluez.Adapter1"
// DBUS_BUS_SESSION will make bluez unknown
// IMPORTANT(Ryan): By default, we cannot register a name on the system bus
// So, must create a policy file in /etc/dbus-1/system.d/my.bluetooth.client.conf
/*
*
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- alternatively could do user="ryan" -->
<policy context="default">
<allow own="my.bluetooth.client"/>
</policy>
</busconfig>
*/
// server, object, interface, method
// signal (broadcast), METHOD_CALL returns METHOD_RETURN or ERROR
// interface = org.bluez.Adapter1
// object = /org/bluez/${dev_info.name}
return 0;
}
// dbus built on-top of low-level IPCs like shared memory and sockets
// system bus for kernel, i.e for all users
// session bus for user
// if well known name of the service (org.freedesktop.ModemManager) is not started, dbus will start it for us?
// service exposes objects (/org/freedesktop/ModemManager)
// objects can have various interfaces (org.freedesktop.DBus.ObjectManager) (form of reverse domain name)
// the interface will have methods to access data (GetManagedObjects()), also have properties or signals
// our process interacts with dbus-daemon (libdbus) which interacts with systemd (sd-bus)
| 32.991304 | 123 | 0.68213 | [
"object"
] |
f894f0db9406b3205e939b7dbd51827b2f90cee4 | 4,177 | h | C | kernel/PageCache.h | jbush001/os | d011085d99c0d56477ad2d4c4853f6c6d3bf15eb | [
"Apache-2.0"
] | 55 | 2015-03-03T17:45:07.000Z | 2022-01-23T18:49:34.000Z | kernel/PageCache.h | jbush001/os | d011085d99c0d56477ad2d4c4853f6c6d3bf15eb | [
"Apache-2.0"
] | null | null | null | kernel/PageCache.h | jbush001/os | d011085d99c0d56477ad2d4c4853f6c6d3bf15eb | [
"Apache-2.0"
] | 29 | 2015-01-09T02:37:18.000Z | 2022-01-23T18:50:21.000Z | //
// Copyright 1998-2012 Jeff Bush
//
// 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 PageCache
#ifndef _PAGE_CACHE_H
#define _PAGE_CACHE_H
#include "types.h"
class BackingStore;
class Page;
/// A PageCache represents a collection of physical memory pages that contain
/// a subset of data from a BackingStore object. In our model, all of physical memory
/// is simply a cache of data stored on some backing store. For example, parts of a
/// file from a disk drive.
class PageCache {
public:
PageCache(BackingStore *backingStore = 0, PageCache *copyOf = 0);
~PageCache();
/// Return a physical Page that contains data from a specific offset in the backing store.
/// If a physical page already exists in memory that contains this data, it will be returned.
/// However, if there is no physical page, one will be allocated (potentially taken from
/// another PageCache), and data will be loaded onto it from the BackingStore
/// @param offset Number of bytes into backing store from which data should be retrieved
/// @param privateCopy
/// - If this is false, then any thread that calls GetPage with the same offset will potentially
/// get a pointer to the same Page object (they will share the physical page)
/// - If this is true, then the returned Page will belong to the calling thread alone. Note
/// that this method is only called with privateCopy true from another PageCache (this is used to
/// implement copy on write)
/// @returns Page containing requested data
Page* GetPage(off_t offset, bool privateCopy = false);
/// The virtual memory system needs to reuse a page that is in this cache. The cache
/// must relenquish ownership of this page.
/// @param page Page to be removed from this cache. It necessarily will be a member of this
/// cache.
/// @param dirty true if the virtual memory detects that the contents have been modified since
/// GetPage was called. If it is dirty, the page cache will inform the backing store that it should
/// write out the new version of the data.
void StealPage(Page *page, bool dirty);
/// Determine if this page cache is copy on write and receives unmodified pages from
/// another cache.
inline bool IsCopy() const;
/// Increment the reference count of this object.
void AcquireRef();
/// Decrement the reference count of this object. If the reference count goes to zero, free
/// this object and release all of its pages
void ReleaseRef();
/// Commit guarantees that a certain amount of space on the backing store will be available
/// @param size Number of bytes that will be required (generally a multiple of the page size)
/// @returns Number of bytes that were actually resedved.
off_t Commit(off_t size);
/// Prevent pages in this cache from being swapped in our out by other threads
/// This will block of other threads are interacting with the cache.
void Lock();
/// Opposite of lock
void Unlock();
/// Called at boot time to initialize structures
static void Bootstrap();
/// Print all pages in this cache to debug output.
void Print() const;
private:
inline int GenerateHash(off_t) const;
void InsertPage(off_t, Page*);
void RemovePage(Page*);
Page* LookupPage(off_t) const;
static void HashStats(int, const char**);
BackingStore *fBackingStore;
PageCache *fSourceCache;
Page *fResidentPages;
volatile int fRefCount;
static int fPageHashSize;
static Page **fPageHash;
static class Mutex fCacheLock;
};
inline bool PageCache::IsCopy() const
{
return fSourceCache != 0;
}
#endif
| 38.321101 | 105 | 0.718458 | [
"object",
"model"
] |
f895391264cccb7ad7ed895b4ea9373f174c560f | 9,401 | h | C | dp/sg/io/DPAF/Saver/inc/DPAFSaver.h | asuessenbach/pipeline | 2e49968cc3b9948a57f7ee6c4cc3258925c92ab2 | [
"BSD-3-Clause"
] | 217 | 2015-01-06T09:26:53.000Z | 2022-03-23T14:03:18.000Z | dp/sg/io/DPAF/Saver/inc/DPAFSaver.h | asuessenbach/pipeline | 2e49968cc3b9948a57f7ee6c4cc3258925c92ab2 | [
"BSD-3-Clause"
] | 10 | 2015-01-25T12:42:05.000Z | 2017-11-28T16:10:16.000Z | dp/sg/io/DPAF/Saver/inc/DPAFSaver.h | asuessenbach/pipeline | 2e49968cc3b9948a57f7ee6c4cc3258925c92ab2 | [
"BSD-3-Clause"
] | 44 | 2015-01-13T01:19:41.000Z | 2022-02-21T21:35:08.000Z | // Copyright (c) 2002-2015, NVIDIA CORPORATION. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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
/** \file */
#include <set>
#include <dp/sg/core/Config.h>
#include <dp/sg/io/PlugInterface.h>
#include <dp/sg/ui/ViewState.h>
#include <dp/sg/algorithm/Traverser.h>
// Don't need to document the API specifier
#if ! defined( DOXYGEN_IGNORE )
#if defined(_WIN32)
# ifdef DPAFSAVER_EXPORTS
# define DPAFSAVER_API __declspec(dllexport)
# else
# define DPAFSAVER_API __declspec(dllimport)
# endif
#else
# define DPAFSAVER_API
#endif
#endif // DOXYGEN_IGNORE
// exports required for a scene loader plug-in
extern "C"
{
//! Get the PlugIn interface for this scene saver.
/** Every PlugIn has to resolve this function. It is used to get a pointer to a PlugIn class, in this case a
DPAFSaver.
* If the PlugIn ID \a piid equals \c PIID_DP_SCENE_SAVER, a DPAFSaver is created and returned in \a pi.
* \returns true, if the requested PlugIn could be created, otherwise false
*/
DPAFSAVER_API bool getPlugInterface(const dp::util::UPIID& piid, dp::util::PlugInSharedPtr & pi);
//! Query the supported types of PlugIn Interfaces.
DPAFSAVER_API void queryPlugInterfacePIIDs( std::vector<dp::util::UPIID> & piids );
}
//! A Traverser to traverse a scene on saving to DPAF file format.
/** \note Needs a valid ViewState. Call setViewState prior to apply().*/
class DPAFSaveTraverser : public dp::sg::algorithm::SharedTraverser
{
public:
//! Default constructor
DPAFSaveTraverser();
//! Sets the FILE where the scene is to be saved to.
void setFILE( FILE *fh //!< FILE to save to
, std::string const& filename
);
protected:
//! Controls saving of the scene together with a ViewState.
void doApply( const dp::sg::core::NodeSharedPtr & root );
// overloads to process concrete types for saving
// ...Cameras
//! Save a \c ParallelCamera.
/** If the \c ParallelCarmera \a p is encountered on saving the first time, it is traversed with \a root and then it's
* saved. */
virtual void handleParallelCamera(const dp::sg::core::ParallelCamera *p);
//! Save a \c PerspectiveCamera.
/** If the \c PerspectiveCamera \a p is encountered on saving the first time, it is traversed with \a root and then
* it's saved. */
virtual void handlePerspectiveCamera(const dp::sg::core::PerspectiveCamera *p);
//! Save a \c MatrixCamera.
/** If the \c MatrixCamera \a p is encountered on saving the first time, it is traversed with \a root and then
* it's saved. */
virtual void handleMatrixCamera( const dp::sg::core::MatrixCamera * p );
// ...Nodes
//! Save a \c Billboard.
/** If the \c Billboard \a p is encountered on saving the first time, it is traversed and then saved. */
virtual void handleBillboard(const dp::sg::core::Billboard *p);
//! Save a \c GeoNode.
/** If the \c GeoNode \a p is encountered on saving the first time, it is traversed and then saved. */
virtual void handleGeoNode(const dp::sg::core::GeoNode *p);
//! Save a \c Group.
/** If the \c Group \a p is encountered on saving the first time, it is traversed and then saved. */
virtual void handleGroup( const dp::sg::core::Group *p );
//! Save a \c Transform.
/** If the \c Transform \a p is encountered on saving the first time, it is traversed and then saved. */
virtual void handleTransform(const dp::sg::core::Transform *p);
//! Save a \c LOD.
/** If the \c LOD \a p is encountered on saving the first time, all it's children are traversed, no matter which might
* be currently active, then it is saved. */
virtual void handleLOD(const dp::sg::core::LOD *p);
//! Save a \c Switch.
/** If the \c Switch \a p is encountered on saving the first time, all it's children are traversed, no matter which
* might be currently active, then it is saved. */
virtual void handleSwitch(const dp::sg::core::Switch *p);
virtual void handleLightSource( const dp::sg::core::LightSource * p );
//! Save a \c Primitive.
/** If the \c Primitive \a p is encountered on saving the first time, it is saved. */
virtual void handlePrimitive(const dp::sg::core::Primitive *p);
//! Save an \c IndexSet.
/** If the \c IndexSet \a p is encountered on saving the first time, it is saved. */
virtual void handleIndexSet( const dp::sg::core::IndexSet * p );
//! Save a \c VertexAttributeSet.
/** If the \c VertexAttributeSet \a p is encountered on saving the first time, it is saved. */
virtual void handleVertexAttributeSet( const dp::sg::core::VertexAttributeSet *p );
virtual void handleParameterGroupData( const dp::sg::core::ParameterGroupData * p );
virtual void handlePipelineData( const dp::sg::core::PipelineData * p );
virtual void handleSampler( const dp::sg::core::Sampler * p );
private:
void cameraData( const dp::sg::core::Camera *p );
void frustumCameraData( const dp::sg::core::FrustumCamera *p );
const std::string getName( const std::string &name );
std::string getObjectName( const dp::sg::core::Object *p );
void objectData( const dp::sg::core::Object *p ); // writes object data
void groupData( const dp::sg::core::Group *p );
bool isFirstTime( const dp::sg::core::HandledObject * p );
void lightSourceData( const dp::sg::core::LightSource *p );
void nodeData( const dp::sg::core::Node *p );
std::string parameterString( const dp::sg::core::ParameterGroupData * p, dp::fx::ParameterGroupSpec::iterator it );
void primitiveData( const dp::sg::core::Primitive *p );
void textureImage( const dp::sg::core::TextureHostSharedPtr & tih );
void transformData( const dp::sg::core::Transform * p );
void vertexAttributeSetData( const dp::sg::core::VertexAttributeSet * p );
void writeVertexData( const dp::sg::core::VertexAttribute & va );
void buffer( dp::sg::core::BufferSharedPtr const& p );
private:
struct CallbackLink
{
std::string name;
dp::sg::core::ObjectWeakPtr subject;
dp::sg::core::ObjectWeakPtr observer;
};
private:
FILE * m_fh;
std::vector<std::string> m_basePaths;
std::string m_effectSpecName;
std::map<dp::sg::core::DataID, std::string> m_sharedData;
std::set<dp::sg::core::HandledObjectSharedPtr> m_sharedObjects;
std::map<dp::sg::core::BufferSharedPtr, std::string> m_storedBuffers;
std::map<dp::sg::core::SamplerSharedPtr, std::string> m_storedSamplers;
std::map<dp::sg::core::ObjectSharedPtr, std::string> m_objectNames;
unsigned int m_nameCount;
std::set<std::string> m_nameSet;
std::map<dp::sg::core::TextureHostSharedPtr, std::string> m_textureImageNames;
std::vector<CallbackLink> m_links;
};
DEFINE_PTR_TYPES( DPAFSaver );
//! A Scene Saver for DPAF files.
/** DPAF files can be produced with the sample ViewerVR.
* They are text files that represent a Scene and a ViewState. */
class DPAFSaver : public dp::sg::io::SceneSaver
{
public :
static DPAFSaverSharedPtr create();
virtual ~DPAFSaver();
//! Realization of the pure virtual interface function of a SceneSaver.
/** Saves the \a scene and the \a viewState to \a filename.
* The \a viewState may be NULL. */
bool save( dp::sg::core::SceneSharedPtr const& scene //!< scene to save
, dp::sg::ui::ViewStateSharedPtr const& viewState //!< view state to save
, std::string const& filename //!< file name to save to
);
protected:
DPAFSaver();
};
| 45.635922 | 122 | 0.668227 | [
"object",
"vector",
"transform"
] |
f8964265db07fe48bcd28f1e1c5443465720c067 | 11,630 | c | C | eval/ocaml/byterun/hash.c | ucsd-progsys/nate | 8b1267cd8b10283d8bc239d16a28c654a4cb8942 | [
"BSD-3-Clause"
] | 9 | 2017-08-30T23:00:52.000Z | 2021-02-25T23:08:55.000Z | eval/ocaml/byterun/hash.c | ucsd-progsys/ml2 | 8b1267cd8b10283d8bc239d16a28c654a4cb8942 | [
"BSD-3-Clause"
] | null | null | null | eval/ocaml/byterun/hash.c | ucsd-progsys/ml2 | 8b1267cd8b10283d8bc239d16a28c654a4cb8942 | [
"BSD-3-Clause"
] | 1 | 2022-03-31T19:50:33.000Z | 2022-03-31T19:50:33.000Z | /***********************************************************************/
/* */
/* OCaml */
/* */
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
/* */
/* Copyright 1996 Institut National de Recherche en Informatique et */
/* en Automatique. All rights reserved. This file is distributed */
/* under the terms of the GNU Library General Public License, with */
/* the special exception on linking described in file ../LICENSE. */
/* */
/***********************************************************************/
/* The generic hashing primitive */
/* The interface of this file is in "mlvalues.h" (for [caml_hash_variant])
and in "hash.h" (for the other exported functions). */
#include "mlvalues.h"
#include "custom.h"
#include "memory.h"
#include "hash.h"
/* The new implementation, based on MurmurHash 3,
http://code.google.com/p/smhasher/ */
#define ROTL32(x,n) ((x) << n | (x) >> (32-n))
#define MIX(h,d) \
d *= 0xcc9e2d51; \
d = ROTL32(d, 15); \
d *= 0x1b873593; \
h ^= d; \
h = ROTL32(h, 13); \
h = h * 5 + 0xe6546b64;
#define FINAL_MIX(h) \
h ^= h >> 16; \
h *= 0x85ebca6b; \
h ^= h >> 13; \
h *= 0xc2b2ae35; \
h ^= h >> 16;
CAMLexport uint32 caml_hash_mix_uint32(uint32 h, uint32 d)
{
MIX(h, d);
return h;
}
/* Mix a platform-native integer. */
CAMLexport uint32 caml_hash_mix_intnat(uint32 h, intnat d)
{
uint32 n;
#ifdef ARCH_SIXTYFOUR
/* Mix the low 32 bits and the high 32 bits, in a way that preserves
32/64 compatibility: we want n = (uint32) d
if d is in the range [-2^31, 2^31-1]. */
n = (d >> 32) ^ (d >> 63) ^ d;
/* If 0 <= d < 2^31: d >> 32 = 0 d >> 63 = 0
If -2^31 <= d < 0: d >> 32 = -1 d >> 63 = -1
In both cases, n = (uint32) d. */
#else
n = d;
#endif
MIX(h, n);
return h;
}
/* Mix a 64-bit integer. */
CAMLexport uint32 caml_hash_mix_int64(uint32 h, int64 d)
{
uint32 hi = (uint32) (d >> 32), lo = (uint32) d;
MIX(h, lo);
MIX(h, hi);
return h;
}
/* Mix a double-precision float.
Treats +0.0 and -0.0 identically.
Treats all NaNs identically.
*/
CAMLexport uint32 caml_hash_mix_double(uint32 hash, double d)
{
union {
double d;
#if defined(ARCH_BIG_ENDIAN) || (defined(__arm__) && !defined(__ARM_EABI__))
struct { uint32 h; uint32 l; } i;
#else
struct { uint32 l; uint32 h; } i;
#endif
} u;
uint32 h, l;
/* Convert to two 32-bit halves */
u.d = d;
h = u.i.h; l = u.i.l;
/* Normalize NaNs */
if ((h & 0x7FF00000) == 0x7FF00000 && (l | (h & 0xFFFFF)) != 0) {
h = 0x7FF00000;
l = 0x00000001;
}
/* Normalize -0 into +0 */
else if (h == 0x80000000 && l == 0) {
h = 0;
}
MIX(hash, l);
MIX(hash, h);
return hash;
}
/* Mix a single-precision float.
Treats +0.0 and -0.0 identically.
Treats all NaNs identically.
*/
CAMLexport uint32 caml_hash_mix_float(uint32 hash, float d)
{
union {
float f;
uint32 i;
} u;
uint32 n;
/* Convert to int32 */
u.f = d; n = u.i;
/* Normalize NaNs */
if ((n & 0x7F800000) == 0x7F800000 && (n & 0x007FFFFF) != 0) {
n = 0x7F800001;
}
/* Normalize -0 into +0 */
else if (n == 0x80000000) {
n = 0;
}
MIX(hash, n);
return hash;
}
/* Mix an OCaml string */
CAMLexport uint32 caml_hash_mix_string(uint32 h, value s)
{
mlsize_t len = caml_string_length(s);
mlsize_t i;
uint32 w;
/* Mix by 32-bit blocks (little-endian) */
for (i = 0; i + 4 <= len; i += 4) {
#ifdef ARCH_BIG_ENDIAN
w = Byte_u(s, i)
| (Byte_u(s, i+1) << 8)
| (Byte_u(s, i+2) << 16)
| (Byte_u(s, i+3) << 24);
#else
w = *((uint32 *) &Byte_u(s, i));
#endif
MIX(h, w);
}
/* Finish with up to 3 bytes */
w = 0;
switch (len & 3) {
case 3: w = Byte_u(s, i+2) << 16; /* fallthrough */
case 2: w |= Byte_u(s, i+1) << 8; /* fallthrough */
case 1: w |= Byte_u(s, i);
MIX(h, w);
default: /*skip*/; /* len & 3 == 0, no extra bytes, do nothing */
}
/* Finally, mix in the length. Ignore the upper 32 bits, generally 0. */
h ^= (uint32) len;
return h;
}
/* Maximal size of the queue used for breadth-first traversal. */
#define HASH_QUEUE_SIZE 256
/* Maximal number of Forward_tag links followed in one step */
#define MAX_FORWARD_DEREFERENCE 1000
/* The generic hash function */
CAMLprim value caml_hash(value count, value limit, value seed, value obj)
{
value queue[HASH_QUEUE_SIZE]; /* Queue of values to examine */
intnat rd; /* Position of first value in queue */
intnat wr; /* One past position of last value in queue */
intnat sz; /* Max number of values to put in queue */
intnat num; /* Max number of meaningful values to see */
uint32 h; /* Rolling hash */
value v;
mlsize_t i, len;
sz = Long_val(limit);
if (sz < 0 || sz > HASH_QUEUE_SIZE) sz = HASH_QUEUE_SIZE;
num = Long_val(count);
h = Int_val(seed);
queue[0] = obj; rd = 0; wr = 1;
while (rd < wr && num > 0) {
v = queue[rd++];
again:
if (Is_long(v)) {
h = caml_hash_mix_intnat(h, v);
num--;
}
else if (Is_in_value_area(v)) {
switch (Tag_val(v)) {
case String_tag:
h = caml_hash_mix_string(h, v);
num--;
break;
case Double_tag:
h = caml_hash_mix_double(h, Double_val(v));
num--;
break;
case Double_array_tag:
for (i = 0, len = Wosize_val(v) / Double_wosize; i < len; i++) {
h = caml_hash_mix_double(h, Double_field(v, i));
num--;
if (num <= 0) break;
}
break;
case Abstract_tag:
/* Block contents unknown. Do nothing. */
break;
case Infix_tag:
/* Mix in the offset to distinguish different functions from
the same mutually-recursive definition */
h = caml_hash_mix_uint32(h, Infix_offset_val(v));
v = v - Infix_offset_val(v);
goto again;
case Forward_tag:
/* PR#6361: we can have a loop here, so limit the number of
Forward_tag links being followed */
for (i = MAX_FORWARD_DEREFERENCE; i > 0; i--) {
v = Forward_val(v);
if (Is_long(v) || !Is_in_value_area(v) || Tag_val(v) != Forward_tag)
goto again;
}
/* Give up on this object and move to the next */
break;
case Object_tag:
h = caml_hash_mix_intnat(h, Oid_val(v));
num--;
break;
case Custom_tag:
/* If no hashing function provided, do nothing. */
/* Only use low 32 bits of custom hash, for 32/64 compatibility */
if (Custom_ops_val(v)->hash != NULL) {
uint32 n = (uint32) Custom_ops_val(v)->hash(v);
h = caml_hash_mix_uint32(h, n);
num--;
}
break;
default:
/* Mix in the tag and size, but do not count this towards [num] */
h = caml_hash_mix_uint32(h, Whitehd_hd(Hd_val(v)));
/* Copy fields into queue, not exceeding the total size [sz] */
for (i = 0, len = Wosize_val(v); i < len; i++) {
if (wr >= sz) break;
queue[wr++] = Field(v, i);
}
break;
}
} else {
/* v is a pointer outside the heap, probably a code pointer.
Shall we count it? Let's say yes by compatibility with old code. */
h = caml_hash_mix_intnat(h, v);
num--;
}
}
/* Final mixing of bits */
FINAL_MIX(h);
/* Fold result to the range [0, 2^30-1] so that it is a nonnegative
OCaml integer both on 32 and 64-bit platforms. */
return Val_int(h & 0x3FFFFFFFU);
}
/* The old implementation */
static uintnat hash_accu;
static intnat hash_univ_limit, hash_univ_count;
static void hash_aux(value obj);
CAMLprim value caml_hash_univ_param(value count, value limit, value obj)
{
hash_univ_limit = Long_val(limit);
hash_univ_count = Long_val(count);
hash_accu = 0;
hash_aux(obj);
return Val_long(hash_accu & 0x3FFFFFFF);
/* The & has two purposes: ensure that the return value is positive
and give the same result on 32 bit and 64 bit architectures. */
}
#define Alpha 65599
#define Beta 19
#define Combine(new) (hash_accu = hash_accu * Alpha + (new))
#define Combine_small(new) (hash_accu = hash_accu * Beta + (new))
static void hash_aux(value obj)
{
unsigned char * p;
mlsize_t i, j;
tag_t tag;
hash_univ_limit--;
if (hash_univ_count < 0 || hash_univ_limit < 0) return;
again:
if (Is_long(obj)) {
hash_univ_count--;
Combine(Long_val(obj));
return;
}
/* Pointers into the heap are well-structured blocks. So are atoms.
We can inspect the block contents. */
Assert (Is_block (obj));
if (Is_in_value_area(obj)) {
tag = Tag_val(obj);
switch (tag) {
case String_tag:
hash_univ_count--;
i = caml_string_length(obj);
for (p = &Byte_u(obj, 0); i > 0; i--, p++)
Combine_small(*p);
break;
case Double_tag:
/* For doubles, we inspect their binary representation, LSB first.
The results are consistent among all platforms with IEEE floats. */
hash_univ_count--;
#ifdef ARCH_BIG_ENDIAN
for (p = &Byte_u(obj, sizeof(double) - 1), i = sizeof(double);
i > 0;
p--, i--)
#else
for (p = &Byte_u(obj, 0), i = sizeof(double);
i > 0;
p++, i--)
#endif
Combine_small(*p);
break;
case Double_array_tag:
hash_univ_count--;
for (j = 0; j < Bosize_val(obj); j += sizeof(double)) {
#ifdef ARCH_BIG_ENDIAN
for (p = &Byte_u(obj, j + sizeof(double) - 1), i = sizeof(double);
i > 0;
p--, i--)
#else
for (p = &Byte_u(obj, j), i = sizeof(double);
i > 0;
p++, i--)
#endif
Combine_small(*p);
}
break;
case Abstract_tag:
/* We don't know anything about the contents of the block.
Better do nothing. */
break;
case Infix_tag:
hash_aux(obj - Infix_offset_val(obj));
break;
case Forward_tag:
obj = Forward_val (obj);
goto again;
case Object_tag:
hash_univ_count--;
Combine(Oid_val(obj));
break;
case Custom_tag:
/* If no hashing function provided, do nothing */
if (Custom_ops_val(obj)->hash != NULL) {
hash_univ_count--;
Combine(Custom_ops_val(obj)->hash(obj));
}
break;
default:
hash_univ_count--;
Combine_small(tag);
i = Wosize_val(obj);
while (i != 0) {
i--;
hash_aux(Field(obj, i));
}
break;
}
return;
}
/* Otherwise, obj is a pointer outside the heap, to an object with
a priori unknown structure. Use its physical address as hash key. */
Combine((intnat) obj);
}
/* Hashing variant tags */
CAMLexport value caml_hash_variant(char const * tag)
{
value accu;
/* Same hashing algorithm as in ../typing/btype.ml, function hash_variant */
for (accu = Val_int(0); *tag != 0; tag++)
accu = Val_int(223 * Int_val(accu) + *((unsigned char *) tag));
#ifdef ARCH_SIXTYFOUR
accu = accu & Val_long(0x7FFFFFFFL);
#endif
/* Force sign extension of bit 31 for compatibility between 32 and 64-bit
platforms */
return (int32) accu;
}
| 28.159806 | 78 | 0.555546 | [
"object"
] |
f8b67bf7e7026487d5fee32fa8ab503d024e8708 | 2,543 | h | C | bazaar/ProtectClient/ProtectStatus.h | dreamsxin/ultimatepp | 41d295d999f9ff1339b34b43c99ce279b9b3991c | [
"BSD-2-Clause"
] | 2 | 2016-04-07T07:54:26.000Z | 2020-04-14T12:37:34.000Z | bazaar/ProtectClient/ProtectStatus.h | dreamsxin/ultimatepp | 41d295d999f9ff1339b34b43c99ce279b9b3991c | [
"BSD-2-Clause"
] | null | null | null | bazaar/ProtectClient/ProtectStatus.h | dreamsxin/ultimatepp | 41d295d999f9ff1339b34b43c99ce279b9b3991c | [
"BSD-2-Clause"
] | null | null | null | #ifndef _ProtectStatus_h_
#define _ProtectStatus_h_
#include <Core/Core.h>
NAMESPACE_UPP
// server error codes
typedef enum {
PROTECT_OK = 0, // no error (unused)
PROTECT_HTTP_ERROR, // error on HTTP communication with server
PROTECT_BAD_REQUEST, // missing POST data on request
PROTECT_MISSING_IV, // missing Initialization Vector on POST data
PROTECT_MISSING_DATA, // missing DATA field on POST data
PROTECT_MISSING_EMAIL, // missing mandatory EMAIL field in POST DATA
PROTECT_INVALID_EMAIL, // ill-formed email address
PROTECT_MISSING_REASON, // missing connection's reason
PROTECT_UNKNOWN_REASON, // unknown connection's reason
PROTECT_MISSING_CLIENTID, // missing client connection ID in POST DATA
PROTECT_MISSING_ACTIVATIONKEY, // missing activation key in request
PROTECT_BAD_ACTIVATIONKEY, // wrong activation key in request
PROTECT_BAD_DATA, // missing mandatory fields in POST DATA
PROTECT_NOT_CONNECTED, // not connected to server -- must connect first
PROTECT_CONNECTION_EXPIRED, // server connection timeout -- should refresh more often
PROTECT_LICENSE_EXPIRED, // testing license expired
PROTECT_LICENSE_NOT_ACTIVATED, // license requested but still not activated by user
PROTECT_UNREGISTERED, // product unregistered
PROTECT_LICENSES_NUMBER_EXCEEDED, // number of product licenses exceeded (too many apps running)
PROTECT_MAIL_ALREADY_USED, // e-mail already used (and expired), can't register
PROTECT_INVALID_APP_VERSION, // your license isn't valid for this APP version, should upgrade
PROTECT_MAIL_SEND_ERROR, // smtp error sending email
PROTECT_MISSING_MAC // missing MAC field on POST DATA
} ProtectStatus;
// gets human-readable error message
extern String ProtectMessage(int m);
// server request reasons
typedef enum {
PROTECT_BAD_REASON, // internal error
PROTECT_CONNECT, // establish connection to server
PROTECT_DISCONNECT, // frees server connection
PROTECT_REFRESH, // refreshes server connection (to restart timeout)
PROTECT_GETLICENSEKEY, // gets application key
PROTECT_REGISTER, // registers app for timed demo OR re-request activation code
PROTECT_GETLICENSEINFO, // gets info about license (name, expiration date, app version....)
PROTECT_UPDATEUSERDATA // update user-modifiable user data (name, address....)
} ProtectReasons;
// get reason in string format
extern String ProtectReasonStr(int r);
// get reason in enum format
extern int ProtectReason(String const &s);
END_UPP_NAMESPACE
#endif
| 43.101695 | 97 | 0.775855 | [
"vector"
] |
f8b90201b0cb498cbe80a6a3ea22927bbde48f2d | 1,269 | h | C | signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/profile/profile_data.h | qubka/signals | 6bd39c662ab2b1e0caafc5a4c4510a74fb9f9e1c | [
"MIT"
] | 181 | 2020-01-17T13:49:59.000Z | 2022-03-17T03:23:12.000Z | signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/profile/profile_data.h | qubka/signals | 6bd39c662ab2b1e0caafc5a4c4510a74fb9f9e1c | [
"MIT"
] | 22 | 2020-01-16T23:37:02.000Z | 2021-09-08T23:51:12.000Z | signal-slot-benchmarks/benchmark/lib/iscool/include/iscool/profile/profile_data.h | qubka/signals | 6bd39c662ab2b1e0caafc5a4c4510a74fb9f9e1c | [
"MIT"
] | 16 | 2020-01-28T15:40:18.000Z | 2022-02-25T08:32:15.000Z | /*
Copyright 2018-present IsCool Entertainment
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 ISCOOL_PROFILE_PROFILE_DATA_H
#define ISCOOL_PROFILE_PROFILE_DATA_H
#include <string>
#include <chrono>
#include <vector>
namespace iscool
{
namespace profile
{
struct profile_data
{
profile_data();
profile_data
( const std::string& new_name,
const std::chrono::milliseconds& new_start,
const std::chrono::milliseconds& new_end,
const std::vector< std::string >& new_tags );
std::string name;
std::chrono::milliseconds start;
std::chrono::milliseconds end;
std::vector< std::string > tags;
};
}
}
#endif
| 28.2 | 74 | 0.668243 | [
"vector"
] |
f8c39cdcbdea48f8cebc0007fa9ba6df31ca3d5c | 3,198 | h | C | source/Config.h | mmore500/depo-consensus | de2cd40f0b79cda4a8e91f312a37104a50587769 | [
"MIT"
] | null | null | null | source/Config.h | mmore500/depo-consensus | de2cd40f0b79cda4a8e91f312a37104a50587769 | [
"MIT"
] | null | null | null | source/Config.h | mmore500/depo-consensus | de2cd40f0b79cda4a8e91f312a37104a50587769 | [
"MIT"
] | null | null | null | #pragma once
#define STRINGVIEWIFY(s) std::string_view(IFY(s))
#define STRINGIFY(s) IFY(s)
#define IFY(s) #s
#include <string>
#include <deque>
#include <type_traits>
#include <string_view>
#include <ratio>
#include "base/vector.h"
#include "base/Ptr.h"
#include "config/command_line.h"
#include "config/ArgManager.h"
#include "hardware/EventDrivenGP.h"
#include "tools/MatchBin.h"
#include "tools/matchbin_utils.h"
#include "ConfigBase.h"
#include "MultiMatchBin.h"
class FrameHardware;
class Config : public ConfigBase {
public:
static constexpr size_t TAG_WIDTH = 32;
using TRAIT_TYPE = emp::Ptr<FrameHardware>;
using chanid_t = uint64_t;
using DEPO_T = emp::DePoSelector<std::ratio<1,5>>;
using matchbin_t = MultiMatchBin<
size_t
#ifdef METRIC
, std::conditional<STRINGVIEWIFY(METRIC) == "integer",
emp::SymmetricWrapMetric<TAG_WIDTH>,
std::conditional<STRINGVIEWIFY(METRIC) == "streak",
emp::CacheMod<emp::UnifMod<emp::ApproxDualStreakMetric<TAG_WIDTH>>>,
std::conditional<STRINGVIEWIFY(METRIC) == "simplestreak",
emp::ExactSingleStreakMetric<TAG_WIDTH>,
std::conditional<STRINGVIEWIFY(METRIC) == "hash",
emp::HashMetric<TAG_WIDTH>,
std::conditional<STRINGVIEWIFY(METRIC) == "hamming",
emp::HammingCumuMetric<TAG_WIDTH>,
std::enable_if<false>
>::type
>::type
>::type
>::type
>::type
#else
// default
, emp::CacheMod<emp::UnifMod<emp::ApproxDualStreakMetric<TAG_WIDTH>>>
#endif
#ifdef SELECTOR
, std::conditional<STRINGVIEWIFY(SELECTOR) == "roulette",
emp::RouletteSelector<
std::ratio<1, 2>,
std::ratio<1, 500>,
std::ratio<1, 4>
>,
std::conditional<STRINGVIEWIFY(SELECTOR) == "exproulette",
emp::ExpRouletteSelector<>,
std::conditional<STRINGVIEWIFY(SELECTOR) == "sieve",
emp::SieveSelector<std::ratio<0>, std::ratio<1, 5>>,
std::conditional<STRINGVIEWIFY(SELECTOR) == "depo",
DEPO_T,
std::conditional<STRINGVIEWIFY(SELECTOR) == "ranked",
emp::RankedSelector<std::ratio<1, 2>>,
std::enable_if<false>
>::type
>::type
>::type
>::type
>::type
#else
, DEPO_T
#endif
// secondary selector
, emp::RankedSelector<std::ratio<1, 2>>
#ifdef REGULATOR
, std::conditional<STRINGVIEWIFY(REGULATOR) == "multiplicative",
emp::MultiplicativeCountdownRegulator<>,
std::conditional<STRINGVIEWIFY(REGULATOR) == "additive",
emp::AdditiveCountdownRegulator<>,
std::conditional<STRINGVIEWIFY(REGULATOR) == "no-op",
emp::NoopRegulator,
std::enable_if<false>
>::type
>::type
>::type
#else
, emp::MultiplicativeCountdownRegulator<>
#endif
>;
using hardware_t = emp::EventDrivenGP_AW<
TAG_WIDTH
, TRAIT_TYPE
, matchbin_t
>;
using program_t = hardware_t::program_t;
using inst_lib_t = emp::InstLib<hardware_t>;
using event_lib_t = emp::EventLib<hardware_t>;
using event_t = hardware_t::event_t;
using inbox_t = std::deque<event_t>;
using tag_t = hardware_t::affinity_t;
Config();
void WriteMe(std::ostream & out) const;
};
| 26.87395 | 76 | 0.65666 | [
"vector"
] |
f8c83f91e0901ea784d59e3f9fc19b67b5082355 | 904 | h | C | src/ModelCovergroup.h | fvutils/libvsc | 1e52ad16fe3ca39e7807eee11e38ca30cb23f827 | [
"Apache-2.0"
] | 4 | 2021-08-04T07:42:55.000Z | 2022-03-23T05:08:03.000Z | src/ModelCovergroup.h | fvutils/libvsc | 1e52ad16fe3ca39e7807eee11e38ca30cb23f827 | [
"Apache-2.0"
] | null | null | null | src/ModelCovergroup.h | fvutils/libvsc | 1e52ad16fe3ca39e7807eee11e38ca30cb23f827 | [
"Apache-2.0"
] | 1 | 2020-11-20T02:36:49.000Z | 2020-11-20T02:36:49.000Z | /*
* ModelCovergroup.h
*
* Created on: Nov 15, 2021
* Author: mballance
*/
#pragma once
#include <vector>
#include "IAccept.h"
#include "ModelCoverpoint.h"
#include "ModelCoverCross.h"
namespace vsc {
class ModelCovergroup : public IAccept {
public:
ModelCovergroup();
virtual ~ModelCovergroup();
void add_coverpoint(ModelCoverpoint *cp) {
m_coverpoints.push_back(ModelCoverpointUP(cp));
}
const std::vector<ModelCoverpointUP> &coverpoints() const {
return m_coverpoints;
}
void add_cross(ModelCoverCross *cross) {
m_crosses.push_back(ModelCoverCrossUP(cross));
}
const std::vector<ModelCoverCrossUP> &crosses() const {
return m_crosses;
}
void sample();
virtual void accept(IVisitor *v) override { v->visitModelCovergroup(this); }
private:
std::vector<ModelCoverpointUP> m_coverpoints;
std::vector<ModelCoverCrossUP> m_crosses;
};
} /* namespace vsc */
| 18.44898 | 77 | 0.725664 | [
"vector"
] |
f8dafa4398490227915822c5a934c9328b40bf75 | 4,705 | h | C | include/org/apache/lucene/store/IndexInput.h | lukhnos/objclucene | 29c7189a0b30ab3d3dd4c8ed148235ee296128b7 | [
"MIT"
] | 9 | 2016-01-13T05:38:05.000Z | 2020-06-04T23:05:03.000Z | include/org/apache/lucene/store/IndexInput.h | lukhnos/objclucene | 29c7189a0b30ab3d3dd4c8ed148235ee296128b7 | [
"MIT"
] | 4 | 2016-05-12T10:40:53.000Z | 2016-06-11T19:08:33.000Z | include/org/apache/lucene/store/IndexInput.h | lukhnos/objclucene | 29c7189a0b30ab3d3dd4c8ed148235ee296128b7 | [
"MIT"
] | 5 | 2016-01-13T05:37:39.000Z | 2019-07-27T16:53:10.000Z | //
// Generated by the J2ObjC translator. DO NOT EDIT!
// source: ./core/src/java/org/apache/lucene/store/IndexInput.java
//
#include "J2ObjC_header.h"
#pragma push_macro("INCLUDE_ALL_OrgApacheLuceneStoreIndexInput")
#ifdef RESTRICT_OrgApacheLuceneStoreIndexInput
#define INCLUDE_ALL_OrgApacheLuceneStoreIndexInput 0
#else
#define INCLUDE_ALL_OrgApacheLuceneStoreIndexInput 1
#endif
#undef RESTRICT_OrgApacheLuceneStoreIndexInput
#if __has_feature(nullability)
#pragma clang diagnostic push
#pragma GCC diagnostic ignored "-Wnullability"
#pragma GCC diagnostic ignored "-Wnullability-completeness"
#endif
#if !defined (OrgApacheLuceneStoreIndexInput_) && (INCLUDE_ALL_OrgApacheLuceneStoreIndexInput || defined(INCLUDE_OrgApacheLuceneStoreIndexInput))
#define OrgApacheLuceneStoreIndexInput_
#define RESTRICT_OrgApacheLuceneStoreDataInput 1
#define INCLUDE_OrgApacheLuceneStoreDataInput 1
#include "org/apache/lucene/store/DataInput.h"
#define RESTRICT_JavaIoCloseable 1
#define INCLUDE_JavaIoCloseable 1
#include "java/io/Closeable.h"
@protocol OrgApacheLuceneStoreRandomAccessInput;
/*!
@brief Abstract base class for input from a file in a <code>Directory</code>.A
random-access input stream.
Used for all Lucene index input operations.
<p><code>IndexInput</code> may only be used from one thread, because it is not
thread safe (it keeps internal state like file position). To allow
multithreaded use, every <code>IndexInput</code> instance must be cloned before
it is used in another thread. Subclasses must therefore implement <code>clone()</code>,
returning a new <code>IndexInput</code> which operates on the same underlying
resource, but positioned independently.
<p><b>Warning:</b> Lucene never closes cloned
<code>IndexInput</code>s, it will only call <code>close()</code> on the original object.
<p>If you access the cloned IndexInput after closing the original object,
any <code>readXXX</code> methods will throw <code>AlreadyClosedException</code>.
- seealso: Directory
*/
@interface OrgApacheLuceneStoreIndexInput : OrgApacheLuceneStoreDataInput < NSCopying, JavaIoCloseable >
#pragma mark Public
/*!
@brief <p><b>Warning:</b> Lucene never closes cloned
<code>IndexInput</code>s, it will only call <code>close()</code> on the original object.
<p>If you access the cloned IndexInput after closing the original object,
any <code>readXXX</code> methods will throw <code>AlreadyClosedException</code>.
*/
- (OrgApacheLuceneStoreIndexInput *)java_clone;
/*!
@brief Closes the stream to further operations.
*/
- (void)close;
/*!
@brief Returns the current position in this file, where the next read will
occur.
- seealso: #seek(long)
*/
- (jlong)getFilePointer;
/*!
@brief The number of bytes in the file.
*/
- (jlong)length;
/*!
@brief Creates a random-access slice of this index input, with the given offset and length.
<p>
The default implementation calls <code>slice</code>, and it doesn't support random access,
it implements absolute reads as seek+read.
*/
- (id<OrgApacheLuceneStoreRandomAccessInput>)randomAccessSliceWithLong:(jlong)offset
withLong:(jlong)length;
/*!
@brief Sets current position in this file, where the next read will occur.
- seealso: #getFilePointer()
*/
- (void)seekWithLong:(jlong)pos;
/*!
@brief Creates a slice of this index input, with the given description, offset, and length.
The slice is seeked to the beginning.
*/
- (OrgApacheLuceneStoreIndexInput *)sliceWithNSString:(NSString *)sliceDescription
withLong:(jlong)offset
withLong:(jlong)length;
- (NSString *)description;
#pragma mark Protected
/*!
@brief resourceDescription should be a non-null, opaque string
describing this resource; it's returned from
<code>toString</code>.
*/
- (instancetype __nonnull)initWithNSString:(NSString *)resourceDescription;
/*!
@brief Subclasses call this to get the String for resourceDescription of a slice of this <code>IndexInput</code>.
*/
- (NSString *)getFullSliceDescriptionWithNSString:(NSString *)sliceDescription;
// Disallowed inherited constructors, do not use.
- (instancetype __nonnull)init NS_UNAVAILABLE;
@end
J2OBJC_EMPTY_STATIC_INIT(OrgApacheLuceneStoreIndexInput)
FOUNDATION_EXPORT void OrgApacheLuceneStoreIndexInput_initWithNSString_(OrgApacheLuceneStoreIndexInput *self, NSString *resourceDescription);
J2OBJC_TYPE_LITERAL_HEADER(OrgApacheLuceneStoreIndexInput)
#endif
#if __has_feature(nullability)
#pragma clang diagnostic pop
#endif
#pragma pop_macro("INCLUDE_ALL_OrgApacheLuceneStoreIndexInput")
| 34.094203 | 145 | 0.761318 | [
"object"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.